修改积分池查询逻辑:子部门自动使用父部门的积分池

This commit is contained in:
Your Name 2026-01-20 10:19:53 +08:00
parent 3aa9af5924
commit d0591c088b
2 changed files with 15 additions and 2 deletions

View File

@ -26,12 +26,25 @@ public class TeamScorePoolService {
/**
* 根据部门ID获取积分池
* 如果当前部门没有积分池,向上查找父部门的积分池
*/
public TeamScorePool getByDeptId(Long deptId) {
return teamScorePoolMapper.selectOne(
// 首先查找当前部门的积分池
TeamScorePool pool = teamScorePoolMapper.selectOne(
new LambdaQueryWrapper<TeamScorePool>()
.eq(TeamScorePool::getDeptId, deptId)
.eq(TeamScorePool::getTeamId, deptId)
);
// 如果当前部门没有积分池,向上查找父部门
if (pool == null) {
Department department = departmentMapper.selectById(deptId);
if (department != null && department.getParentId() != null && department.getParentId() > 0) {
log.debug("部门{}没有积分池,查找父部门{}的积分池", deptId, department.getParentId());
return getByDeptId(department.getParentId()); // 递归查找父部门
}
}
return pool;
}
/**

Binary file not shown.