fix: TeamScorePoolService 使用 selectList+findFirst 避免重复数据导致 TooManyResultsException
This commit is contained in:
parent
f6d612c998
commit
a300837414
@ -29,10 +29,13 @@ public class TeamScorePoolService {
|
||||
* 使用 dept_id 关联部门(team_id 为遗留字段)。若当前部门无积分池且存在父部门,则向上查找父部门积分池(三级部门共享二级)。
|
||||
*/
|
||||
public TeamScorePool getByDeptId(Long deptId) {
|
||||
TeamScorePool pool = teamScorePoolMapper.selectOne(
|
||||
// 使用 selectList + findFirst 避免重复数据导致的 TooManyResultsException
|
||||
TeamScorePool pool = teamScorePoolMapper.selectList(
|
||||
new LambdaQueryWrapper<TeamScorePool>()
|
||||
.eq(TeamScorePool::getDeptId, deptId)
|
||||
);
|
||||
.orderByAsc(TeamScorePool::getId)
|
||||
.last("LIMIT 1")
|
||||
).stream().findFirst().orElse(null);
|
||||
|
||||
if (pool == null) {
|
||||
Department department = departmentMapper.selectById(deptId);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user