| | |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import java.util.Set; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.hrm.enums.ErrorCodeConstants.*; |
| | |
| | | |
| | | @Override |
| | | public PageResult<HrmAttendanceRecordDO> getAttendanceRecordPage(HrmAttendanceRecordPageReqVO pageReqVO) { |
| | | return attendanceRecordMapper.selectPage(pageReqVO); |
| | | // 员工姓名模糊搜索:先按姓名查出员工ID集合,再按集合过滤 |
| | | // (hrm_attendance_record.user_id 存的是 hrm_employee.id) |
| | | Set<Long> nameMatchedIds = null; |
| | | if (StrUtil.isNotBlank(pageReqVO.getUserName())) { |
| | | List<HrmEmployeeDO> matched = employeeService.getEmployeeListByNameLike(pageReqVO.getUserName().trim()); |
| | | nameMatchedIds = matched.stream().map(HrmEmployeeDO::getId).collect(Collectors.toSet()); |
| | | if (nameMatchedIds.isEmpty()) { |
| | | // 姓名搜不到人时直接返回空,避免退化成查全部 |
| | | return PageResult.empty(); |
| | | } |
| | | } |
| | | return attendanceRecordMapper.selectPage(pageReqVO, nameMatchedIds); |
| | | } |
| | | |
| | | @Override |