SmartAttendanceMapper.xml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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
  6. `status`
  7. FROM
  8. `smart_attendance`
  9. GROUP BY
  10. `status`
  11. </select>
  12. <select id="askForLeavePage" resultType="com.template.model.vo.AskForLeaveVo">
  13. SELECT
  14. sa.id,
  15. su.head_image as image,
  16. sa.xw_user_name,
  17. su.card_no,
  18. sa.start_time,
  19. sa.end_time,
  20. sa.reason,
  21. sa.if_verification,
  22. sa.initiate_time
  23. FROM
  24. `smart_attendance` sa
  25. LEFT JOIN smart_user su ON su.id = sa.user_id
  26. WHERE
  27. sa.`status` = 6
  28. AND sa.deleted = 0
  29. <if test="name != null and name != ''">
  30. and sa.xw_user_name = #{name}
  31. </if>
  32. <if test="cardNo != null and cardNo != ''">
  33. and su.card_no = #{cardNo}
  34. </if>
  35. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  36. and sa.initiate_time &gt;= #{startTime} and sa.initiate_time &lt;= #{endTime}
  37. </if>
  38. <if test="ifVerification != null and ifVerification != ''">
  39. and sa.if_verification = #{ifVerification}
  40. </if>
  41. <if test="classId != null and classId != ''">
  42. and sa.class_id = #{classId}
  43. </if>
  44. ORDER BY sa.initiate_time desc
  45. </select>
  46. <select id="queryPage" resultType="com.template.model.vo.SmartAttendanceVo">
  47. SELECT
  48. sa.id,
  49. sa.xw_user_name as name,
  50. sc.`name` as className,
  51. sg.`name` as gradeName,
  52. su.card_no as cardNo,
  53. su.head_image as headImage,
  54. sa.attend_time as attendTime,
  55. sa.initiate_time as initiateTime,
  56. sa.`status`
  57. FROM
  58. `smart_attendance` sa
  59. LEFT JOIN smart_class sc on sa.class_id=sc.id
  60. LEFT JOIN smart_grade sg on sc.grade_id=sg.id
  61. LEFT JOIN smart_user su on sa.user_id=su.id
  62. where sa.deleted = 0
  63. <if test="gradeId != null and gradeId != ''">
  64. and sc.grade_id=#{gradeId}
  65. </if>
  66. <if test="classId != null and classId != ''">
  67. and sa.class_id = #{classId}
  68. </if>
  69. <if test="status != null and status != ''">
  70. and sa.`status` = #{status}
  71. </if>
  72. <if test="studentNo != null and studentNo != ''">
  73. and su.card_no = #{studentNo}
  74. </if>
  75. <if test="name != null and name != ''">
  76. and sa.xw_user_name = #{name}
  77. </if>
  78. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  79. and sa.attend_time &gt;= #{startTime} and sa.attend_time &lt;= #{endTime}
  80. </if>
  81. ORDER BY sa.create_time desc
  82. </select>
  83. </mapper>