| | |
| | | |
| | | @Override |
| | | public PageResult<HrmEmployeeDO> getEmployeePage(HrmEmployeePageReqVO pageReqVO) { |
| | | if (pageReqVO.getDeptId() != null) { |
| | | // 选中部门时,连带查询其所有子部门的员工(含自身) |
| | | List<DeptRespDTO> childDepts = deptApi.getChildDeptList(pageReqVO.getDeptId()); |
| | | Set<Long> deptIds = new LinkedHashSet<>(); |
| | | deptIds.add(pageReqVO.getDeptId()); |
| | | if (CollUtil.isNotEmpty(childDepts)) { |
| | | childDepts.forEach(dept -> deptIds.add(dept.getId())); |
| | | } |
| | | return employeeMapper.selectPageByDeptIds(pageReqVO, deptIds); |
| | | } |
| | | return employeeMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | public List<HrmEmployeeDO> getEmployeeList(Collection<Long> ids) { |
| | | // ids 为 null 时表示查询全部员工(考勤汇总、薪酬核算等批量场景依赖此语义); |
| | | // 显式传入空集合时返回空,避免误查全员 |
| | | if (ids == null) { |
| | | return employeeMapper.selectList(null); |
| | | } |
| | | if (ids.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return employeeMapper.selectByIds(ids); |
| | | } |
| | | |