2026-05-08 15:40:39 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
< !DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace= "com.klp.mapper.WmsAttendanceScheduleMapper" >
<resultMap type= "com.klp.domain.WmsAttendanceSchedule" id= "WmsAttendanceScheduleResult" >
<result property= "scheduleId" column= "schedule_id" />
<result property= "userId" column= "user_id" />
<result property= "workDate" column= "work_date" />
<result property= "shiftId" column= "shift_id" />
<result property= "shiftName" column= "shift_name" />
<result property= "shiftGroup" column= "shift_group" />
<result property= "remark" column= "remark" />
<result property= "delFlag" column= "del_flag" />
<result property= "createBy" column= "create_by" />
<result property= "updateBy" column= "update_by" />
<result property= "createTime" column= "create_time" />
<result property= "updateTime" column= "update_time" />
</resultMap>
2026-05-09 14:08:38 +08:00
<resultMap type= "com.klp.domain.vo.WmsAttendanceScheduleVo" id= "WmsAttendanceScheduleVoResult" >
<result property= "scheduleId" column= "schedule_id" />
<result property= "userId" column= "user_id" />
<result property= "workDate" column= "work_date" />
<result property= "shiftId" column= "shift_id" />
<result property= "shiftName" column= "shift_name" />
<result property= "shiftGroup" column= "shift_group" />
<result property= "remark" column= "remark" />
<result property= "employeeName" column= "employee_name" />
<result property= "employeeDept" column= "employee_dept" />
<result property= "employeeJobType" column= "employee_job_type" />
<result property= "shiftType" column= "shift_type" />
<result property= "shiftStartTime" column= "shift_start_time" />
<result property= "shiftEndTime" column= "shift_end_time" />
2026-05-12 15:04:00 +08:00
<result property= "shiftStartTime2" column= "shift_start_time2" />
<result property= "shiftEndTime2" column= "shift_end_time2" />
2026-05-09 14:08:38 +08:00
<result property= "workHours" column= "work_hours" />
2026-05-14 17:13:26 +08:00
<result property= "shiftIsCrossDay" column= "shift_is_cross_day" />
2026-05-09 14:08:38 +08:00
</resultMap>
<sql id= "selectScheduleWithDetailsVo" >
SELECT s.schedule_id, s.user_id, s.work_date, s.shift_id, s.shift_name, s.shift_group, s.remark,
e.name as employee_name, e.dept as employee_dept, e.job_type as employee_job_type,
2026-05-14 17:13:26 +08:00
sh.shift_type, sh.start_time as shift_start_time, sh.end_time as shift_end_time, sh.start_time2 as shift_start_time2, sh.end_time2 as shift_end_time2, sh.work_hours, sh.is_cross_day as shift_is_cross_day
2026-05-09 14:08:38 +08:00
FROM wms_attendance_schedule s
LEFT JOIN wms_employee_info e ON s.user_id = e.info_id AND e.del_flag = 0
LEFT JOIN wms_attendance_shift sh ON s.shift_id = sh.shift_id AND sh.del_flag = 0
WHERE s.del_flag = 0
</sql>
<select id= "selectScheduleWithDetails" parameterType= "java.util.Map" resultMap= "WmsAttendanceScheduleVoResult" >
<include refid= "selectScheduleWithDetailsVo" />
<if test= "userId != null" >
AND s.user_id = #{userId}
</if>
<if test= "workDate != null" >
AND s.work_date = #{workDate}
</if>
<if test= "shiftId != null" >
AND s.shift_id = #{shiftId}
</if>
2026-05-09 14:23:43 +08:00
<if test= "startDate != null" >
AND s.work_date >= #{startDate}
</if>
<if test= "endDate != null" >
AND s.work_date < = #{endDate}
</if>
2026-05-26 16:39:33 +08:00
<if test= "userIds != null and userIds.size > 0" >
AND s.user_id IN
<foreach collection= "userIds" item= "userIdItem" open= "(" separator= "," close= ")" >
#{userIdItem}
</foreach>
</if>
2026-05-09 14:08:38 +08:00
ORDER BY s.work_date DESC, s.user_id
</select>
2026-05-09 14:23:43 +08:00
<select id= "selectScheduleWithDetailsPage" resultMap= "WmsAttendanceScheduleVoResult" >
2026-05-09 14:08:38 +08:00
<include refid= "selectScheduleWithDetailsVo" />
2026-05-09 14:23:43 +08:00
<if test= "bo.userId != null" >
AND s.user_id = #{bo.userId}
2026-05-09 14:08:38 +08:00
</if>
2026-05-09 14:23:43 +08:00
<if test= "bo.workDate != null" >
AND s.work_date = #{bo.workDate}
2026-05-09 14:08:38 +08:00
</if>
2026-05-09 14:23:43 +08:00
<if test= "bo.shiftId != null" >
AND s.shift_id = #{bo.shiftId}
</if>
<if test= "bo.shiftName != null and bo.shiftName != ''" >
AND s.shift_name LIKE CONCAT('%', #{bo.shiftName}, '%')
</if>
<if test= "bo.shiftGroup != null and bo.shiftGroup != ''" >
AND s.shift_group = #{bo.shiftGroup}
2026-05-09 14:08:38 +08:00
</if>
2026-05-09 14:23:43 +08:00
<if test= "bo.startDate != null" >
AND s.work_date >= #{bo.startDate}
2026-05-09 14:08:38 +08:00
</if>
2026-05-09 14:23:43 +08:00
<if test= "bo.endDate != null" >
AND s.work_date < = #{bo.endDate}
2026-05-09 14:08:38 +08:00
</if>
2026-05-27 17:12:54 +08:00
<if test= "bo.userIds != null and bo.userIds.size > 0" >
AND s.user_id IN
<foreach collection= "bo.userIds" item= "userIdItem" open= "(" separator= "," close= ")" >
#{userIdItem}
</foreach>
</if>
2026-05-09 14:08:38 +08:00
ORDER BY s.work_date DESC, s.user_id
</select>
<insert id= "insertBatch" parameterType= "java.util.List" >
INSERT INTO wms_attendance_schedule (user_id, work_date, shift_id, shift_name, shift_group, remark)
VALUES
<foreach collection= "list" item= "item" separator= "," >
(#{item.userId}, #{item.workDate}, #{item.shiftId}, #{item.shiftName}, #{item.shiftGroup}, #{item.remark})
</foreach>
</insert>
2026-05-08 15:40:39 +08:00
</mapper>