晏有为
2024-05-23 10de56ca16261e6a4eec49dfd32f0a6b232f7baf
performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
@@ -6,6 +6,7 @@
        <result column="name" property="name"/>
        <result column="shift_time" property="shiftTime"/>
        <result column="user_id" property="userId" />
        <result column="department" property="department" />
    </resultMap>
    <select id="performanceShiftPage" resultMap="performanceShiftPageMap">
@@ -25,6 +26,7 @@
            </if>
        </where>
        GROUP BY u.id
        order by s.create_time
    </select>
    <select id="performanceShiftYearPage" resultType="map">
@@ -42,5 +44,68 @@
        </if>
        <if test="laboratory != null and laboratory != ''">
        </if>
        order by s.create_time
    </select>
    <select id="performanceShiftYear" resultType="java.util.Map">
        SELECT if(u.department is not null and u.department != '', CONCAT(u.name, '(', u.department, ')'), u.name) name,
        s.user_id, u.account,
        DATE_FORMAT(s.work_time, '%c') work_time,
        GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), ':', s.shift order by s.work_time SEPARATOR ';') month_str
        FROM performance_shift s
        LEFT JOIN user u on u.id = s.user_id
        where s.shift is not NULL
        and s.shift != ''
        <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.name like concat('%', #{userName}, '%')
        </if>
        <if test="laboratory != null and laboratory != ''">
        </if>
        GROUP BY u.id
        order by s.create_time
    </select>
    <select id="performanceShiftYearList" resultType="map">
        SELECT if(u.department is not null and u.department != '', CONCAT(u.name, '(', u.department, ')'), u.name) name,
        s.user_id, u.account,
        DATE_FORMAT(s.work_time, '%c') work_time,
        GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), ':', s.shift order by s.work_time SEPARATOR ';') month_str
        FROM performance_shift s
        LEFT JOIN user u on u.id = s.user_id
        where s.shift is not NULL
        and s.shift != ''
        <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.name like concat('%', #{userName}, '%')
        </if>
        <if test="laboratory != null and laboratory != ''">
        </if>
        GROUP BY u.id
        order by s.create_time
    </select>
    <select id="performanceShiftList" resultMap="performanceShiftPageMap">
        SELECT
        if(u.department is not null and u.department != '', CONCAT(u.name, '(', u.department, ')'), u.name) name,
        GROUP_CONCAT(s.work_time, ':', s.shift, ':', s.id order by s.work_time SEPARATOR ';') AS shift_time, u.id user_id, u.department
        FROM performance_shift s
        LEFT JOIN user u on u.id = s.user_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.name like concat('%', #{userName}, '%')
            </if>
            <if test="laboratory != null and laboratory != ''">
            </if>
        </where>
        GROUP BY u.id
        order by s.create_time
    </select>
</mapper>