refactor: 回忆改用独立存储与请求响应 DTO,服务按域拆包
This commit is contained in:
+7
-9
@@ -23,10 +23,10 @@ public class StudyExpectationsServiceImpl implements StudyExpectationsService {
|
||||
private final StudySessionsMapper studySessionsMapper;
|
||||
|
||||
@Override
|
||||
public StudyExpectationsEntity upsertExpectation(String sessionNum, String description) throws ErrorParameterException {
|
||||
public StudyExpectationsEntity upsertExpectation(String sessionNum, String description)
|
||||
throws ErrorParameterException {
|
||||
boolean sessionExists = studySessionsMapper.exists(
|
||||
Wrappers.<StudySessionsEntity>lambdaQuery()
|
||||
.eq(StudySessionsEntity::getSessionNum, sessionNum));
|
||||
Wrappers.<StudySessionsEntity>lambdaQuery().eq(StudySessionsEntity::getSessionNum, sessionNum));
|
||||
if (!sessionExists) {
|
||||
log.warn("学习会话[{}]不存在", sessionNum);
|
||||
throw new ErrorParameterException("这次学习会话不存在或已结束");
|
||||
@@ -47,16 +47,14 @@ public class StudyExpectationsServiceImpl implements StudyExpectationsService {
|
||||
|
||||
@Override
|
||||
public StudyExpectationsEntity getBySessionNum(String sessionNum) {
|
||||
return studyExpectationsMapper.selectOne(
|
||||
Wrappers.<StudyExpectationsEntity>lambdaQuery()
|
||||
.eq(StudyExpectationsEntity::getSessionNum, sessionNum)
|
||||
.last("LIMIT 1"));
|
||||
return studyExpectationsMapper.selectOne(Wrappers.<StudyExpectationsEntity>lambdaQuery()
|
||||
.eq(StudyExpectationsEntity::getSessionNum, sessionNum)
|
||||
.last("LIMIT 1"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBySessionNum(String sessionNum) {
|
||||
studyExpectationsMapper.delete(
|
||||
Wrappers.<StudyExpectationsEntity>lambdaQuery()
|
||||
.eq(StudyExpectationsEntity::getSessionNum, sessionNum));
|
||||
Wrappers.<StudyExpectationsEntity>lambdaQuery().eq(StudyExpectationsEntity::getSessionNum, sessionNum));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user