Crunchy
2024-05-08 907e38b9b4079d29a8b63778226f723528f0053f
performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
@@ -4,20 +4,20 @@
    <select id="performanceShiftPage" resultType="map">
        SELECT
            s.id,
            if(u.department is not null and u.department != '', CONCAT(u.name, '(', u.department, ')'), u.name) name,
            GROUP_CONCAT(s.work_time, ':', s.shift SEPARATOR ';') AS shiftTime
        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 shiftTime
        FROM performance_shift s
                 LEFT JOIN user u on u.id = s.user_id
        GROUP BY u.id
        LEFT JOIN user u on u.id = s.user_id
        <where>
            <if test="time != null and time != ''">
                and s.work_time in DATE_FORMAT(#{time}, '%Y-%m-%d')
                and DATE_FORMAT(s.work_time, '%Y-%m') = DATE_FORMAT(#{time}, '%Y-%m' )
            </if>
            <if test="userName != null and userName != ''">
                and s.name concat('%', #{userName}, '%')
                and u.name like concat('%', #{userName}, '%')
            </if>
            <if test="laboratory != null and laboratory != ''"></if>
            <if test="laboratory != null and laboratory != ''">
            </if>
        </where>
        GROUP BY u.id
    </select>
</mapper>