feat(review): 新增复习内容滚动展示与交互 API

- 新增 /review/feed 端点,合并报告和残片数据按时间倒序返回
- 新增 /review/report/{id} 和 /review/fragment/{id} 端点
- 支持复习内容在首页滚动展示及点击查看详情
This commit is contained in:
2026-05-23 19:22:55 +08:00
parent a7cb4a1167
commit 375ec8858c
6 changed files with 192 additions and 0 deletions
@@ -0,0 +1,50 @@
package com.guo.learningprogresstracker.controller;
import com.guo.learningprogresstracker.dto.ReviewFeedItem;
import com.guo.learningprogresstracker.entity.CommonResult;
import com.guo.learningprogresstracker.entity.StudyReportFragmentsEntity;
import com.guo.learningprogresstracker.entity.StudyReportsEntity;
import com.guo.learningprogresstracker.exception.NotFindEntitiesException;
import com.guo.learningprogresstracker.service.impl.ReviewServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 复习模块控制层 — 复习内容滚动展示与交互
*/
@RequestMapping("/review")
@RestController
@Validated
@RequiredArgsConstructor
public class ReviewController {
private final ReviewServiceImpl reviewService;
/**
* 获取复习 feed,合并报告和残片按时间倒序
*/
@GetMapping("/feed")
public CommonResult<List<ReviewFeedItem>> getReviewFeed(
@RequestParam(defaultValue = "30") int limit) {
return CommonResult.success(reviewService.getReviewFeed(limit));
}
/**
* 获取报告详情
*/
@GetMapping("/report/{id}")
public CommonResult<StudyReportsEntity> getReportDetail(@PathVariable int id) throws NotFindEntitiesException {
return CommonResult.success(reviewService.getReportDetail(id));
}
/**
* 获取残片详情
*/
@GetMapping("/fragment/{id}")
public CommonResult<StudyReportFragmentsEntity> getFragmentDetail(@PathVariable int id) throws NotFindEntitiesException {
return CommonResult.success(reviewService.getFragmentDetail(id));
}
}