StudentReportRecordMapper.xml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  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.StudentTryReadingReportPageDto" 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,t3.gender,t13.name as major_name,t14.name as class_type,
  224. t1.report_time,IF(t1.report_time IS NULL, 0, 1) AS is_report,
  225. t3.family_mobile AS parent_mobile,t15.name as dept_name
  226. FROM student_report_record t1
  227. INNER JOIN base_new_student t3 ON t3.id = t1.user_id
  228. LEFT JOIN banding_task_class_student t2 ON t1.user_id = t2.new_student_id and t2.delete_mark = 0
  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 and t7.delete_mark = 0
  232. LEFT JOIN xjr_dictionary_detail t8 ON t3.source = t8.code and t8.delete_mark = 0
  233. LEFT JOIN xjr_dictionary_detail t9 ON t3.stduy_status = t9.code and t9.delete_mark = 0
  234. LEFT JOIN banding_task t10 ON t5.banding_task_id = t10.id
  235. LEFT JOIN enrollment_plan t11 ON t11.id = t3.enrollment_plan_id
  236. LEFT JOIN base_grade t4 ON t11.grade_id = t4.id
  237. LEFT JOIN student_report_plan t12 ON t12.id = t1.student_report_plan_id
  238. LEFT JOIN base_major_set t13 ON t13.id = t5.major_set_id
  239. LEFT JOIN xjr_dictionary_detail t14 ON t5.class_type = t14.code and t14.delete_mark = 0
  240. LEFT JOIN xjr_department t15 ON t15.id = t13.department_id
  241. WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
  242. and t12.status = 1
  243. and t3.enrollment_plan_id = #{dto.enrollmentPlanId}
  244. <if test="dto.keyword != null and dto.keyword != ''">
  245. and t1.name like concat('%', #{dto.keyword},'%')
  246. </if>
  247. <if test="dto.classId != null">
  248. <if test="dto.classId != 0">
  249. and t5.id = #{dto.classId}
  250. </if>
  251. <if test="dto.classId == 0">
  252. and t5.id is null
  253. </if>
  254. </if>
  255. <if test="dto.teacherId != null">
  256. and (t5.teacher_id = #{dto.teacherId} or t5.id is null)
  257. </if>
  258. <if test="dto.gradeId != null">
  259. and t4.id = #{dto.gradeId}
  260. </if>
  261. <if test="dto.name != null and dto.name != ''">
  262. and t3.name like concat('%', #{dto.name}, '%')
  263. </if>
  264. <if test="dto.className != null and dto.className != ''">
  265. and t5.name like concat('%', #{dto.className}, '%')
  266. </if>
  267. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  268. and t3.credential_number like concat('%', #{dto.credentialNumber}, '%')
  269. </if>
  270. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">
  271. and t3.archives_status = #{dto.archivesStatus}
  272. </if>
  273. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
  274. and t3.stduy_status = #{dto.stduyStatus}
  275. </if>
  276. <if test="dto.studentType != null and dto.studentType != ''">
  277. and t3.source = #{dto.studentType}
  278. </if>
  279. <if test="dto.isReport != null">
  280. <if test="dto.isReport == 1">
  281. and t1.report_time is not null
  282. </if>
  283. <if test="dto.isReport == 0">
  284. and t1.report_time is null
  285. </if>
  286. </if>
  287. <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
  288. and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
  289. </if>
  290. ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC,t5.name is null desc,t5.name
  291. </select>
  292. <select id="getTryReadingList" parameterType="com.xjrsoft.module.student.dto.StudentTryReadingReportPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo">
  293. SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
  294. t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
  295. t9.name AS stduy_status_cn,t3.gender,t13.name as major_name,t14.name as class_type,
  296. t1.report_time,IF(t1.report_time IS NULL, 0, 1) AS is_report,
  297. t3.family_mobile AS parent_mobile,t15.name as dept_name
  298. FROM student_report_record t1
  299. INNER JOIN base_new_student t3 ON t3.id = t1.user_id
  300. LEFT JOIN banding_task_class_student t2 ON t1.user_id = t2.new_student_id and t2.delete_mark = 0
  301. LEFT JOIN banding_task_class t5 ON t2.banding_task_class_id = t5.id
  302. LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
  303. LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code and t7.delete_mark = 0
  304. LEFT JOIN xjr_dictionary_detail t8 ON t3.source = t8.code and t8.delete_mark = 0
  305. LEFT JOIN xjr_dictionary_detail t9 ON t3.stduy_status = t9.code and t9.delete_mark = 0
  306. LEFT JOIN banding_task t10 ON t5.banding_task_id = t10.id
  307. LEFT JOIN enrollment_plan t11 ON t11.id = t3.enrollment_plan_id
  308. LEFT JOIN base_grade t4 ON t11.grade_id = t4.id
  309. LEFT JOIN student_report_plan t12 ON t12.id = t1.student_report_plan_id
  310. LEFT JOIN base_major_set t13 ON t13.id = t5.major_set_id
  311. LEFT JOIN xjr_dictionary_detail t14 ON t5.class_type = t14.code and t14.delete_mark = 0
  312. LEFT JOIN xjr_department t15 ON t15.id = t13.department_id
  313. WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
  314. and t12.status = 1
  315. and t3.enrollment_plan_id = #{dto.enrollmentPlanId}
  316. <if test="dto.keyword != null and dto.keyword != ''">
  317. and t1.name like concat('%', #{dto.keyword},'%')
  318. </if>
  319. <if test="dto.classId != null">
  320. <if test="dto.classId != 0">
  321. and t5.id = #{dto.classId}
  322. </if>
  323. <if test="dto.classId == 0">
  324. and t5.id is null
  325. </if>
  326. </if>
  327. <if test="dto.teacherId != null">
  328. and (t5.teacher_id = #{dto.teacherId} or t5.id is null)
  329. </if>
  330. <if test="dto.gradeId != null">
  331. and t4.id = #{dto.gradeId}
  332. </if>
  333. <if test="dto.name != null and dto.name != ''">
  334. and t3.name like concat('%', #{dto.name}, '%')
  335. </if>
  336. <if test="dto.className != null and dto.className != ''">
  337. and t5.name like concat('%', #{dto.className}, '%')
  338. </if>
  339. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  340. and t3.credential_number like concat('%', #{dto.credentialNumber}, '%')
  341. </if>
  342. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">
  343. and t3.archives_status = #{dto.archivesStatus}
  344. </if>
  345. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
  346. and t3.stduy_status = #{dto.stduyStatus}
  347. </if>
  348. <if test="dto.studentType != null and dto.studentType != ''">
  349. and t3.source = #{dto.studentType}
  350. </if>
  351. <if test="dto.isReport != null">
  352. <if test="dto.isReport == 1">
  353. and t1.report_time is not null
  354. </if>
  355. <if test="dto.isReport == 0">
  356. and t1.report_time is null
  357. </if>
  358. </if>
  359. <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
  360. and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
  361. </if>
  362. ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC,t5.name is null desc,t5.name
  363. </select>
  364. </mapper>