From 51ec98113c6d49d0f7eec4e3c030e55e337e97db Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期一, 26 五月 2025 15:47:16 +0800
Subject: [PATCH] 芯导软件(江苏)有限公司  delete

---
 performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml |   85 +++++++++++++++++++++++++++++++++---------
 1 files changed, 66 insertions(+), 19 deletions(-)

diff --git a/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml b/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
index 0b702be..ac10624 100644
--- a/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
+++ b/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
@@ -6,63 +6,84 @@
         <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">
         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 distinct 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>
 
     <select id="performanceShiftYearPage" resultType="map">
         SELECT
         s.user_id, s.shift
         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 s.shift is not NULL
         and s.shift != ''
+        and name is not null
         <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}, '%')
+            and u2.name like concat('%', #{userName}, '%')
         </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,
+        SELECT if(u2.department is not null and u2.department != '', CONCAT(u2.name, '锛�', u2.department, '锛�'), u2.name) name,
+        s.user_id, u2.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
+        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 s.shift is not NULL
         and s.shift != ''
+        and name is not null
         <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.work_time
+        GROUP BY u2.id
+        order by s.create_time
     </select>
 
     <select id="performanceShiftYearList" resultType="map">
@@ -83,6 +104,32 @@
         <if test="laboratory != null and laboratory != ''">
         </if>
         GROUP BY u.id
-        order by s.work_time
+        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>
+
+    <select id="seldepLimsId" resultType="java.lang.String">
+        select name
+        from department_lims
+        where id = #{depLimsId}
     </select>
 </mapper>

--
Gitblit v1.9.3