feat(预期):学习预期后端闭环——实体/服务/端点
- 迁移:study_expectations.session_num 改为 varchar 对齐会话编码
- StudyExpectationsEntity / Mapper / Service:每会话一条预期,重复创建覆盖
- StudySessionController:PUT/GET /{sessionNum}/expectation
- 移除空的 studySessionList 占位方法
This commit is contained in:
+21
-2
@@ -2,9 +2,12 @@ package com.guo.learningprogresstracker.controller;
|
||||
|
||||
import com.google.protobuf.ServiceException;
|
||||
import com.guo.learningprogresstracker.dto.request.EndedStudySessionRequest;
|
||||
import com.guo.learningprogresstracker.dto.request.UpsertExpectationRequest;
|
||||
import com.guo.learningprogresstracker.dto.response.StudySessionResponse;
|
||||
import com.guo.learningprogresstracker.entity.CommonResult;
|
||||
import com.guo.learningprogresstracker.entity.StudyExpectationsEntity;
|
||||
import com.guo.learningprogresstracker.exception.ErrorParameterException;
|
||||
import com.guo.learningprogresstracker.service.StudyExpectationsService;
|
||||
import com.guo.learningprogresstracker.service.impl.StudySessionsServiceImpl;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
@@ -26,9 +29,25 @@ public class StudySessionController {
|
||||
|
||||
private final StudySessionsServiceImpl studySessionsServiceImpl;
|
||||
|
||||
@PostMapping
|
||||
public void studySessionList() {
|
||||
private final StudyExpectationsService studyExpectationsService;
|
||||
|
||||
/**
|
||||
* 创建/更新学习会话的学习预期
|
||||
*/
|
||||
@PutMapping("/{sessionNum}/expectation")
|
||||
public CommonResult<StudyExpectationsEntity> upsertExpectation(
|
||||
@PathVariable("sessionNum") String sessionNum,
|
||||
@Valid @RequestBody UpsertExpectationRequest request) throws ErrorParameterException {
|
||||
return CommonResult.success(studyExpectationsService.upsertExpectation(sessionNum, request.getDescription()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取学习会话的学习预期
|
||||
*/
|
||||
@GetMapping("/{sessionNum}/expectation")
|
||||
public CommonResult<StudyExpectationsEntity> getExpectation(
|
||||
@PathVariable("sessionNum") String sessionNum) {
|
||||
return CommonResult.success(studyExpectationsService.getBySessionNum(sessionNum));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user