SmartAttendanceMapper.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.template.mapper.SmartAttendanceMapper">
  4. <select id="getGroup" resultType="java.lang.Integer">
  5. SELECT `status`
  6. FROM `smart_attendance`
  7. GROUP BY `status`
  8. </select>
  9. <select id="askForLeavePage" resultType="com.template.model.vo.AskForLeaveVo">
  10. SELECT
  11. sa.id,
  12. su.head_image as image,
  13. sa.xw_user_name as xwUserName,
  14. sc.name as className,
  15. su.card_no as cardNo,
  16. sa.start_time as startTime,
  17. sa.end_time as endTime,
  18. sa.reason,
  19. sa.if_verification as ifVerification,
  20. sa.initiate_time as initiateTime
  21. FROM
  22. `smart_attendance` sa
  23. LEFT JOIN smart_user su ON su.id = sa.user_id
  24. LEFT JOIN smart_class sc ON sc.id = sa.class_id
  25. WHERE
  26. sa.`status` = 6
  27. AND sa.deleted = 0
  28. <if test="name != null and name != ''">
  29. and sa.xw_user_name like '%' #{name} '%'
  30. </if>
  31. <if test="cardNo != null and cardNo != ''">
  32. and su.card_no = #{cardNo}
  33. </if>
  34. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  35. and sa.initiate_time &gt;= #{startTime} and sa.initiate_time &lt;= #{endTime}
  36. </if>
  37. <if test="ifVerification != null and ifVerification != ''">
  38. and sa.if_verification = #{ifVerification}
  39. </if>
  40. <if test="classId != null and classId != ''">
  41. and sa.class_id = #{classId}
  42. </if>
  43. ORDER BY sa.initiate_time desc
  44. </select>
  45. <select id="queryPage" resultType="com.template.model.vo.SmartAttendanceVo">
  46. SELECT
  47. sa.id,
  48. sa.xw_user_name as name,
  49. sc.`name` as className,
  50. sg.`name` as gradeName,
  51. su.card_no as cardNo,
  52. su.head_image as headImage,
  53. sa.attend_time as attendTime,
  54. sa.initiate_time as initiateTime,
  55. sa.`status`
  56. FROM
  57. `smart_attendance` sa
  58. LEFT JOIN smart_class sc on sa.class_id=sc.id
  59. LEFT JOIN smart_grade sg on sc.grade_id=sg.id
  60. LEFT JOIN smart_user su on sa.user_id=su.id
  61. where sa.deleted = 0
  62. <if test="gradeId != null and gradeId != ''">
  63. and sc.grade_id=#{gradeId}
  64. </if>
  65. <if test="classId != null and classId != ''">
  66. and sa.class_id = #{classId}
  67. </if>
  68. <if test="status != null and status != ''">
  69. and sa.`status` = #{status}
  70. </if>
  71. <if test="studentNo != null and studentNo != ''">
  72. and su.card_no = #{studentNo}
  73. </if>
  74. <if test="name != null and name != ''">
  75. and sa.xw_user_name like '%' #{name} '%'
  76. </if>
  77. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  78. and ((sa.attend_time &gt;= #{startTime} and sa.attend_time &lt;= #{endTime}) or (sa.initiate_time &gt;= #{startTime} and sa.initiate_time &lt;= #{endTime}))
  79. </if>
  80. ORDER BY sa.create_time desc
  81. </select>
  82. <select id="queryExpor" resultType="com.template.model.vo.SmartAttendanceVo">
  83. SELECT
  84. sa.id,
  85. sa.xw_user_name as name,
  86. sc.`name` as className,
  87. sg.`name` as gradeName,
  88. su.card_no as cardNo,
  89. su.head_image as headImage,
  90. sa.attend_time as attendTime,
  91. sa.initiate_time as initiateTime,
  92. sa.`status`
  93. FROM
  94. `smart_attendance` sa
  95. LEFT JOIN smart_class sc on sa.class_id=sc.id
  96. LEFT JOIN smart_grade sg on sc.grade_id=sg.id
  97. LEFT JOIN smart_user su on sa.user_id=su.id
  98. where sa.deleted = 0
  99. <if test="gradeId != null and gradeId != ''">
  100. and sc.grade_id=#{gradeId}
  101. </if>
  102. <if test="classId != null and classId != ''">
  103. and sa.class_id = #{classId}
  104. </if>
  105. <if test="status != null and status != ''">
  106. and sa.`status` = #{status}
  107. </if>
  108. <if test="studentNo != null and studentNo != ''">
  109. and su.card_no = #{studentNo}
  110. </if>
  111. <if test="name != null and name != ''">
  112. and sa.xw_user_name like '%' #{name} '%'
  113. </if>
  114. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  115. and ((sa.attend_time &gt;= #{startTime} and sa.attend_time &lt;= #{endTime}) or (sa.initiate_time &gt;= #{startTime} and sa.initiate_time &lt;= #{endTime}))
  116. </if>
  117. ORDER BY sa.create_time desc
  118. </select>
  119. <select id="askForLeaveScreenPage" resultType="com.template.model.vo.AskForLeaveScreenVo">
  120. SELECT
  121. sa.id,
  122. su.head_image as headImage,
  123. su.`name` as name,
  124. sc.`name` as className,
  125. su.card_no as cardNo,
  126. sa.start_time as startTime,
  127. sa.end_time as endTime,
  128. sa.reason,
  129. sa.if_verification as ifVerification
  130. FROM
  131. `smart_attendance` sa
  132. LEFT JOIN smart_user su ON sa.user_id = su.id
  133. LEFT JOIN smart_class sc ON sa.class_id = sc.id
  134. WHERE
  135. sa.deleted = 0
  136. AND sa.`status` =6
  137. <if test="keyWord != null and keyWord != ''">
  138. and (su.card_no like '%' #{keyWord} '%' or su.name like '%' #{keyWord} '%')
  139. </if>
  140. <if test="ifVerification != null and ifVerification != ''">
  141. and sa.if_verification = #{ifVerification}
  142. </if>
  143. <if test="gradeId != null and gradeId != ''">
  144. and su.grade = #{gradeId}
  145. </if>
  146. <if test="classId != null and classId != ''">
  147. and su.school_class = #{classId}
  148. </if>
  149. ORDER BY sa.initiate_time desc
  150. </select>
  151. <select id="getClassHistoricalAttendance" resultType="com.template.model.vo.ClasAttendanceVo">
  152. SELECT COUNT(*) AS count,
  153. `status`
  154. FROM
  155. `smart_attendance`
  156. WHERE
  157. deleted=0
  158. AND class_id = #{id}
  159. AND attend_time >= #{startTime}
  160. AND #{endTime} >= attend_time
  161. GROUP BY
  162. `status`
  163. </select>
  164. <select id="ackDetail" resultType="com.template.model.vo.AckDetailVo">
  165. SELECT sat.xw_user_name as name,
  166. su.card_no as cardNo,
  167. sat.initiate_time as initiateTime,
  168. sat.start_time as startTime,
  169. sat.end_time as endTime,
  170. sat.reason as reason
  171. FROM `smart_attendance` sat
  172. left join smart_user su
  173. on sat.user_id = su.id
  174. where sat.`status` = 6
  175. AND sat.deleted = 0
  176. AND sat.user_id = #{userId}
  177. AND sat.initiate_time >= #{startTime}
  178. AND #{endTime} >= sat.initiate_time
  179. </select>
  180. </mapper>