| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <?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="com.template.mapper.SmartAttendanceMapper">
- <select id="getGroup" resultType="java.lang.Integer">
- SELECT `status`
- FROM `smart_attendance`
- GROUP BY `status`
- </select>
- <select id="askForLeavePage" resultType="com.template.model.vo.AskForLeaveVo">
- SELECT
- sa.id,
- su.head_image as image,
- sa.xw_user_name as xwUserName,
- sc.name as className,
- su.card_no as cardNo,
- sa.start_time as startTime,
- sa.end_time as endTime,
- sa.reason,
- sa.if_verification as ifVerification,
- sa.initiate_time as initiateTime
- FROM
- `smart_attendance` sa
- LEFT JOIN smart_user su ON su.id = sa.user_id
- LEFT JOIN smart_class sc ON sc.id = sa.class_id
- WHERE
- sa.`status` = 6
- AND sa.deleted = 0
- <if test="name != null and name != ''">
- and sa.xw_user_name like '%' #{name} '%'
- </if>
- <if test="cardNo != null and cardNo != ''">
- and su.card_no = #{cardNo}
- </if>
- <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
- and sa.initiate_time >= #{startTime} and sa.initiate_time <= #{endTime}
- </if>
- <if test="ifVerification != null and ifVerification != ''">
- and sa.if_verification = #{ifVerification}
- </if>
- <if test="classId != null and classId != ''">
- and sa.class_id = #{classId}
- </if>
- ORDER BY sa.initiate_time desc
- </select>
- <select id="queryPage" resultType="com.template.model.vo.SmartAttendanceVo">
- SELECT
- sa.id,
- sa.xw_user_name as name,
- sc.`name` as className,
- sg.`name` as gradeName,
- su.card_no as cardNo,
- su.head_image as headImage,
- sa.attend_time as attendTime,
- sa.initiate_time as initiateTime,
- sa.`status`
- FROM
- `smart_attendance` sa
- LEFT JOIN smart_class sc on sa.class_id=sc.id
- LEFT JOIN smart_grade sg on sc.grade_id=sg.id
- LEFT JOIN smart_user su on sa.user_id=su.id
- where sa.deleted = 0
- <if test="gradeId != null and gradeId != ''">
- and sc.grade_id=#{gradeId}
- </if>
- <if test="classId != null and classId != ''">
- and sa.class_id = #{classId}
- </if>
- <if test="status != null and status != ''">
- and sa.`status` = #{status}
- </if>
- <if test="studentNo != null and studentNo != ''">
- and su.card_no = #{studentNo}
- </if>
- <if test="name != null and name != ''">
- and sa.xw_user_name like '%' #{name} '%'
- </if>
- <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
- and ((sa.attend_time >= #{startTime} and sa.attend_time <= #{endTime}) or (sa.initiate_time >= #{startTime} and sa.initiate_time <= #{endTime}))
- </if>
- ORDER BY sa.create_time desc
- </select>
- <select id="queryExpor" resultType="com.template.model.vo.SmartAttendanceVo">
- SELECT
- sa.id,
- sa.xw_user_name as name,
- sc.`name` as className,
- sg.`name` as gradeName,
- su.card_no as cardNo,
- su.head_image as headImage,
- sa.attend_time as attendTime,
- sa.initiate_time as initiateTime,
- sa.`status`
- FROM
- `smart_attendance` sa
- LEFT JOIN smart_class sc on sa.class_id=sc.id
- LEFT JOIN smart_grade sg on sc.grade_id=sg.id
- LEFT JOIN smart_user su on sa.user_id=su.id
- where sa.deleted = 0
- <if test="gradeId != null and gradeId != ''">
- and sc.grade_id=#{gradeId}
- </if>
- <if test="classId != null and classId != ''">
- and sa.class_id = #{classId}
- </if>
- <if test="status != null and status != ''">
- and sa.`status` = #{status}
- </if>
- <if test="studentNo != null and studentNo != ''">
- and su.card_no = #{studentNo}
- </if>
- <if test="name != null and name != ''">
- and sa.xw_user_name like '%' #{name} '%'
- </if>
- <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
- and ((sa.attend_time >= #{startTime} and sa.attend_time <= #{endTime}) or (sa.initiate_time >= #{startTime} and sa.initiate_time <= #{endTime}))
- </if>
- ORDER BY sa.create_time desc
- </select>
- <select id="askForLeaveScreenPage" resultType="com.template.model.vo.AskForLeaveScreenVo">
- SELECT
- sa.id,
- su.head_image as headImage,
- su.`name` as name,
- sc.`name` as className,
- su.card_no as cardNo,
- sa.start_time as startTime,
- sa.end_time as endTime,
- sa.reason,
- sa.if_verification as ifVerification
- FROM
- `smart_attendance` sa
- LEFT JOIN smart_user su ON sa.user_id = su.id
- LEFT JOIN smart_class sc ON sa.class_id = sc.id
- WHERE
- sa.deleted = 0
- AND sa.`status` =6
- <if test="keyWord != null and keyWord != ''">
- and (su.card_no like '%' #{keyWord} '%' or su.name like '%' #{keyWord} '%')
- </if>
- <if test="ifVerification != null and ifVerification != ''">
- and sa.if_verification = #{ifVerification}
- </if>
- <if test="gradeId != null and gradeId != ''">
- and su.grade = #{gradeId}
- </if>
- <if test="classId != null and classId != ''">
- and su.school_class = #{classId}
- </if>
- ORDER BY sa.initiate_time desc
- </select>
- <select id="getClassHistoricalAttendance" resultType="com.template.model.vo.ClasAttendanceVo">
- SELECT COUNT(*) AS count,
- `status`
- FROM
- `smart_attendance`
- WHERE
- deleted=0
- AND class_id = #{id}
- AND attend_time >= #{startTime}
- AND #{endTime} >= attend_time
- GROUP BY
- `status`
- </select>
- <select id="ackDetail" resultType="com.template.model.vo.AckDetailVo">
- SELECT sat.xw_user_name as name,
- su.card_no as cardNo,
- sat.initiate_time as initiateTime,
- sat.start_time as startTime,
- sat.end_time as endTime,
- sat.reason as reason
- FROM `smart_attendance` sat
- left join smart_user su
- on sat.user_id = su.id
- where sat.`status` = 6
- AND sat.deleted = 0
- AND sat.user_id = #{userId}
- AND sat.initiate_time >= #{startTime}
- AND #{endTime} >= sat.initiate_time
- </select>
- </mapper>
|