chore: 清理冗余注释,保留字段/业务含义注释
This commit is contained in:
+2
-11
@@ -27,9 +27,7 @@ import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【study_sessions(记录每次学习会话的具体数据)】的数据库操作Service实现
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
* 针对表【study_sessions(记录每次学习会话的具体数据)】的数据库操作Service实现
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -45,7 +43,6 @@ public class StudySessionsServiceImpl extends ServiceImpl<StudySessionsMapper, S
|
||||
private final StudyReportsMapper studyReportsMapper;
|
||||
|
||||
public StudySessionResponse startOrContinueStudySession(String taskNum) throws NotFindEntitiesException, ServiceException {
|
||||
// 拦截器已自动注入 created_by 条件,只有当前用户的 task 才能查到
|
||||
TaskEntity taskEntity = tasksServiceImpl.getOneOpt(
|
||||
Wrappers.lambdaQuery(TaskEntity.class).eq(TaskEntity::getTaskNum, taskNum))
|
||||
.orElseThrow(() -> new NotFindEntitiesException(String.format("[%s]不存在", taskNum)));
|
||||
@@ -82,7 +79,6 @@ public class StudySessionsServiceImpl extends ServiceImpl<StudySessionsMapper, S
|
||||
|
||||
@Override
|
||||
public void pauseStudySession(String sessionNum, LocalDateTime endTime) throws ErrorParameterException, ServiceException {
|
||||
// 拦截器自动校验归属,查不到即说明无权访问
|
||||
StudySessionsEntity studySessionsEntity = this.getOneOpt(Wrappers.lambdaQuery(StudySessionsEntity.class)
|
||||
.eq(StudySessionsEntity::getSessionNum, sessionNum))
|
||||
.orElseThrow(() -> new ErrorParameterException("会话[" + sessionNum + "]不存在"));
|
||||
@@ -98,13 +94,11 @@ public class StudySessionsServiceImpl extends ServiceImpl<StudySessionsMapper, S
|
||||
|
||||
@Override
|
||||
public void endedStudySession(String sessionNum, String content) throws ErrorParameterException {
|
||||
// 拦截器自动校验归属
|
||||
StudySessionsEntity studySessionsEntity = this.getOneOpt(Wrappers.lambdaQuery(StudySessionsEntity.class)
|
||||
.eq(StudySessionsEntity::getSessionNum, sessionNum))
|
||||
.orElseThrow(() -> new ErrorParameterException("会话[" + sessionNum + "]不存在"));
|
||||
studySessionsEntity.endedStudySession();
|
||||
this.updateById(studySessionsEntity);
|
||||
// 创建学习报告(created_by 由 MetaObjectHandler 自动填充)
|
||||
StudyReportsEntity studyReportsEntity = new StudyReportsEntity();
|
||||
studyReportsEntity.setSessionNum(sessionNum);
|
||||
studyReportsEntity.setContent(content);
|
||||
@@ -113,7 +107,6 @@ public class StudySessionsServiceImpl extends ServiceImpl<StudySessionsMapper, S
|
||||
|
||||
@Override
|
||||
public StudySessionResponse getNotEndedStudySessionByTaskNum(String taskNum) throws ErrorParameterException {
|
||||
// 拦截器自动注入 created_by,task 归属校验已内置
|
||||
TaskEntity task = tasksServiceImpl.getOneOpt(Wrappers.lambdaQuery(TaskEntity.class)
|
||||
.eq(TaskEntity::getTaskNum, taskNum))
|
||||
.orElseThrow(() -> new ErrorParameterException("任务[" + taskNum + "]不存在"));
|
||||
@@ -124,7 +117,6 @@ public class StudySessionsServiceImpl extends ServiceImpl<StudySessionsMapper, S
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getAllFragments(String sessionNum) throws ErrorParameterException {
|
||||
// 拦截器自动校验归属
|
||||
if (this.exists(Wrappers.lambdaQuery(StudySessionsEntity.class)
|
||||
.eq(StudySessionsEntity::getSessionNum, sessionNum))) {
|
||||
return studyReportFragmentsMapper.selectList(Wrappers.lambdaQuery(StudyReportFragmentsEntity.class)
|
||||
@@ -137,7 +129,6 @@ public class StudySessionsServiceImpl extends ServiceImpl<StudySessionsMapper, S
|
||||
|
||||
@Override
|
||||
public void continueStudySession(String sessionNum) throws ErrorParameterException, ServiceException {
|
||||
// 拦截器自动校验归属
|
||||
StudySessionsEntity studySessionsEntity = this.getOneOpt(Wrappers.lambdaQuery(StudySessionsEntity.class)
|
||||
.eq(StudySessionsEntity::getSessionNum, sessionNum))
|
||||
.orElseThrow(() -> new ErrorParameterException("会话[" + sessionNum + "]不存在"));
|
||||
@@ -153,7 +144,7 @@ public class StudySessionsServiceImpl extends ServiceImpl<StudySessionsMapper, S
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 sessionNum 获取学习会话(归属由拦截器自动校验)
|
||||
* 通过 sessionNum 获取学习会话
|
||||
*/
|
||||
public StudySessionResponse getStudySessionBySessionNum(String sessionNum) throws ErrorParameterException {
|
||||
StudySessionsEntity session = this.getOneOpt(Wrappers.lambdaQuery(StudySessionsEntity.class)
|
||||
|
||||
Reference in New Issue
Block a user