feat(复习): 支持会话维度复习 + 标准导图按会话过滤(后端)

- MindMapNode 新增 sessionNum 字段
- BuiltinMindMapGenerator 生成节点时填充 sessionNum
- MindMapTreeTool.filterBySession() 按会话过滤标准导图
- recallCompare 接受 sessionNum 参数
- ReviewRecallRecordEntity 新增 sessionNum 字段
- Flyway V20260705_1: review_recall_records 加 session_num 列
- 新增 GET /study-sessions/tasks/{taskNum}/sessions 端点
This commit is contained in:
2026-07-05 14:40:38 +08:00
parent 22cc5dc871
commit a636e516d1
13 changed files with 144 additions and 3 deletions
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.protobuf.ServiceException;
import com.guo.learningprogresstracker.dto.StudySessionsDto;
import com.guo.learningprogresstracker.dto.response.SessionBriefVO;
import com.guo.learningprogresstracker.dto.response.StudySessionResponse;
import com.guo.learningprogresstracker.entity.StudyReportFragmentsEntity;
import com.guo.learningprogresstracker.entity.StudyReportsEntity;
@@ -26,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@@ -225,6 +227,34 @@ public class StudySessionsServiceImpl extends ServiceImpl<StudySessionsMapper, S
return result;
}
// ============ 获取任务会话列表(复习维度选择用) ============
@Override
public List<SessionBriefVO> getTaskSessions(String taskNum) {
var sessions = this.list(Wrappers.lambdaQuery(StudySessionsEntity.class)
.eq(StudySessionsEntity::getTaskNum, taskNum)
.orderByDesc(StudySessionsEntity::getStartTime));
return sessions.stream().map(s -> {
SessionBriefVO vo = new SessionBriefVO();
vo.setSessionNum(s.getSessionNum());
vo.setStartTime(s.getStartTime() != null ? s.getStartTime().toString() : null);
// 查询该会话的预期
Optional.ofNullable(studyExpectationsService.getBySessionNum(s.getSessionNum()))
.ifPresent(e -> vo.setExpectation(e.getDescription()));
// 统计报告和残片数量
long reportCount = studyReportsMapper.selectCount(
Wrappers.lambdaQuery(StudyReportsEntity.class)
.eq(StudyReportsEntity::getSessionNum, s.getSessionNum()));
long fragmentCount = studyReportFragmentsMapper.selectCount(
Wrappers.lambdaQuery(StudyReportFragmentsEntity.class)
.eq(StudyReportFragmentsEntity::getSessionNum, s.getSessionNum()));
vo.setReportCount((int) reportCount);
vo.setFragmentCount((int) fragmentCount);
return vo;
}).collect(Collectors.toList());
}
// ============ 活跃会话查询 ============
/**