From d5835cdf55a5b50e8b93531ca613d87596f7bacd Mon Sep 17 00:00:00 2001 From: cat_shark <1716967236@qq.com> Date: Sat, 30 May 2026 15:50:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E7=A2=8E=E7=89=87?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=92=8C=E4=BC=9A=E8=AF=9D=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=9A=84Controller=E7=AB=AF=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PUT /report-fragments/{id} 更新碎片内容 - GET /report-fragments/session/{sessionNum} 获取指定会话的完整碎片列表 --- .../controller/reportFragmentsController.java | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/guo/learningprogresstracker/controller/reportFragmentsController.java b/src/main/java/com/guo/learningprogresstracker/controller/reportFragmentsController.java index 7a0f0e7..c39c95e 100644 --- a/src/main/java/com/guo/learningprogresstracker/controller/reportFragmentsController.java +++ b/src/main/java/com/guo/learningprogresstracker/controller/reportFragmentsController.java @@ -1,16 +1,17 @@ package com.guo.learningprogresstracker.controller; import com.guo.learningprogresstracker.dto.request.CreateFragmentsRequest; +import com.guo.learningprogresstracker.dto.request.UpdateFragmentsRequest; import com.guo.learningprogresstracker.entity.CommonResult; +import com.guo.learningprogresstracker.entity.StudyReportFragmentsEntity; import com.guo.learningprogresstracker.exception.NotFindEntitiesException; import com.guo.learningprogresstracker.service.impl.StudyReportFragmentsServiceImpl; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.List; /** * 学习残片控制层 @@ -24,12 +25,29 @@ public class reportFragmentsController { /** * 创建学习残片 - * @param request - * @return */ @PostMapping public CommonResult createFragments(@Valid @RequestBody CreateFragmentsRequest request) throws NotFindEntitiesException { studyReportFragmentsServiceImpl.createFragments(request); return CommonResult.success(); } + + /** + * 更新学习残片 + */ + @PutMapping("/{id}") + public CommonResult updateFragments(@PathVariable Integer id, + @Valid @RequestBody UpdateFragmentsRequest request) throws NotFindEntitiesException { + studyReportFragmentsServiceImpl.updateFragments(id, request); + return CommonResult.success(); + } + + /** + * 获取指定会话的所有学习残片 + */ + @GetMapping("/session/{sessionNum}") + public CommonResult> getFragmentsBySession(@PathVariable String sessionNum) { + List fragments = studyReportFragmentsServiceImpl.getFragmentsBySession(sessionNum); + return CommonResult.success(fragments); + } }