StudentReportRecordMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.xjrsoft.module.student.mapper.StudentReportRecordMapper">
  6. <select id="getClassStatistics" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto"
  7. resultType="com.xjrsoft.module.student.vo.StudentReportRecordStatisticsVo">
  8. SELECT t1.name AS class_name,t2.name AS teacher_name,
  9. (
  10. SELECT COUNT(*) FROM xjr_user a1
  11. INNER JOIN base_student_school_roll a2 ON a1.id = a2.user_id
  12. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
  13. AND a2.class_id = t1.id
  14. ) AS all_count,
  15. (
  16. SELECT COUNT(*) FROM xjr_user a1
  17. INNER JOIN base_student_school_roll a2 ON a1.id = a2.user_id
  18. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
  19. AND a1.gender = 'SB10001' AND a2.class_id = t1.id
  20. ) AS male_count,
  21. (
  22. SELECT COUNT(*) FROM xjr_user a1
  23. INNER JOIN base_student_school_roll a2 ON a1.id = a2.user_id
  24. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
  25. AND a1.gender = 'SB10002' AND a2.class_id = t1.id
  26. ) AS female_count,
  27. (
  28. SELECT COUNT(distinct(a1.id)) FROM xjr_user a1
  29. INNER JOIN base_student_school_roll a2 ON a1.id = a2.user_id
  30. INNER JOIN student_report_record a3 ON a1.id = a3.user_id
  31. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0 and a3.delete_mark = 0
  32. AND a2.class_id = t1.id AND a3.base_semester_id = #{dto.baseSemesterId} AND a3.report_time IS NOT NULL
  33. <if test="dto.studentReportPlanId != null">
  34. and a3.student_report_plan_id = #{dto.studentReportPlanId}
  35. </if>
  36. ) AS arrived_count
  37. FROM base_class t1
  38. INNER JOIN xjr_user t2 ON t1.teacher_id = t2.id
  39. WHERE t1.delete_mark = 0 and t1.grade_id = #{dto.gradeId}
  40. AND t1.teacher_id = #{dto.teacherId}
  41. </select>
  42. <select id="getMobilePage" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto"
  43. resultType="com.xjrsoft.module.student.vo.StudentReportRecordPageVo">
  44. SELECT t1.id as user_id,t1.name,t1.credential_number,t1.mobile,t4.name AS stduy_status_cn,t5.telephone AS parent_mobile,t2.graduated_university,
  45. (select count(*) from student_report_record where user_id = t1.id and base_semester_id = #{dto.baseSemesterId} and delete_mark = 0) as is_report FROM xjr_user t1
  46. INNER JOIN base_student_school_roll t2 ON t1.id = t2.user_id
  47. INNER JOIN base_class t3 ON t2.class_id = t3.id
  48. LEFT JOIN xjr_dictionary_detail t4 ON t2.stduy_status = t4.code
  49. LEFT JOIN base_student_family t5 ON t5.user_id = t1.id
  50. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
  51. AND t3.teacher_id = #{dto.teacherId} and t2.grade_id = #{dto.gradeId}
  52. <if test="dto.keyword != null and dto.keyword != ''">
  53. and t1.name like concat('%', #{dto.keyword},'%')
  54. </if>
  55. <if test="dto.classId != null">
  56. and t3.id = #{dto.classId}
  57. </if>
  58. ORDER BY t1.create_date DESC, t2.create_date DESC,t3.create_date DESC,t1.id
  59. </select>
  60. <select id="getPlanPage" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo">
  61. SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
  62. t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
  63. t9.name AS stduy_status_cn,t10.name AS archives_status_cn,
  64. t1.report_time,IF(t1.report_time IS NULL, 0, 1) as is_report FROM student_report_record t1
  65. INNER JOIN base_student_school_roll t2 ON t1.user_id = t2.user_id
  66. INNER JOIN xjr_user t3 ON t3.id = t1.user_id
  67. LEFT JOIN base_grade t4 ON t2.grade_id = t4.id
  68. LEFT JOIN base_class t5 ON t2.class_id = t5.id
  69. LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
  70. LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code
  71. LEFT JOIN xjr_dictionary_detail t8 ON t2.student_type = t8.code
  72. LEFT JOIN xjr_dictionary_detail t9 ON t2.stduy_status = t9.code
  73. LEFT JOIN xjr_dictionary_detail t10 ON t2.archives_status = t10.code
  74. WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
  75. and t1.student_report_plan_id = #{dto.studentReportPlanId}
  76. <if test="dto.keyword != null and dto.keyword != ''">
  77. and t1.name like concat('%', #{dto.keyword},'%')
  78. </if>
  79. <if test="dto.classId != null">
  80. and t5.id = #{dto.classId}
  81. </if>
  82. <if test="dto.gradeId != null">
  83. and t4.id = #{dto.gradeId}
  84. </if>
  85. <if test="dto.name != null and dto.name != ''">
  86. and t3.name like concat('%', #{dto.name}, '%')
  87. </if>
  88. <if test="dto.className != null and dto.className != ''">
  89. and t5.name like concat('%', #{dto.className}, '%')
  90. </if>
  91. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  92. and t3.credentialNumber like concat('%', #{dto.credentialNumber}, '%')
  93. </if>
  94. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">
  95. and t2.archives_status = #{dto.archivesStatus}
  96. </if>
  97. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
  98. and t2.stduy_status = #{dto.stduyStatus}
  99. </if>
  100. <if test="dto.studentType != null and dto.studentType != ''">
  101. and t2.student_type = #{dto.studentType}
  102. </if>
  103. <if test="dto.studentType != null and dto.studentType != ''">
  104. and t2.student_type = #{dto.studentType}
  105. </if>
  106. <if test="dto.isReport != null">
  107. <if test="dto.isReport == 1">
  108. and t1.report_time is not null
  109. </if>
  110. <if test="dto.isReport == 0">
  111. and t1.report_time is null
  112. </if>
  113. </if>
  114. <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
  115. and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
  116. </if>
  117. ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC
  118. </select>
  119. <select id="getPlanPageList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo">
  120. SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
  121. t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
  122. t9.name AS stduy_status_cn,t10.name AS archives_status_cn,
  123. t1.report_time,IF(t1.report_time IS NULL, 0, 1) as is_report FROM student_report_record t1
  124. INNER JOIN base_student_school_roll t2 ON t1.user_id = t2.user_id
  125. INNER JOIN xjr_user t3 ON t3.id = t1.user_id
  126. LEFT JOIN base_grade t4 ON t2.grade_id = t4.id
  127. LEFT JOIN base_class t5 ON t2.class_id = t5.id
  128. LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
  129. LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code
  130. LEFT JOIN xjr_dictionary_detail t8 ON t2.student_type = t8.code
  131. LEFT JOIN xjr_dictionary_detail t9 ON t2.stduy_status = t9.code
  132. LEFT JOIN xjr_dictionary_detail t10 ON t2.archives_status = t10.code
  133. WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
  134. and t1.student_report_plan_id = #{dto.studentReportPlanId}
  135. <if test="dto.keyword != null and dto.keyword != ''">
  136. and t1.name like concat('%', #{dto.keyword},'%')
  137. </if>
  138. <if test="dto.classId != null">
  139. and t5.id = #{dto.classId}
  140. </if>
  141. <if test="dto.gradeId != null">
  142. and t4.id = #{dto.gradeId}
  143. </if>
  144. <if test="dto.name != null and dto.name != ''">
  145. and t3.name like concat('%', #{dto.name}, '%')
  146. </if>
  147. <if test="dto.className != null and dto.className != ''">
  148. and t5.name like concat('%', #{dto.className}, '%')
  149. </if>
  150. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  151. and t3.credentialNumber like concat('%', #{dto.credentialNumber}, '%')
  152. </if>
  153. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">
  154. and t2.archives_status = #{dto.archivesStatus}
  155. </if>
  156. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
  157. and t2.stduy_status = #{dto.stduyStatus}
  158. </if>
  159. <if test="dto.studentType != null and dto.studentType != ''">
  160. and t2.student_type = #{dto.studentType}
  161. </if>
  162. <if test="dto.studentType != null and dto.studentType != ''">
  163. and t2.student_type = #{dto.studentType}
  164. </if>
  165. <if test="dto.isReport != null">
  166. <if test="dto.isReport == 1">
  167. and t1.report_time is not null
  168. </if>
  169. <if test="dto.isReport == 0">
  170. and t1.report_time is null
  171. </if>
  172. </if>
  173. <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
  174. and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
  175. </if>
  176. ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC
  177. </select>
  178. <select id="getStatisticsDataList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto"
  179. resultType="com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo">
  180. SELECT t1.name,t1.credential_number,t2.gender,t4.graduated_university,t4.stduy_status,t5.report_time ,
  181. t6.name AS class_name,t8.name as class_type,t7.name AS major_name FROM base_new_student t1
  182. INNER JOIN xjr_user t2 ON t1.credential_number = t2.credential_number
  183. INNER JOIN enrollment_plan t3 ON t3.id = t1.enrollment_plan_id
  184. INNER JOIN base_student_school_roll t4 ON t4.user_id = t2.id
  185. LEFT JOIN student_report_record t5 ON t2.id = t5.user_id AND t5.delete_mark = 0
  186. INNER JOIN base_class t6 ON t6.id = t4.class_id
  187. INNER JOIN base_major_set t7 ON t7.id = t6.major_set_id
  188. left join xjr_dictionary_detail t8 on t6.class_type = t8.code and t8.item_id = 2023000000000000039
  189. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
  190. AND t3.grade_id = #{dto.gradeId} AND t3.enroll_type = #{dto.enrollType}
  191. AND (t1.delete_reason IS NULL OR t1.delete_reason = '')
  192. AND t2.delete_mark = 0
  193. </select>
  194. </mapper>