AttendanceRecordMapper.xml
2.36 KB
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
<?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="AttendanceRecordV1ServiceDaoImpl">
<insert id="saveAttendanceRecord" parameterType="com.java110.po.property.AttendanceRecordPo">
INSERT INTO attendance_record(id, user_id, user_name, work_type, punch_type, punch_time, punch_address, longitude, latitude, store_id, create_time)
VALUES(#{id}, #{userId}, #{userName}, #{workType}, #{punchType}, #{punchTime}, #{punchAddress}, #{longitude}, #{latitude}, #{storeId}, NOW())
</insert>
<select id="queryAttendanceRecords" parameterType="map" resultType="map">
SELECT * FROM attendance_record WHERE 1=1
<if test="userId != null and userId != ''">AND user_id = #{userId}</if>
<if test="workType != null and workType != ''">AND work_type = #{workType}</if>
<if test="punchType != null and punchType != ''">AND punch_type = #{punchType}</if>
<if test="startTime != null and startTime != ''">AND punch_time >= #{startTime}</if>
<if test="endTime != null and endTime != ''">AND punch_time <= #{endTime}</if>
<if test="storeId != null and storeId != ''">AND store_id = #{storeId}</if>
ORDER BY punch_time DESC
<if test="page != null and page != '' and row != null and row != ''">
LIMIT #{page}, #{row}
</if>
</select>
<select id="queryAttendanceRecordsCount" parameterType="map" resultType="map">
SELECT COUNT(1) count FROM attendance_record WHERE 1=1
<if test="userId != null and userId != ''">AND user_id = #{userId}</if>
<if test="workType != null and workType != ''">AND work_type = #{workType}</if>
<if test="punchType != null and punchType != ''">AND punch_type = #{punchType}</if>
<if test="startTime != null and startTime != ''">AND punch_time >= #{startTime}</if>
<if test="endTime != null and endTime != ''">AND punch_time <= #{endTime}</if>
<if test="storeId != null and storeId != ''">AND store_id = #{storeId}</if>
</select>
<select id="queryTodayAttendanceByType" parameterType="map" resultType="map">
SELECT * FROM attendance_record
WHERE user_id = #{userId} AND punch_type = #{punchType}
AND DATE(punch_time) = CURDATE()
LIMIT 1
</select>
</mapper>