南昌市物联网技防平台-学校版后台
zengh
2021-06-03 723946c6b272e5aa4c7ec110ff1395f6c2b23e89
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.jfpt.attendance.mapper.AttendanceMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="attendanceResultMap" type="org.springblade.jfpt.attendance.entity.Attendance">
        <id column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="number" property="number"/>
        <result column="department" property="department"/>
        <result column="weather" property="weather"/>
        <result column="clockTime" property="clocktime"/>
        <result column="jd" property="jd"/>
        <result column="wd" property="wd"/>
        <result column="clockType" property="clocktype"/>
        <result column="attendanceType" property="attendancetype"/>
        <result column="tenant_id" property="tenantId"/>
        <result column="week" property="week"/>
        <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}
        </if>
        <if test="attendance.department!=null and attendance.department != ''">
            and department = #{department}
        </if>
        <if test="attendance.attendancetype!=null and attendance.attendancetype != ''">
            and attendancetype = #{attendance.attendancetype}
        </if>
        <if test="attendance.beginTime!=null and attendance.beginTime!=''">
            and clockTime&gt;=#{attendance.beginTime}
        </if>
        <if test="attendance.endTime!=null and attendance.endTime!=''">
            and clockTime&lt;=#{attendance.endTime}
        </if>
    </select>
 
    <select id="exportAttendane" resultType="org.springblade.jfpt.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}
        </if>
        <if test="beginTimes!=null and beginTimes!=''">
            and clockTime&gt;=#{beginTimes}
        </if>
        <if test="endTimes!=null and endTimes!=''">
            and clockTime&lt;=#{endTimes}
        </if>
        <if test="attendancetypes!=null and attendancetypes!=''">
            and attendancetype=#{attendancetypes}
        </if>
    </select>
 
    <!--查询当前考勤人员当天的考勤信息-->
    <select id="selAttendanceListNow" resultType="org.springblade.jfpt.attendance.entity.Attendance">
        select * from sys_attendance
            where
        number = #{number}
            and
        to_days(now())=to_days(clockTime)
            and
        is_deleted=0
    </select>
 
    <!--查询当前时间之前最新的一条数据-->
    <select id="selAttendanceNewNow" resultType="org.springblade.jfpt.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
        limit 1
    </select>
 
 
</mapper>