| | |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmAttendanceRecordPageReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.workhour.vo.HrmEmployeeWorkHourReqVO; |
| | | import cn.iocoder.yudao.module.hrm.dal.dataobject.attendance.HrmAttendanceRecordDO; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 考勤打卡记录 Mapper |
| | | * |
| | | * @author 芋道源码 |
| | | * @author 超级管理员 |
| | | */ |
| | | @Mapper |
| | | public interface HrmAttendanceRecordMapper extends BaseMapperX<HrmAttendanceRecordDO> { |
| | |
| | | .orderByDesc(HrmAttendanceRecordDO::getDate)); |
| | | } |
| | | |
| | | /** |
| | | * 员工工时统计(考勤口径):按员工聚合出勤天数、正常工时与加班工时 |
| | | */ |
| | | default List<Map<String, Object>> selectWorkHourSummary(HrmEmployeeWorkHourReqVO reqVO) { |
| | | return selectMaps(new QueryWrapper<HrmAttendanceRecordDO>() |
| | | .select("user_id", |
| | | "COUNT(*) AS work_days", |
| | | "SUM(IFNULL(work_hours, 0)) AS work_hours", |
| | | "SUM(IFNULL(overtime_hours, 0)) AS overtime_hours") |
| | | .eq(reqVO.getUserId() != null, "user_id", reqVO.getUserId()) |
| | | .eq(reqVO.getDeptId() != null, "dept_id", reqVO.getDeptId()) |
| | | .ge(reqVO.getStartDate() != null, "date", reqVO.getStartDate()) |
| | | .le(reqVO.getEndDate() != null, "date", reqVO.getEndDate()) |
| | | .groupBy("user_id")); |
| | | } |
| | | |
| | | default HrmAttendanceRecordDO selectByUserIdAndDate(Long userId, LocalDate date) { |
| | | return selectOne(new LambdaQueryWrapperX<HrmAttendanceRecordDO>() |
| | | .eq(HrmAttendanceRecordDO::getUserId, userId) |