StudentReportRecordMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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 AND a2.archives_status = 'FB2901'
  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. AND a2.archives_status = 'FB2901'
  21. ) AS male_count,
  22. (
  23. SELECT COUNT(*) FROM xjr_user a1
  24. INNER JOIN base_student_school_roll a2 ON a1.id = a2.user_id
  25. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
  26. AND a1.gender = 'SB10002' AND a2.class_id = t1.id
  27. AND a2.archives_status = 'FB2901'
  28. ) AS female_count,
  29. (
  30. SELECT COUNT(distinct(a1.id)) FROM xjr_user a1
  31. INNER JOIN base_student_school_roll a2 ON a1.id = a2.user_id
  32. INNER JOIN student_report_record a3 ON a1.id = a3.user_id
  33. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0 and a3.delete_mark = 0
  34. AND a2.class_id = t1.id AND a3.base_semester_id = #{dto.baseSemesterId} AND a3.report_time IS NOT NULL
  35. <if test="dto.studentReportPlanId != null">
  36. and a3.student_report_plan_id = #{dto.studentReportPlanId}
  37. </if>
  38. ) AS arrived_count
  39. FROM base_class t1
  40. INNER JOIN xjr_user t2 ON t1.teacher_id = t2.id
  41. WHERE t1.delete_mark = 0
  42. <if test="dto.teacherId != null">
  43. AND t1.teacher_id = #{dto.teacherId}
  44. </if>
  45. <if test="dto.gradeId != null">
  46. and t1.grade_id = #{dto.gradeId}
  47. </if>
  48. <if test="dto.classId != null">
  49. AND t1.id = #{dto.classId}
  50. </if>
  51. </select>
  52. <select id="getMobilePage" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto"
  53. resultType="com.xjrsoft.module.student.vo.StudentReportRecordPageVo">
  54. 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,
  55. (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
  56. INNER JOIN base_student_school_roll t2 ON t1.id = t2.user_id
  57. INNER JOIN base_class t3 ON t2.class_id = t3.id
  58. LEFT JOIN xjr_dictionary_detail t4 ON t2.stduy_status = t4.code
  59. LEFT JOIN base_student_family t5 ON t5.user_id = t1.id
  60. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
  61. AND t3.teacher_id = #{dto.teacherId} and t2.grade_id = #{dto.gradeId}
  62. <if test="dto.keyword != null and dto.keyword != ''">
  63. and t1.name like concat('%', #{dto.keyword},'%')
  64. </if>
  65. <if test="dto.classId != null">
  66. and t3.id = #{dto.classId}
  67. </if>
  68. ORDER BY t1.create_date DESC, t2.create_date DESC,t3.create_date DESC,t1.id
  69. </select>
  70. <select id="getPlanPage" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo">
  71. SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
  72. t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
  73. t9.name AS stduy_status_cn,t10.name AS archives_status_cn,
  74. t1.report_time,IF(t1.report_time IS NULL, 0, 1) as is_report,
  75. (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
  76. FROM student_report_record t1
  77. INNER JOIN base_student_school_roll t2 ON t1.user_id = t2.user_id
  78. INNER JOIN xjr_user t3 ON t3.id = t1.user_id
  79. LEFT JOIN base_grade t4 ON t2.grade_id = t4.id
  80. LEFT JOIN base_class t5 ON t2.class_id = t5.id
  81. LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
  82. LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code
  83. LEFT JOIN xjr_dictionary_detail t8 ON t2.student_type = t8.code
  84. LEFT JOIN xjr_dictionary_detail t9 ON t2.stduy_status = t9.code
  85. LEFT JOIN xjr_dictionary_detail t10 ON t2.archives_status = t10.code
  86. WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
  87. and t1.student_report_plan_id = #{dto.studentReportPlanId}
  88. <if test="dto.keyword != null and dto.keyword != ''">
  89. and t1.name like concat('%', #{dto.keyword},'%')
  90. </if>
  91. <if test="dto.classId != null">
  92. and t5.id = #{dto.classId}
  93. </if>
  94. <if test="dto.gradeId != null">
  95. and t4.id = #{dto.gradeId}
  96. </if>
  97. <if test="dto.name != null and dto.name != ''">
  98. and t3.name like concat('%', #{dto.name}, '%')
  99. </if>
  100. <if test="dto.className != null and dto.className != ''">
  101. and t5.name like concat('%', #{dto.className}, '%')
  102. </if>
  103. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  104. and t3.credential_number like concat('%', #{dto.credentialNumber}, '%')
  105. </if>
  106. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">
  107. and t2.archives_status = #{dto.archivesStatus}
  108. </if>
  109. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
  110. and t2.stduy_status = #{dto.stduyStatus}
  111. </if>
  112. <if test="dto.studentType != null and dto.studentType != ''">
  113. and t2.student_type = #{dto.studentType}
  114. </if>
  115. <if test="dto.isReport != null">
  116. <if test="dto.isReport == 1">
  117. and t1.report_time is not null
  118. </if>
  119. <if test="dto.isReport == 0">
  120. and t1.report_time is null
  121. </if>
  122. </if>
  123. <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
  124. and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
  125. </if>
  126. ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC,t5.name
  127. </select>
  128. <select id="getPlanPageList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo">
  129. SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
  130. t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
  131. t9.name AS stduy_status_cn,t10.name AS archives_status_cn,
  132. t1.report_time,IF(t1.report_time IS NULL, 0, 1) as is_report,
  133. (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
  134. FROM student_report_record t1
  135. INNER JOIN base_student_school_roll t2 ON t1.user_id = t2.user_id
  136. INNER JOIN xjr_user t3 ON t3.id = t1.user_id
  137. LEFT JOIN base_grade t4 ON t2.grade_id = t4.id
  138. LEFT JOIN base_class t5 ON t2.class_id = t5.id
  139. LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
  140. LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code
  141. LEFT JOIN xjr_dictionary_detail t8 ON t2.student_type = t8.code
  142. LEFT JOIN xjr_dictionary_detail t9 ON t2.stduy_status = t9.code
  143. LEFT JOIN xjr_dictionary_detail t10 ON t2.archives_status = t10.code
  144. WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
  145. and t1.student_report_plan_id = #{dto.studentReportPlanId}
  146. <if test="dto.keyword != null and dto.keyword != ''">
  147. and t1.name like concat('%', #{dto.keyword},'%')
  148. </if>
  149. <if test="dto.classId != null">
  150. and t5.id = #{dto.classId}
  151. </if>
  152. <if test="dto.gradeId != null">
  153. and t4.id = #{dto.gradeId}
  154. </if>
  155. <if test="dto.name != null and dto.name != ''">
  156. and t3.name like concat('%', #{dto.name}, '%')
  157. </if>
  158. <if test="dto.className != null and dto.className != ''">
  159. and t5.name like concat('%', #{dto.className}, '%')
  160. </if>
  161. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  162. and t3.credential_number like concat('%', #{dto.credentialNumber}, '%')
  163. </if>
  164. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">
  165. and t2.archives_status = #{dto.archivesStatus}
  166. </if>
  167. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
  168. and t2.stduy_status = #{dto.stduyStatus}
  169. </if>
  170. <if test="dto.studentType != null and dto.studentType != ''">
  171. and t2.student_type = #{dto.studentType}
  172. </if>
  173. <if test="dto.isReport != null">
  174. <if test="dto.isReport == 1">
  175. and t1.report_time is not null
  176. </if>
  177. <if test="dto.isReport == 0">
  178. and t1.report_time is null
  179. </if>
  180. </if>
  181. <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
  182. and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
  183. </if>
  184. ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC,t5.name
  185. </select>
  186. <select id="getStatisticsDataList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto"
  187. resultType="com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo">
  188. SELECT t1.name,t1.credential_number,t2.gender,t4.graduated_university,t4.stduy_status,t5.report_time ,
  189. t6.name AS class_name,t8.name as class_type,t7.name AS major_name,t9.name as dept_name FROM base_new_student t1
  190. INNER JOIN xjr_user t2 ON t1.credential_number = t2.credential_number
  191. INNER JOIN enrollment_plan t3 ON t3.id = t1.enrollment_plan_id
  192. INNER JOIN base_student_school_roll t4 ON t4.user_id = t2.id
  193. LEFT JOIN student_report_record t5 ON t2.id = t5.user_id AND t5.delete_mark = 0
  194. INNER JOIN base_class t6 ON t6.id = t4.class_id
  195. INNER JOIN base_major_set t7 ON t7.id = t6.major_set_id
  196. left join xjr_dictionary_detail t8 on t6.class_type = t8.code and t8.item_id = 2023000000000000039
  197. INNER JOIN xjr_department t9 ON t9.id = t6.org_id
  198. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
  199. AND t3.grade_id = #{dto.gradeId} AND t3.enroll_type = #{dto.enrollType}
  200. AND (t1.delete_reason IS NULL OR t1.delete_reason = '')
  201. AND t2.delete_mark = 0
  202. </select>
  203. <select id="getStatisticsPlanDataList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto"
  204. resultType="com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo">
  205. SELECT t1.name,t1.credential_number,t1.gender,t4.graduated_university,t4.stduy_status,t5.report_time ,
  206. t6.name AS class_name,t8.name AS class_type,t7.name AS major_name,t9.name AS dept_name FROM xjr_user t1
  207. INNER JOIN base_student_school_roll t4 ON t4.user_id = t1.id
  208. INNER JOIN student_report_record t5 ON t1.id = t5.user_id AND t5.delete_mark = 0
  209. INNER JOIN base_class t6 ON t6.id = t4.class_id
  210. INNER JOIN base_major_set t7 ON t7.id = t6.major_set_id
  211. LEFT JOIN xjr_dictionary_detail t8 ON t6.class_type = t8.code AND t8.item_id = 2023000000000000039
  212. INNER JOIN xjr_department t9 ON t9.id = t6.org_id
  213. inner join student_report_plan t10 on t5.student_report_plan_id = t10.id
  214. WHERE t1.delete_mark = 0 and t10.delete_mark = 0
  215. <if test="dto.gradeId != null">
  216. and t4.grade_id = #{dto.gradeId}
  217. </if>
  218. AND t10.semester_id = #{dto.baseSemesterId}
  219. </select>
  220. <select id="getTryReadingPage" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo">
  221. SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
  222. t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
  223. t9.name AS stduy_status_cn,
  224. t1.report_time,IF(t1.report_time IS NULL, 0, 1) AS is_report,
  225. t3.family_mobile AS parent_mobile
  226. FROM student_report_record t1
  227. INNER JOIN banding_task_class_student t2 ON t1.user_id = t2.new_student_id
  228. INNER JOIN base_new_student t3 ON t3.id = t1.user_id
  229. LEFT JOIN banding_task_class t5 ON t2.banding_task_class_id = t5.id
  230. LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
  231. LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code
  232. LEFT JOIN xjr_dictionary_detail t8 ON t3.source = t8.code
  233. LEFT JOIN xjr_dictionary_detail t9 ON t3.stduy_status = t9.code
  234. LEFT JOIN banding_task t10 ON t5.banding_task_id = t10.id
  235. LEFT JOIN base_grade t4 ON t10.grade_id = t4.id
  236. LEFT JOIN enrollment_plan t11 ON t11.id = t3.enrollment_plan_id
  237. LEFT JOIN student_report_plan t12 ON t12.id = t1.student_report_plan_id
  238. WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
  239. and t12.status = 1 and t2.delete_mark = 0
  240. and t3.enrollment_plan_id = #{dto.enrollmentPlanId}
  241. <if test="dto.keyword != null and dto.keyword != ''">
  242. and t1.name like concat('%', #{dto.keyword},'%')
  243. </if>
  244. <if test="dto.classId != null">
  245. and t5.id = #{dto.classId}
  246. </if>
  247. <if test="dto.gradeId != null">
  248. and t4.id = #{dto.gradeId}
  249. </if>
  250. <if test="dto.name != null and dto.name != ''">
  251. and t3.name like concat('%', #{dto.name}, '%')
  252. </if>
  253. <if test="dto.className != null and dto.className != ''">
  254. and t5.name like concat('%', #{dto.className}, '%')
  255. </if>
  256. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  257. and t3.credential_number like concat('%', #{dto.credentialNumber}, '%')
  258. </if>
  259. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">
  260. and t1.archives_status = #{dto.archivesStatus}
  261. </if>
  262. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
  263. and t1.stduy_status = #{dto.stduyStatus}
  264. </if>
  265. <if test="dto.studentType != null and dto.studentType != ''">
  266. and t1.student_type = #{dto.studentType}
  267. </if>
  268. <if test="dto.isReport != null">
  269. <if test="dto.isReport == 1">
  270. and t1.report_time is not null
  271. </if>
  272. <if test="dto.isReport == 0">
  273. and t1.report_time is null
  274. </if>
  275. </if>
  276. <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
  277. and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
  278. </if>
  279. ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC,t5.name
  280. </select>
  281. <select id="getTryReadingList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo">
  282. SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
  283. t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
  284. t9.name AS stduy_status_cn,
  285. t1.report_time,IF(t1.report_time IS NULL, 0, 1) AS is_report,
  286. t3.family_mobile AS parent_mobile
  287. FROM student_report_record t1
  288. INNER JOIN banding_task_class_student t2 ON t1.user_id = t2.new_student_id
  289. INNER JOIN base_new_student t3 ON t3.id = t1.user_id
  290. LEFT JOIN banding_task_class t5 ON t2.banding_task_class_id = t5.id
  291. LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
  292. LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code
  293. LEFT JOIN xjr_dictionary_detail t8 ON t3.source = t8.code
  294. LEFT JOIN xjr_dictionary_detail t9 ON t3.stduy_status = t9.code
  295. LEFT JOIN banding_task t10 ON t5.banding_task_id = t10.id
  296. LEFT JOIN base_grade t4 ON t10.grade_id = t4.id
  297. LEFT JOIN enrollment_plan t11 ON t11.id = t3.enrollment_plan_id
  298. LEFT JOIN student_report_plan t12 ON t12.id = t1.student_report_plan_id
  299. WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
  300. and t12.status = 1 and t2.delete_mark = 0
  301. and t3.enrollment_plan_id = #{dto.enrollmentPlanId}
  302. <if test="dto.keyword != null and dto.keyword != ''">
  303. and t1.name like concat('%', #{dto.keyword},'%')
  304. </if>
  305. <if test="dto.classId != null">
  306. and t5.id = #{dto.classId}
  307. </if>
  308. <if test="dto.gradeId != null">
  309. and t4.id = #{dto.gradeId}
  310. </if>
  311. <if test="dto.name != null and dto.name != ''">
  312. and t3.name like concat('%', #{dto.name}, '%')
  313. </if>
  314. <if test="dto.className != null and dto.className != ''">
  315. and t5.name like concat('%', #{dto.className}, '%')
  316. </if>
  317. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  318. and t3.credential_number like concat('%', #{dto.credentialNumber}, '%')
  319. </if>
  320. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">
  321. and t3.archives_status = #{dto.archivesStatus}
  322. </if>
  323. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
  324. and t3.stduy_status = #{dto.stduyStatus}
  325. </if>
  326. <if test="dto.studentType != null and dto.studentType != ''">
  327. and t3.student_type = #{dto.studentType}
  328. </if>
  329. <if test="dto.isReport != null">
  330. <if test="dto.isReport == 1">
  331. and t1.report_time is not null
  332. </if>
  333. <if test="dto.isReport == 0">
  334. and t1.report_time is null
  335. </if>
  336. </if>
  337. <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
  338. and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
  339. </if>
  340. ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC,t5.name is null desc,t5.name
  341. </select>
  342. </mapper>