From 5bdb7fbe5290dd64342de92f12ffb45c3f5abe28 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 09 Mar 2022 15:27:05 +0800
Subject: [PATCH] 导入测试接口修改(admin用),自动生成保安证编号并存档
---
src/main/java/org/springblade/modules/attendance/mapper/AttendanceMapper.xml | 86 +++++++++++++++++++++++++++++--------------
1 files changed, 58 insertions(+), 28 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 ba494cc..7b08a66 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,72 @@
<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.beginTime!=null and attendance.beginTime!=''">
- and clockTime>=#{attendance.beginTime}
+ and date_format(sa.clock_time,'%Y-%m-%d')>=#{attendance.beginTime}
</if>
<if test="attendance.endTime!=null and attendance.endTime!=''">
- and clockTime<=#{attendance.endTime}
+ and date_format(sa.clock_time,'%Y-%m-%d')<=#{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 '早退'
+ when sa.attendance_type=4 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>=#{beginTimes}
+ <if test="attendance.deptId!=null">
+ and sa.dept_id = #{attendance.deptId}
</if>
- <if test="endTimes!=null and endTimes!=''">
- and clockTime<=#{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>=#{attendance.beginTime}
+ </if>
+ <if test="attendance.endTime!=null and attendance.endTime!=''">
+ and sa.clock_time<=#{attendance.endTime}
+ </if>
+ order by sa.id desc
</select>
<!--查询当前考勤人员当天的考勤信息-->
@@ -61,7 +93,7 @@
where
number = #{number}
and
- to_days(now())=to_days(clockTime)
+ to_days(now())=to_days(clock_time)
and
is_deleted=0
</select>
@@ -69,13 +101,11 @@
<!--查询当前时间之前最新的一条数据-->
<select id="selAttendanceNewNow" resultType="org.springblade.modules.attendance.entity.Attendance">
select * from sys_attendance
- where
- number = #{number}
- and
- to_days(now())=to_days(clockTime)
- and
- is_deleted=0
- order by clockTime desc
+ where
+ user_id = #{userId}
+ and
+ to_days(now())=to_days(clock_time)
+ order by clock_time desc
limit 1
</select>
--
Gitblit v1.9.3