feat(历史报告): 展示学习预期目标以区分各会话
StudyReportsEntity 新增 sessionExpectation 字段(非数据库), getTaskReports() 查询后自动填充对应会话的预期描述, 前端报告条目显示 sessionNum + 预期目标。
This commit is contained in:
@@ -33,6 +33,11 @@ public class StudyReportsEntity extends BaseEntity implements Serializable {
|
||||
@TableField(value = "content")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 对应学习会话的预期目标(非数据库字段,查询时填充)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String sessionExpectation;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
+9
-1
@@ -214,7 +214,15 @@ public class StudySessionsServiceImpl extends ServiceImpl<StudySessionsMapper, S
|
||||
if (keyword != null && !keyword.isBlank()) {
|
||||
wrapper.like(StudyReportsEntity::getContent, keyword);
|
||||
}
|
||||
return studyReportsMapper.selectPage(pg, wrapper);
|
||||
Page<StudyReportsEntity> result = studyReportsMapper.selectPage(pg, wrapper);
|
||||
// 填充每个报告对应会话的预期目标
|
||||
for (StudyReportsEntity report : result.getRecords()) {
|
||||
if (report.getSessionNum() != null) {
|
||||
Optional.ofNullable(studyExpectationsService.getBySessionNum(report.getSessionNum()))
|
||||
.ifPresent(e -> report.setSessionExpectation(e.getDescription()));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// ============ 活跃会话查询 ============
|
||||
|
||||
Reference in New Issue
Block a user