From e3853368e05aad326fdbb7e1057d23cb77918c7b Mon Sep 17 00:00:00 2001
From: value <z1292839451@163.com>
Date: 星期二, 14 五月 2024 02:25:10 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml |  103 +++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 94 insertions(+), 9 deletions(-)

diff --git a/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml b/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
index ceff2b1..697da8a 100644
--- a/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
+++ b/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
@@ -2,22 +2,107 @@
 <!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">
+    <resultMap id="performanceShiftPageMap" type="com.yuanchu.mom.dto.PerformanceShiftMapDto">
+        <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
-            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 shift_time, u.id user_id
         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>
+
+    <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
+        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>
+    </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.work_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.work_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
     </select>
 </mapper>

--
Gitblit v1.9.3