diff --git a/src/main/java/com/guo/learningprogresstracker/entity/StudyReportsEntity.java b/src/main/java/com/guo/learningprogresstracker/entity/StudyReportsEntity.java index 77add7a..d2b82bf 100644 --- a/src/main/java/com/guo/learningprogresstracker/entity/StudyReportsEntity.java +++ b/src/main/java/com/guo/learningprogresstracker/entity/StudyReportsEntity.java @@ -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; diff --git a/src/main/java/com/guo/learningprogresstracker/service/impl/StudySessionsServiceImpl.java b/src/main/java/com/guo/learningprogresstracker/service/impl/StudySessionsServiceImpl.java index 7628d07..fcc93d6 100644 --- a/src/main/java/com/guo/learningprogresstracker/service/impl/StudySessionsServiceImpl.java +++ b/src/main/java/com/guo/learningprogresstracker/service/impl/StudySessionsServiceImpl.java @@ -214,7 +214,15 @@ public class StudySessionsServiceImpl extends ServiceImpl 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; } // ============ 活跃会话查询 ============