feat:1.优化commonResult 2. 重新初始化数据库结构

This commit is contained in:
2025-06-29 15:30:40 +08:00
parent 794a54c738
commit aa9a278108
10 changed files with 64 additions and 59 deletions
@@ -41,7 +41,7 @@ public class StudySessionController {
* 通过sessionNum获取一个【学习会话】
*/
@GetMapping("/{sessionNum}")
public CommonResult getStudySessionBySessionNum(@NotEmpty(message = "sessionNum不可为空") @PathVariable String sessionNum) throws ErrorParameterException {
public CommonResult<StudySessionResponce> getStudySessionBySessionNum(@NotEmpty(message = "sessionNum不可为空") @PathVariable String sessionNum) throws ErrorParameterException {
StudySessionsEntity studySessionsEntity = studySessionsServiceImpl.getOneOpt(Wrappers.lambdaQuery(StudySessionsEntity.class)
.eq(StudySessionsEntity::getSessionNum, sessionNum))
.orElseThrow(() -> new ErrorParameterException("会话[" + sessionNum + "]不存在"));
@@ -53,7 +53,7 @@ public class StudySessionController {
* 暂停一个【学习会话】
*/
@PostMapping("/{sessionNum}/study-sessions/pause")
public CommonResult pauseStudySession(@PathVariable("sessionNum") String sessionNum) throws ErrorParameterException {
public CommonResult<Void> pauseStudySession(@PathVariable("sessionNum") String sessionNum) throws ErrorParameterException {
studySessionsServiceImpl.pauseStudySession(sessionNum);
return CommonResult.success();
}
@@ -62,16 +62,17 @@ public class StudySessionController {
* 结束一个【学习会话】
*/
@PostMapping("/{sessionNum}/study-sessions/ended")
public CommonResult endedStudySession(@PathVariable("sessionNum") String sessionNum,
@Valid @RequestBody EndedStudySessionRequest request) throws ErrorParameterException {
studySessionsServiceImpl.endedStudySession(sessionNum,request.getContent());
public CommonResult<Void> endedStudySession(@PathVariable("sessionNum") String sessionNum,
@Valid @RequestBody EndedStudySessionRequest request) throws ErrorParameterException {
studySessionsServiceImpl.endedStudySession(sessionNum, request.getContent());
return CommonResult.success();
}
/**
* 获取【学习会话】所有的学习残片数据,以列表返回
*/
@GetMapping("/{sessionNum}/all-fragments")
public CommonResult getAllFragments(@PathVariable("sessionNum") String sessionNum) throws ErrorParameterException {
public CommonResult<ArrayList<String>> getAllFragments(@PathVariable("sessionNum") String sessionNum) throws ErrorParameterException {
ArrayList<String> allFragments = studySessionsServiceImpl.getAllFragments(sessionNum);
return CommonResult.success(allFragments);