zhuo
2024-07-23 5ed5f51d479989d5b2149b09c82b6b3ea495b589
performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
@@ -11,21 +11,27 @@
    <select id="performanceShiftPage" 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
        if(u2.department is not null and u2.department != '', CONCAT(u2.name, '(', u2.department, ')'), u2.name) name,
        GROUP_CONCAT(s.work_time, ':', s.shift, ':', s.id order by s.work_time SEPARATOR ';') AS shift_time, u2.id user_id
        FROM performance_shift s
        LEFT JOIN user u on u.id = s.user_id
        LEFT JOIN (SELECT u.* from
        user u
        left join department_lims dl on FIND_IN_SET(dl.id,u.depart_lims_id)
        where state=1
        <if test="laboratory != null and laboratory != ''">
          and   dl.name=#{laboratory}
        </if>
         ) u2    on u2.id = s.user_id
        <where>
            name is not null
            <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 != ''">
                and u2.name like concat('%', #{userName}, '%')
            </if>
        </where>
        GROUP BY u.id
        GROUP BY u2.id
        order by s.create_time
    </select>
@@ -108,4 +114,10 @@
        GROUP BY u.id
        order by s.create_time
    </select>
    <select id="seldepLimsId" resultType="java.lang.String">
        select name
        from department_lims
        where id = #{depLimsId}
    </select>
</mapper>