<?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.ruoyi.staff.mapper.PersonalShiftMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.ruoyi.staff.pojo.PersonalShift">
|
<id column="id" property="id" />
|
<result column="personal_attendance_location_config_id" property="personalAttendanceLocationConfigId" />
|
<result column="staff_on_job_id" property="staffOnJobId" />
|
<result column="create_time" property="createTime" />
|
<result column="update_time" property="updateTime" />
|
<result column="work_time" property="workTime" />
|
</resultMap>
|
<select id="performanceShiftPage" resultType="com.ruoyi.staff.dto.PerformanceShiftMapDto">
|
SELECT
|
u.staff_name name,
|
GROUP_CONCAT(s.work_time, ':', IFNULL(palc.shift, ''), ':', s.id order by s.work_time SEPARATOR ';') AS shift_time,
|
u.id user_id
|
FROM personal_shift s
|
LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id
|
LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id
|
<where>
|
<if test="sysDeptId != null and sysDeptId != ''">
|
and u.sys_dept_id = #{sysDeptId}
|
</if>
|
<if test="time != null and time != ''">
|
and DATE_FORMAT(s.work_time, '%Y-%m') = DATE_FORMAT(#{time}, '%Y-%m' )
|
</if>
|
<if test="userName != null and userName != ''">
|
and u.staff_name like concat('%', #{userName}, '%')
|
</if>
|
</where>
|
GROUP BY u.id
|
order by s.create_time
|
</select>
|
|
<select id="performanceShiftYear" resultType="java.util.Map">
|
SELECT
|
u.staff_name name,
|
u.id user_id,
|
u.staff_no account,
|
DATE_FORMAT(s.work_time, '%c') work_time,
|
GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), ':', IFNULL(palc.shift, '') order by s.work_time SEPARATOR ';') month_str
|
FROM personal_shift s
|
LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id
|
LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id
|
<where>
|
<if test="time != null and time != ''">
|
and DATE_FORMAT(s.work_time, '%Y') = DATE_FORMAT(#{time}, '%Y' )
|
</if>
|
<if test="userName != null and userName != ''">
|
and u.staff_name like concat('%', #{userName}, '%')
|
</if>
|
<if test="sysDeptId != null and sysDeptId != ''">
|
and u.sys_dept_id = #{sysDeptId}
|
</if>
|
</where>
|
GROUP BY u.id
|
order by s.create_time
|
</select>
|
<select id="performanceShiftYearList" resultType="java.util.Map">
|
SELECT
|
u.staff_name name,
|
s.staff_on_job_id user_id, u.staff_no account,
|
DATE_FORMAT(s.work_time, '%c') work_time,
|
GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), ':', IFNULL(palc.shift, '') order by s.work_time SEPARATOR ';') month_str
|
FROM personal_shift s
|
LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id
|
LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id
|
<where>
|
<if test="time != null and time != ''">
|
and DATE_FORMAT(s.work_time, '%Y') = DATE_FORMAT(#{time}, '%Y' )
|
</if>
|
<if test="userName != null and userName != ''">
|
and u.staff_name like concat('%', #{userName}, '%')
|
</if>
|
<if test="sysDeptId != null and sysDeptId != ''">
|
and u.sys_dept_id = #{sysDeptId}
|
</if>
|
</where>
|
GROUP BY u.id
|
order by s.create_time
|
</select>
|
<select id="performanceShiftList" resultType="com.ruoyi.staff.dto.PerformanceShiftMapDto">
|
SELECT
|
u.staff_name name,
|
GROUP_CONCAT(s.work_time, ':', IFNULL(palc.shift, ''), ':', s.id order by s.work_time SEPARATOR ';') AS shift_time, u.id user_id
|
FROM personal_shift s
|
LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id
|
LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id
|
<where>
|
<if test="time != null and time != ''">
|
and DATE_FORMAT(s.work_time, '%Y-%m') = DATE_FORMAT(#{time}, '%Y-%m' )
|
</if>
|
<if test="userName != null and userName != ''">
|
and u.staff_name like concat('%', #{userName}, '%')
|
</if>
|
<if test="sysDeptId != null and sysDeptId != ''">
|
and u.sys_dept_id = #{sysDeptId}
|
</if>
|
</where>
|
GROUP BY u.id
|
order by s.create_time
|
</select>
|
|
</mapper>
|