fix: 修复回忆列表并发死锁并收敛多表查询
This commit is contained in:
+19
@@ -7,6 +7,9 @@ import com.guo.learningprogresstracker.exception.ErrorParameterException;
|
||||
import com.guo.learningprogresstracker.mapper.StudyExpectationsMapper;
|
||||
import com.guo.learningprogresstracker.mapper.StudySessionsMapper;
|
||||
import com.guo.learningprogresstracker.service.StudyExpectationsService;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -52,6 +55,22 @@ public class StudyExpectationsServiceImpl implements StudyExpectationsService {
|
||||
.last("LIMIT 1"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> descriptionsBySessionNums(Collection<String> sessionNums) {
|
||||
if (sessionNums == null || sessionNums.isEmpty()) {
|
||||
return Map.of();
|
||||
}
|
||||
return studyExpectationsMapper
|
||||
.selectList(Wrappers.<StudyExpectationsEntity>lambdaQuery()
|
||||
.in(StudyExpectationsEntity::getSessionNum, sessionNums))
|
||||
.stream()
|
||||
.filter(e -> e.getDescription() != null)
|
||||
.collect(Collectors.toMap(
|
||||
StudyExpectationsEntity::getSessionNum,
|
||||
StudyExpectationsEntity::getDescription,
|
||||
(first, second) -> first));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBySessionNum(String sessionNum) {
|
||||
studyExpectationsMapper.delete(
|
||||
|
||||
Reference in New Issue
Block a user