BaseNewStudentMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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.BaseNewStudentMapper">
  6. <select id="getPage" parameterType="com.xjrsoft.module.student.dto.BaseNewStudentPageDto" resultType="com.xjrsoft.module.student.vo.BaseNewStudentPageVo">
  7. SELECT t1.id,t1.graduate_school,t1.name,t1.gender,t2.name AS gender_cn,t1.credential_number,t1.height,t1.weight,
  8. t1.score,t1.graduate_class,t1.source,t5.name as source_cn,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t7.name as first_ambition,
  9. t8.name as second_ambition,t1.is_adjust,t1.status,ifnull(t11.name,t1.delete_reason) AS class_name,t12.name AS teacher_name,
  10. t1.paymnystate,t1.userdef6,t1.previous,t1.province,t1.city,t1.myarea,t1.remarks,t1.is_can_banding FROM base_new_student t1
  11. LEFT JOIN xjr_dictionary_detail t2 ON t1.gender = t2.code AND t2.item_id = 2023000000000000004
  12. LEFT JOIN xjr_dictionary_detail t3 ON t1.stduy_status = t3.code AND t3.item_id = 2023000000000000030
  13. LEFT JOIN xjr_dictionary_detail t5 ON t1.source = t5.code AND t5.item_id = 2023000000000000028
  14. LEFT JOIN enrollment_plan t4 ON t1.enrollment_plan_id = t4.id
  15. LEFT JOIN base_major_set t7 ON t1.first_ambition = t7.id
  16. LEFT JOIN base_major_set t8 ON t1.second_ambition = t8.id
  17. LEFT JOIN xjr_user t9 ON t1.credential_number = t9.credential_number AND t9.delete_mark = 0
  18. LEFT JOIN base_student_school_roll t10 ON t9.id = t10.user_id AND t10.delete_mark = 0
  19. LEFT JOIN base_class t11 ON t10.class_id = t11.id
  20. LEFT JOIN xjr_user t12 ON t11.teacher_id = t12.id
  21. WHERE t1.delete_mark = 0
  22. <if test="dto.name != null and dto.name != ''">
  23. and t1.name like concat('%', #{dto.name}, '%')
  24. </if>
  25. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  26. and t1.credential_number like concat('%', #{dto.credentialNumber}, '%')
  27. </if>
  28. <if test="dto.graduateSchool != null and dto.graduateSchool != ''">
  29. and t1.graduate_school like concat('%', #{dto.graduateSchool}, '%')
  30. </if>
  31. <if test="dto.isImportScore != null">
  32. <if test="dto.isImportScore == 1">
  33. and t1.score is not null
  34. </if>
  35. <if test="dto.isImportScore == 0">
  36. and t1.score is null
  37. </if>
  38. </if>
  39. <if test="dto.firstAmbition != null and dto.firstAmbition != ''">
  40. and t1.first_ambition = #{dto.firstAmbition}
  41. </if>
  42. <if test="dto.secondAmbition != null and dto.secondAmbition != ''">
  43. and t1.second_ambition = #{dto.secondAmbition}
  44. </if>
  45. <if test="dto.startDate != null and dto.endDate != null">
  46. AND t1.create_date between #{dto.startDate} and #{dto.endDate}
  47. </if>
  48. <if test="dto.gender != null and dto.gender != ''">
  49. AND t1.gender = #{dto.gender}
  50. </if>
  51. <if test="dto.status != null">
  52. AND t1.status = #{dto.status}
  53. </if>
  54. <if test="dto.isAdjust != null">
  55. AND t1.is_adjust = #{dto.isAdjust}
  56. </if>
  57. <if test="dto.enrollmentPlanId != null">
  58. AND t1.enrollment_plan_id = #{dto.enrollmentPlanId}
  59. </if>
  60. <if test="dto.treeId != null and dto.treeType != null">
  61. <if test="dto.treeType == 1">
  62. AND t4.grade_id = #{dto.treeId}
  63. </if>
  64. <if test="dto.treeType == 2">
  65. AND t4.enroll_type = #{dto.treeId}
  66. </if>
  67. </if>
  68. <if test="dto.field != null and dto.field != '' and dto.field == 'score'">
  69. <if test="dto.order == 'descend'">
  70. order by t1.score desc
  71. </if>
  72. <if test="dto.order == 'ascend'">
  73. order by t1.score asc
  74. </if>
  75. </if>
  76. </select>
  77. <select id="getReportPage" parameterType="com.xjrsoft.module.student.dto.BaseNewStudentPageDto" resultType="com.xjrsoft.module.student.vo.BaseNewStudentPageVo">
  78. SELECT t1.id,t1.graduate_school,t1.name,t1.gender,t2.name AS gender_cn,t1.credential_number,t1.height,t1.weight,t1.family_mobile,
  79. t1.score,t1.graduate_class,t1.source,t5.name as source_cn,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t7.name as first_ambition,
  80. t8.name as second_ambition,t1.is_adjust,t1.status,ifnull(t11.name,t1.delete_reason) AS class_name,t12.name AS teacher_name ,t13.report_time,
  81. t9.id as user_id,(select count(*) from student_report_record where user_id = t9.id
  82. and base_semester_id = #{dto.baseSemesterId} and delete_mark = 0) as is_report FROM base_new_student t1
  83. LEFT JOIN xjr_dictionary_detail t2 ON t1.gender = t2.code AND t2.item_id = 2023000000000000004
  84. LEFT JOIN xjr_dictionary_detail t3 ON t1.stduy_status = t3.code AND t3.item_id = 2023000000000000030
  85. LEFT JOIN xjr_dictionary_detail t5 ON t1.source = t5.code AND t5.item_id = 2023000000000000028
  86. LEFT JOIN enrollment_plan t4 ON t1.enrollment_plan_id = t4.id
  87. LEFT JOIN base_major_set t7 ON t1.first_ambition = t7.id
  88. LEFT JOIN base_major_set t8 ON t1.second_ambition = t8.id
  89. LEFT JOIN xjr_user t9 ON t1.credential_number = t9.credential_number AND t9.delete_mark = 0
  90. LEFT JOIN base_student_school_roll t10 ON t9.id = t10.user_id AND t10.delete_mark = 0
  91. LEFT JOIN base_class t11 ON t10.class_id = t11.id
  92. LEFT JOIN xjr_user t12 ON t11.teacher_id = t12.id
  93. LEFT JOIN student_report_record t13 ON t9.id = t13.user_id
  94. and t13.base_semester_id = #{dto.baseSemesterId} and t13.delete_mark = 0
  95. WHERE t1.delete_mark = 0 and (t1.delete_reason is null or t1.delete_reason = '') AND t9.delete_mark = 0
  96. <if test="dto.name != null and dto.name != ''">
  97. and t1.name like concat('%', #{dto.name}, '%')
  98. </if>
  99. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  100. and t1.credential_number like concat('%', #{dto.credentialNumber}, '%')
  101. </if>
  102. <if test="dto.graduateSchool != null and dto.graduateSchool != ''">
  103. and t1.graduate_school like concat('%', #{dto.graduateSchool}, '%')
  104. </if>
  105. <if test="dto.isImportScore != null">
  106. <if test="dto.isImportScore == 1">
  107. and t1.score is not null
  108. </if>
  109. <if test="dto.isImportScore == 0">
  110. and t1.score is null
  111. </if>
  112. </if>
  113. <if test="dto.firstAmbition != null and dto.firstAmbition != ''">
  114. and t1.first_ambition = #{dto.firstAmbition}
  115. </if>
  116. <if test="dto.secondAmbition != null and dto.secondAmbition != ''">
  117. and t1.second_ambition = #{dto.secondAmbition}
  118. </if>
  119. <if test="dto.startDate != null and dto.endDate != null">
  120. AND t13.report_time between #{dto.startDate} and #{dto.endDate}
  121. </if>
  122. <if test="dto.gender != null and dto.gender != ''">
  123. AND t1.gender = #{dto.gender}
  124. </if>
  125. <if test="dto.status != null">
  126. AND t1.status = #{dto.status}
  127. </if>
  128. <if test="dto.isAdjust != null">
  129. AND t1.is_adjust = #{dto.isAdjust}
  130. </if>
  131. <if test="dto.teacherId != null">
  132. AND t11.teacher_id = #{dto.teacherId}
  133. </if>
  134. <if test="dto.classId != null">
  135. AND t11.id = #{dto.classId}
  136. </if>
  137. <if test="dto.isReport != null">
  138. AND (select count(*) from student_report_record where user_id = t9.id and base_semester_id = #{dto.baseSemesterId} and delete_mark = 0) = #{dto.isReport}
  139. </if>
  140. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
  141. AND t10.stduy_status = #{dto.stduyStatus}
  142. </if>
  143. <if test="dto.source != null and dto.source != ''">
  144. AND t1.source = #{dto.source}
  145. </if>
  146. <if test="dto.enrollmentPlanId != null">
  147. AND t1.enrollment_plan_id = #{dto.enrollmentPlanId}
  148. </if>
  149. <if test="dto.treeId != null and dto.treeType != null">
  150. <if test="dto.treeType == 1">
  151. AND t4.grade_id = #{dto.treeId}
  152. </if>
  153. <if test="dto.treeType == 2">
  154. AND t4.enroll_type = #{dto.treeId}
  155. </if>
  156. </if>
  157. <if test="dto.field != null and dto.field != '' and dto.field == 'score'">
  158. <if test="dto.order == 'descend'">
  159. order by t1.score desc
  160. </if>
  161. <if test="dto.order == 'ascend'">
  162. order by t1.score asc
  163. </if>
  164. </if>
  165. </select>
  166. <select id="getReportList" parameterType="com.xjrsoft.module.student.dto.BaseNewStudentPageDto" resultType="com.xjrsoft.module.student.vo.BaseNewStudentPageVo">
  167. SELECT t1.id,t1.graduate_school,t1.name,t1.gender,t2.name AS gender_cn,t1.credential_number,t1.height,t1.weight,t1.family_mobile,
  168. t1.score,t1.graduate_class,t1.source,t5.name as source_cn,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t7.name as first_ambition,
  169. t8.name as second_ambition,t1.is_adjust,t1.status,ifnull(t11.name,t1.delete_reason) AS class_name,t12.name AS teacher_name ,t13.report_time,
  170. t9.id as user_id,(select count(*) from student_report_record where user_id = t9.id and base_semester_id = #{dto.baseSemesterId} and delete_mark = 0) as is_report FROM base_new_student t1
  171. LEFT JOIN xjr_dictionary_detail t2 ON t1.gender = t2.code AND t2.item_id = 2023000000000000004
  172. LEFT JOIN xjr_dictionary_detail t3 ON t1.stduy_status = t3.code AND t3.item_id = 2023000000000000030
  173. LEFT JOIN xjr_dictionary_detail t5 ON t1.source = t5.code AND t5.item_id = 2023000000000000028
  174. LEFT JOIN enrollment_plan t4 ON t1.enrollment_plan_id = t4.id
  175. LEFT JOIN base_major_set t7 ON t1.first_ambition = t7.id
  176. LEFT JOIN base_major_set t8 ON t1.second_ambition = t8.id
  177. LEFT JOIN xjr_user t9 ON t1.credential_number = t9.credential_number AND t9.delete_mark = 0
  178. LEFT JOIN base_student_school_roll t10 ON t9.id = t10.user_id AND t10.delete_mark = 0
  179. LEFT JOIN base_class t11 ON t10.class_id = t11.id
  180. LEFT JOIN xjr_user t12 ON t11.teacher_id = t12.id
  181. LEFT JOIN student_report_record t13 ON t9.id = t13.user_id and t13.base_semester_id = #{dto.baseSemesterId} and t13.delete_mark = 0
  182. WHERE t1.delete_mark = 0 AND t9.delete_mark = 0 and (t1.delete_reason is null or t1.delete_reason = '')
  183. <if test="dto.name != null and dto.name != ''">
  184. and t1.name like concat('%', #{dto.name}, '%')
  185. </if>
  186. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  187. and t1.credential_number like concat('%', #{dto.credentialNumber}, '%')
  188. </if>
  189. <if test="dto.graduateSchool != null and dto.graduateSchool != ''">
  190. and t1.graduate_school like concat('%', #{dto.graduateSchool}, '%')
  191. </if>
  192. <if test="dto.isImportScore != null">
  193. <if test="dto.isImportScore == 1">
  194. and t1.score is not null
  195. </if>
  196. <if test="dto.isImportScore == 0">
  197. and t1.score is null
  198. </if>
  199. </if>
  200. <if test="dto.firstAmbition != null and dto.firstAmbition != ''">
  201. and t1.first_ambition = #{dto.firstAmbition}
  202. </if>
  203. <if test="dto.secondAmbition != null and dto.secondAmbition != ''">
  204. and t1.second_ambition = #{dto.secondAmbition}
  205. </if>
  206. <if test="dto.classId != null">
  207. AND t11.id = #{dto.classId}
  208. </if>
  209. <if test="dto.startDate != null and dto.endDate != null">
  210. AND t13.report_time between #{dto.startDate} and #{dto.endDate}
  211. </if>
  212. <if test="dto.gender != null and dto.gender != ''">
  213. AND t1.gender = #{dto.gender}
  214. </if>
  215. <if test="dto.status != null">
  216. AND t1.status = #{dto.status}
  217. </if>
  218. <if test="dto.isAdjust != null">
  219. AND t1.is_adjust = #{dto.isAdjust}
  220. </if>
  221. <if test="dto.teacherId != null">
  222. AND t11.teacher_id = #{dto.teacherId}
  223. </if>
  224. <if test="dto.classId != null">
  225. AND t11.id = #{dto.classId}
  226. </if>
  227. <if test="dto.isReport != null">
  228. AND (select count(*) from student_report_record where user_id = t9.id and base_semester_id = #{dto.baseSemesterId} and delete_mark = 0) = #{dto.isReport}
  229. </if>
  230. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
  231. AND t10.stduy_status = #{dto.stduyStatus}
  232. </if>
  233. <if test="dto.source != null and dto.source != ''">
  234. AND t1.source = #{dto.source}
  235. </if>
  236. <if test="dto.enrollmentPlanId != null">
  237. AND t1.enrollment_plan_id = #{dto.enrollmentPlanId}
  238. </if>
  239. <if test="dto.treeId != null and dto.treeType != null">
  240. <if test="dto.treeType == 1">
  241. AND t4.grade_id = #{dto.treeId}
  242. </if>
  243. <if test="dto.treeType == 2">
  244. AND t4.enroll_type = #{dto.treeId}
  245. </if>
  246. </if>
  247. <if test="dto.field != null and dto.field != '' and dto.field == 'score'">
  248. <if test="dto.order == 'descend'">
  249. order by t1.score desc
  250. </if>
  251. <if test="dto.order == 'ascend'">
  252. order by t1.score asc
  253. </if>
  254. </if>
  255. </select>
  256. <select id="getEnrollmentPlanList" resultType="com.xjrsoft.module.student.vo.EnrollmentPlanTreeVo">
  257. SELECT t1.enroll_type, t2.name AS enroll_type_cn,t3.name AS grade_name, t3.id as grade_id,t1.id FROM enrollment_plan t1
  258. LEFT JOIN xjr_dictionary_detail t2 ON t1.enroll_type = t2.code AND t2.item_id = 2023000000000000027
  259. LEFT JOIN base_grade t3 ON t1.grade_id = t3.id
  260. WHERE t1.delete_mark = 0
  261. </select>
  262. <select id="getGradeList" resultType="com.xjrsoft.module.student.vo.EnrollmentPlanGradeVo">
  263. SELECT DISTINCT t3.id, t3.name FROM enrollment_plan t1
  264. LEFT JOIN xjr_dictionary_detail t2 ON t1.enroll_type = t2.code AND t2.item_id = 2023000000000000027
  265. LEFT JOIN base_grade t3 ON t1.grade_id = t3.id
  266. WHERE t1.delete_mark = 0
  267. </select>
  268. <select id="getFirstAmbitionStudentCount" resultType="com.xjrsoft.module.outint.vo.IdCountVo">
  269. SELECT t1.first_ambition_id,COUNT(t1.id) FROM base_new_student t1
  270. INNER JOIN enrollment_plan t2 ON t1.enrollment_plan_id = t2.id
  271. WHERE t1.delete_mark = 0 AND t2.grade_id = #{gradeId} AND t2.enroll_type = #{enrollType} and t1.is_can_banding = 1
  272. GROUP BY t1.first_ambition_id
  273. </select>
  274. <select id="getSecondAmbitionStudentCount" resultType="com.xjrsoft.module.outint.vo.IdCountVo">
  275. SELECT t1.second_ambition_id,COUNT(t1.id) FROM base_new_student t1
  276. INNER JOIN enrollment_plan t2 ON t1.enrollment_plan_id = t2.id
  277. WHERE t1.delete_mark = 0 AND t2.grade_id = #{gradeId} AND t2.enroll_type = #{enrollType} and t1.is_can_banding = 1
  278. GROUP BY t1.second_ambition_id
  279. </select>
  280. <select id="getMajorStudentCount" resultType="com.xjrsoft.module.banding.vo.IdManyCountVo">
  281. SELECT t1.id,(
  282. SELECT COUNT(id) FROM base_new_student WHERE delete_mark = 0
  283. AND (first_ambition_id = t1.id OR second_ambition_id = t1.id)
  284. AND score >= IFNULL(t2.score,0) AND height >= IFNULL(t2.height,0)
  285. and is_can_banding = 1
  286. ) AS count,(
  287. SELECT COUNT(id) FROM base_new_student WHERE delete_mark = 0
  288. AND (first_ambition_id = t1.id OR second_ambition_id = t1.id)
  289. AND score >= IFNULL(t2.score,0) AND height >= IFNULL(t2.height,0)
  290. AND gender = 'SB10001' and is_can_banding = 1
  291. ) AS male_count,(
  292. SELECT COUNT(id) FROM base_new_student WHERE delete_mark = 0
  293. AND (first_ambition_id = t1.id OR second_ambition_id = t1.id)
  294. AND score >= IFNULL(t2.score,0) AND height >= IFNULL(t2.height,0)
  295. AND gender = 'SB10002' and is_can_banding = 1
  296. ) AS female_count FROM base_major_set t1
  297. LEFT JOIN banding_task_major_condition t2 ON t1.id = t2.major_set_id AND t2.banding_task_id = #{id}
  298. AND t2.delete_mark = 0
  299. WHERE t1.delete_mark = 0 and t1.enabled_mark = 1
  300. </select>
  301. </mapper>