[xingyu.guo] feat: 1. 抽取通用url 2. 完成【通过学习任务num获取该任务的未结束会话】API 3. 优化【通过sessionNum获取一个【学习会话】】API名称

This commit is contained in:
guo
2024-09-22 09:27:15 +08:00
parent 11079de2a2
commit 5e37839b0b
4 changed files with 33 additions and 9 deletions
@@ -61,6 +61,15 @@ public class StudySessionsServiceImpl extends ServiceImpl<StudySessionsMapper, S
studySessionsEntity.pausedStudySession();
this.updateById(studySessionsEntity);
}
@Override
public StudySessionResponce getNotEndedStudySessionByTaskNum(String taskNum) throws ErrorParameterException {
StudySessionsEntity studySessionsEntity = this.getOneOpt(Wrappers.lambdaQuery(StudySessionsEntity.class)
.eq(StudySessionsEntity::getTaskNum, taskNum)
.ne(StudySessionsEntity::getSessionState, StudySessionStateEnum.ENDED.name()))
.orElseThrow(() -> new ErrorParameterException("任务[" + taskNum + "]不存在进行中或暂停中的会话"));
return StudySessionConvert.MAPPER.toStudySessionResponce(studySessionsEntity);
}
}