From dc7300e21fe53f74e08eb2fa494a83430e2e54ca Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 26 三月 2026 11:25:58 +0800
Subject: [PATCH] 绩效管理:人员考勤功能模块

---
 performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml |   67 ++++++++++++++++++++++++---------
 1 files changed, 49 insertions(+), 18 deletions(-)

diff --git a/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml b/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
index 56bd55b..381ef69 100644
--- a/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
+++ b/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
@@ -2,17 +2,25 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.performance.mapper.PerformanceShiftMapper">
 
-    <resultMap id="performanceShiftPageMap" type="com.ruoyi.performance.dto.PerformanceShiftMapDto">
-        <result column="name" property="name"/>
+    <resultMap id="performanceShiftMap" type="com.ruoyi.performance.dto.PerformanceShiftMapDto">
+        <id column="id" property="id"/>
+        <result column="shift" property="shift"/>
+        <result column="work_time" property="workTime"/>
+        <result column="annotation_text" property="annotationText"/>
+        <result column="user_name" property="userName"/>
         <result column="shift_time" property="shiftTime"/>
         <result column="user_id" property="userId" />
         <result column="department" property="department" />
     </resultMap>
 
-    <select id="performanceShiftPage" resultMap="performanceShiftPageMap">
+    <select id="performanceShift" resultMap="performanceShiftMap">
         SELECT
-        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
+        s.id,
+        s.shift,
+        s.work_time,
+        s.annotation_text,
+        u2.name AS user_name,
+        u2.id user_id
         FROM performance_shift s
         LEFT JOIN (SELECT distinct u.* from
         user u
@@ -24,15 +32,14 @@
         </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' )
+            u2.name is not null
+            <if test="firstDayOfMonth != null and lastDayOfMonth != null">
+                AND s.work_time BETWEEN #{firstDayOfMonth} AND #{lastDayOfMonth}
             </if>
             <if test="userName != null and userName != ''">
                 and u2.name like concat('%', #{userName}, '%')
             </if>
         </where>
-        GROUP BY u2.id
         order by s.create_time
     </select>
 
@@ -61,12 +68,14 @@
         order by s.create_time
     </select>
 
-    <select id="performanceShiftYear" resultType="java.util.Map">
-        SELECT
-        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
+    <select id="performanceShiftYear" resultMap="performanceShiftMap">
+        SELECT distinct
+        u2.name AS user_name,
+        s.user_id,
+        u2.account,
+        DATE_FORMAT(s.work_time, '%c') month_num,
+        s.shift,
+        s.id
         FROM performance_shift s
         LEFT JOIN (SELECT u.* from
         user u
@@ -84,9 +93,8 @@
             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>
-        GROUP BY u2.id
         order by s.create_time
     </select>
 
@@ -112,7 +120,7 @@
         order by s.create_time
     </select>
 
-    <select id="performanceShiftList" resultMap="performanceShiftPageMap">
+    <select id="performanceShiftList" resultMap="performanceShiftMap">
         SELECT
         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
@@ -137,4 +145,27 @@
         from department_lims
         where id = #{depLimsId}
     </select>
+    <select id="selectListByWorkTime" resultType="com.ruoyi.performance.dto.PerformanceShiftMapDto">
+        SELECT
+            ps.id,
+            ps.shift,
+            ps.work_time,
+            ps.user_id,
+            u.name AS user_name,
+            u.account AS person_code,
+            st.start_time,
+            st.end_time
+        FROM performance_shift ps
+        LEFT JOIN user u ON ps.user_id = u.id
+        LEFT JOIN shift_time st ON ps.shift = st.shift
+        <where>
+            <if test="startTime!=null and endTime!=null">
+                AND ps.work_time BETWEEN #{startTime} AND #{endTime}
+            </if>
+            <if test="keyword!='' and keyword!=null">
+                AND (u.account like concat('%',#{keyword},'%') OR u.name like concat('%',#{keyword},'%'))
+            </if>
+        </where>
+        ORDER BY ps.work_time
+    </select>
 </mapper>

--
Gitblit v1.9.3