Crunchy
2024-05-08 f2aec44685466b0c514bffa7db4a2d0db1a7f28c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?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.yuanchu.mom.mapper.PerformanceShiftMapper">
 
    <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
        FROM performance_shift s
                 LEFT JOIN user u on u.id = s.user_id
        GROUP BY u.id
        <where>
            <if test="time != null and time != ''">
                and s.work_time in DATE_FORMAT(#{time}, '%Y-%m-%d')
            </if>
            <if test="userName != null and userName != ''">
                and s.name concat('%', #{userName}, '%')
            </if>
            <if test="laboratory != null and laboratory != ''"></if>
        </where>
    </select>
</mapper>