fix: 修复回忆列表并发死锁并收敛多表查询

This commit is contained in:
2026-11-21 16:54:07 +08:00
parent 4b65eb57b1
commit 9c3e22680d
17 changed files with 497 additions and 128 deletions
@@ -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(