[xingyu.guo] feat: 1. 替换所有响应值中的id为num,不将非业务字段展示给外部 2. 调整[实际使用时间]等字段类型为double,方便计算\保存与读取 3. 【获取所有任务列表】api,完善功能,并增加分页功能 4.将int类型修改为使用Integer,更加安全
This commit is contained in:
+10
-8
@@ -1,5 +1,6 @@
|
||||
package com.guo.learningprogresstracker.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.guo.learningprogresstracker.dto.response.StudySessionResponce;
|
||||
import com.guo.learningprogresstracker.entity.CommonResult;
|
||||
import com.guo.learningprogresstracker.entity.StudySessionsEntity;
|
||||
@@ -32,12 +33,13 @@ public class StudySessionController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过sessionId获取一个【学习会话】
|
||||
* 通过sessionNum获取一个【学习会话】
|
||||
*/
|
||||
@GetMapping("/{sessionId}")
|
||||
public CommonResult getStudySession(@NotEmpty(message = "sessionId不可为空") @PathVariable String sessionId) throws ErrorParameterException {
|
||||
StudySessionsEntity studySessionsEntity = studySessionsServiceImpl.getOptById(sessionId)
|
||||
.orElseThrow(() -> new ErrorParameterException("会话[" + sessionId + "]不存在"));
|
||||
@GetMapping("/{sessionNum}")
|
||||
public CommonResult getStudySession(@NotEmpty(message = "sessionId不可为空") @PathVariable String sessionNum) throws ErrorParameterException {
|
||||
StudySessionsEntity studySessionsEntity = studySessionsServiceImpl.getOneOpt(Wrappers.lambdaQuery(StudySessionsEntity.class)
|
||||
.eq(StudySessionsEntity::getSessionNum, sessionNum))
|
||||
.orElseThrow(() -> new ErrorParameterException("会话[" + sessionNum + "]不存在"));
|
||||
StudySessionResponce studySessionResponce = StudySessionConvert.MAPPER.toStudySessionResponce(studySessionsEntity);
|
||||
return CommonResult.success(studySessionResponce);
|
||||
}
|
||||
@@ -45,9 +47,9 @@ public class StudySessionController {
|
||||
/**
|
||||
* 暂停一个【学习会话】
|
||||
*/
|
||||
@PostMapping("/{taskId}/studay-sessions/pause")
|
||||
public CommonResult pauseStudySession(@PathVariable("sessionId") String sessionId) throws ErrorParameterException {
|
||||
studySessionsServiceImpl.pauseStudySession(sessionId);
|
||||
@PostMapping("/{sessionNum}/studay-sessions/pause")
|
||||
public CommonResult pauseStudySession(@PathVariable("sessionNum") String sessionNum) throws ErrorParameterException {
|
||||
studySessionsServiceImpl.pauseStudySession(sessionNum);
|
||||
return CommonResult.success();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user