From 8853292babb2ad94de4a3207966f1e83b767cd2d Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Sun, 17 Sep 2023 16:38:34 +0800
Subject: [PATCH] 新增流程节点进程查询接口

---
 src/main/java/org/springblade/modules/attendance/mapper/AttendanceMapper.xml |   76 +++++++++++++++++++++++++++-----------
 1 files changed, 54 insertions(+), 22 deletions(-)

diff --git a/src/main/java/org/springblade/modules/attendance/mapper/AttendanceMapper.xml b/src/main/java/org/springblade/modules/attendance/mapper/AttendanceMapper.xml
index f3cf109..8f26f9d 100644
--- a/src/main/java/org/springblade/modules/attendance/mapper/AttendanceMapper.xml
+++ b/src/main/java/org/springblade/modules/attendance/mapper/AttendanceMapper.xml
@@ -19,40 +19,74 @@
         <result column="address" property="address"/>
     </resultMap>
 
-
-    <select id="selectAttendancePage" resultMap="attendanceResultMap">
-        select * from sys_attendance where is_deleted = 0
-        <if test="attendance.name!=null and attendance.name != ''">
-            and name = #{attendance.name}
+    <!--自定义查询考试分页数据-->
+    <select id="selectAttendancePage" resultType="org.springblade.modules.attendance.vo.AttendanceVO">
+        select sa.*,bu.real_name realName from sys_attendance sa
+        left join blade_user bu on bu.id = sa.user_id
+        where 1=1
+        <if test="attendance.realName!=null and attendance.realName!=''">
+            and bu.real_name like concat('%',#{attendance.realName},'%')
         </if>
-        <if test="attendance.department!=null and attendance.department != ''">
-            and department = #{department}
+        <if test="attendance.deptId!=null">
+            and sa.dept_id = #{attendance.deptId}
         </if>
-        <if test="attendance.attendancetype!=null and attendance.attendancetype != ''">
-            and attendancetype = #{attendance.attendancetype}
+        <if test="attendance.userId!=null">
+            and sa.user_id = #{attendance.userId}
+        </if>
+        <if test="attendance.attendanceType!=null">
+            and sa.attendance_type = #{attendance.attendanceType}
+        </if>
+        <if test="attendance.clockType!=null">
+            and sa.clock_type = #{attendance.clockType}
+        </if>
+        <if test="attendance.legwork!=null">
+            and sa.legwork = #{attendance.legwork}
         </if>
         <if test="attendance.beginTime!=null and attendance.beginTime!=''">
-            and clockTime&gt;=#{attendance.beginTime}
+            and date_format(sa.clock_time,'%Y-%m-%d')&gt;=#{attendance.beginTime}
         </if>
         <if test="attendance.endTime!=null and attendance.endTime!=''">
-            and clockTime&lt;=#{attendance.endTime}
+            and date_format(sa.clock_time,'%Y-%m-%d')&lt;=#{attendance.endTime}
         </if>
+        order by sa.id desc
     </select>
 
     <select id="exportAttendane" resultType="org.springblade.modules.attendance.excel.AttendanceExcel">
-        SELECT id, name, number, department, weather, clockTime, clockType, attendanceType,week,address FROM sys_attendance where is_deleted = 0
-        <if test="name!=null and name != ''">
-            and name = #{name}
+        select
+        sa.clock_time clockTime,
+        bu.real_name realName,
+        bd.dept_name deptName,
+        if(sa.clock_type=1,'上班','下班') clockType,
+        case when sa.attendance_type=1 then '正常'
+        when sa.attendance_type=2 then '迟到'
+        when sa.attendance_type=3 then '早退'
+        else '无效打卡' end as attendanceType
+         from sys_attendance sa
+        left join blade_user bu on bu.id = sa.user_id
+        left join blade_dept bd on bd.id = sa.dept_id
+        where 1=1
+        <if test="attendance.realName!=null and attendance.realName!=''">
+            and bu.real_name like concat('%',#{attendance.realName},'%')
         </if>
-        <if test="beginTimes!=null and beginTimes!=''">
-            and clockTime&gt;=#{beginTimes}
+        <if test="attendance.deptId!=null">
+            and sa.dept_id = #{attendance.deptId}
         </if>
-        <if test="endTimes!=null and endTimes!=''">
-            and clockTime&lt;=#{endTimes}
+        <if test="attendance.userId!=null">
+            and sa.user_id = #{attendance.userId}
         </if>
-        <if test="attendancetypes!=null and attendancetypes!=''">
-            and attendancetype=#{attendancetypes}
+        <if test="attendance.clockType!=null">
+            and sa.clock_type = #{attendance.clockType}
         </if>
+        <if test="attendance.attendanceType!=null">
+            and sa.attendance_type = #{attendance.attendanceType}
+        </if>
+        <if test="attendance.beginTime!=null and attendance.beginTime!=''">
+            and sa.clock_time&gt;=#{attendance.beginTime}
+        </if>
+        <if test="attendance.endTime!=null and attendance.endTime!=''">
+            and sa.clock_time&lt;=#{attendance.endTime}
+        </if>
+        order by sa.id desc
     </select>
 
     <!--查询当前考勤人员当天的考勤信息-->
@@ -62,8 +96,6 @@
         number = #{number}
             and
         to_days(now())=to_days(clock_time)
-            and
-        is_deleted=0
     </select>
 
     <!--查询当前时间之前最新的一条数据-->

--
Gitblit v1.9.3