| | |
| | | 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 org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 考勤打卡记录 Mapper |
| | |
| | | .orderByAsc(HrmAttendanceRecordDO::getDate)); |
| | | } |
| | | |
| | | /** |
| | | * 按员工聚合考勤工时,用于月度工时汇总与员工工时统计。 |
| | | * |
| | | * @return user_id / work_days / work_hours / overtime_hours |
| | | */ |
| | | @Select(""" |
| | | <script> |
| | | SELECT user_id, |
| | | COUNT(DISTINCT date) AS work_days, |
| | | IFNULL(SUM(work_hours), 0) AS work_hours, |
| | | IFNULL(SUM(overtime_hours), 0) AS overtime_hours |
| | | FROM hrm_attendance_record |
| | | WHERE deleted = 0 |
| | | <if test="reqVO.userId != null"> AND user_id = #{reqVO.userId} </if> |
| | | <if test="reqVO.deptId != null"> AND dept_id = #{reqVO.deptId} </if> |
| | | <if test="reqVO.startDate != null"> AND date >= #{reqVO.startDate} </if> |
| | | <if test="reqVO.endDate != null"> AND date <= #{reqVO.endDate} </if> |
| | | GROUP BY user_id |
| | | ORDER BY user_id |
| | | </script> |
| | | """) |
| | | List<Map<String, Object>> selectWorkHourSummary(@Param("reqVO") HrmEmployeeWorkHourReqVO reqVO); |
| | | |
| | | } |