StudentReportRecordMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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,
  65. (SELECT telephone FROM base_student_family WHERE delete_mark = 0 AND user_id = t1.user_id ORDER BY create_date ASC LIMIT 0,1) as parent_mobile
  66. FROM student_report_record t1
  67. INNER JOIN base_student_school_roll t2 ON t1.user_id = t2.user_id
  68. INNER JOIN xjr_user t3 ON t3.id = t1.user_id
  69. LEFT JOIN base_grade t4 ON t2.grade_id = t4.id
  70. LEFT JOIN base_class t5 ON t2.class_id = t5.id
  71. LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
  72. LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code
  73. LEFT JOIN xjr_dictionary_detail t8 ON t2.student_type = t8.code
  74. LEFT JOIN xjr_dictionary_detail t9 ON t2.stduy_status = t9.code
  75. LEFT JOIN xjr_dictionary_detail t10 ON t2.archives_status = t10.code
  76. WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
  77. and t1.student_report_plan_id = #{dto.studentReportPlanId}
  78. <if test="dto.keyword != null and dto.keyword != ''">
  79. and t1.name like concat('%', #{dto.keyword},'%')
  80. </if>
  81. <if test="dto.classId != null">
  82. and t5.id = #{dto.classId}
  83. </if>
  84. <if test="dto.gradeId != null">
  85. and t4.id = #{dto.gradeId}
  86. </if>
  87. <if test="dto.name != null and dto.name != ''">
  88. and t3.name like concat('%', #{dto.name}, '%')
  89. </if>
  90. <if test="dto.className != null and dto.className != ''">
  91. and t5.name like concat('%', #{dto.className}, '%')
  92. </if>
  93. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  94. and t3.credentialNumber like concat('%', #{dto.credentialNumber}, '%')
  95. </if>
  96. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">
  97. and t2.archives_status = #{dto.archivesStatus}
  98. </if>
  99. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
  100. and t2.stduy_status = #{dto.stduyStatus}
  101. </if>
  102. <if test="dto.studentType != null and dto.studentType != ''">
  103. and t2.student_type = #{dto.studentType}
  104. </if>
  105. <if test="dto.studentType != null and dto.studentType != ''">
  106. and t2.student_type = #{dto.studentType}
  107. </if>
  108. <if test="dto.isReport != null">
  109. <if test="dto.isReport == 1">
  110. and t1.report_time is not null
  111. </if>
  112. <if test="dto.isReport == 0">
  113. and t1.report_time is null
  114. </if>
  115. </if>
  116. <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
  117. and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
  118. </if>
  119. ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC
  120. </select>
  121. <select id="getPlanPageList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo">
  122. SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
  123. t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
  124. t9.name AS stduy_status_cn,t10.name AS archives_status_cn,
  125. t1.report_time,IF(t1.report_time IS NULL, 0, 1) as is_report,
  126. (SELECT mobile FROM base_student_family_member WHERE delete_mark = 0 AND user_id = t1.user_id ORDER BY create_date ASC LIMIT 0,1) as parent_mobile
  127. FROM student_report_record t1
  128. INNER JOIN base_student_school_roll t2 ON t1.user_id = t2.user_id
  129. INNER JOIN xjr_user t3 ON t3.id = t1.user_id
  130. LEFT JOIN base_grade t4 ON t2.grade_id = t4.id
  131. LEFT JOIN base_class t5 ON t2.class_id = t5.id
  132. LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
  133. LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code
  134. LEFT JOIN xjr_dictionary_detail t8 ON t2.student_type = t8.code
  135. LEFT JOIN xjr_dictionary_detail t9 ON t2.stduy_status = t9.code
  136. LEFT JOIN xjr_dictionary_detail t10 ON t2.archives_status = t10.code
  137. WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
  138. and t1.student_report_plan_id = #{dto.studentReportPlanId}
  139. <if test="dto.keyword != null and dto.keyword != ''">
  140. and t1.name like concat('%', #{dto.keyword},'%')
  141. </if>
  142. <if test="dto.classId != null">
  143. and t5.id = #{dto.classId}
  144. </if>
  145. <if test="dto.gradeId != null">
  146. and t4.id = #{dto.gradeId}
  147. </if>
  148. <if test="dto.name != null and dto.name != ''">
  149. and t3.name like concat('%', #{dto.name}, '%')
  150. </if>
  151. <if test="dto.className != null and dto.className != ''">
  152. and t5.name like concat('%', #{dto.className}, '%')
  153. </if>
  154. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  155. and t3.credentialNumber like concat('%', #{dto.credentialNumber}, '%')
  156. </if>
  157. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">
  158. and t2.archives_status = #{dto.archivesStatus}
  159. </if>
  160. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
  161. and t2.stduy_status = #{dto.stduyStatus}
  162. </if>
  163. <if test="dto.studentType != null and dto.studentType != ''">
  164. and t2.student_type = #{dto.studentType}
  165. </if>
  166. <if test="dto.studentType != null and dto.studentType != ''">
  167. and t2.student_type = #{dto.studentType}
  168. </if>
  169. <if test="dto.isReport != null">
  170. <if test="dto.isReport == 1">
  171. and t1.report_time is not null
  172. </if>
  173. <if test="dto.isReport == 0">
  174. and t1.report_time is null
  175. </if>
  176. </if>
  177. <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
  178. and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
  179. </if>
  180. ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC
  181. </select>
  182. <select id="getStatisticsDataList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto"
  183. resultType="com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo">
  184. SELECT t1.name,t1.credential_number,t2.gender,t4.graduated_university,t4.stduy_status,t5.report_time ,
  185. t6.name AS class_name,t8.name as class_type,t7.name AS major_name FROM base_new_student t1
  186. INNER JOIN xjr_user t2 ON t1.credential_number = t2.credential_number
  187. INNER JOIN enrollment_plan t3 ON t3.id = t1.enrollment_plan_id
  188. INNER JOIN base_student_school_roll t4 ON t4.user_id = t2.id
  189. LEFT JOIN student_report_record t5 ON t2.id = t5.user_id AND t5.delete_mark = 0
  190. INNER JOIN base_class t6 ON t6.id = t4.class_id
  191. INNER JOIN base_major_set t7 ON t7.id = t6.major_set_id
  192. left join xjr_dictionary_detail t8 on t6.class_type = t8.code and t8.item_id = 2023000000000000039
  193. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
  194. AND t3.grade_id = #{dto.gradeId} AND t3.enroll_type = #{dto.enrollType}
  195. AND (t1.delete_reason IS NULL OR t1.delete_reason = '')
  196. AND t2.delete_mark = 0
  197. </select>
  198. </mapper>