BandingTaskClassStudentMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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.banding.mapper.BandingTaskClassStudentMapper">
  6. <select id="satisfyStudent" parameterType="com.xjrsoft.module.banding.dto.StudentDto" 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,t6.name as source,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,t1.remarks FROM base_new_student t1
  10. INNER JOIN banding_task_class_student t5 ON t1.id = t5.new_student_id
  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 t6 ON t1.source = t6.code AND t6.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. WHERE t1.delete_mark = 0 AND t5.delete_mark = 0 and t1.is_can_banding = 1
  18. AND t5.banding_task_class_id = #{dto.bandingTaskClassId}
  19. <if test="dto.name != null and dto.name != ''">
  20. and t1.name like concat('%', #{dto.name},'%')
  21. </if>
  22. <if test="dto.gender != null and dto.gender != ''">
  23. and t1.gender = #{dto.gender}
  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.order != null">
  29. <if test="dto.order == 'ascend'">
  30. <if test="dto.field != null and dto.field == 'height'">
  31. order by t1.height asc
  32. </if>
  33. <if test="dto.field != null and dto.field == 'weight'">
  34. order by t1.weight asc
  35. </if>
  36. <if test="dto.field != null and dto.field != '' and dto.field == 'score'">
  37. order by t1.score asc
  38. </if>
  39. </if>
  40. <if test="dto.order == 'descend'">
  41. <if test="dto.field != null and dto.field == 'height'">
  42. order by t1.height desc
  43. </if>
  44. <if test="dto.field != null and dto.field == 'weight'">
  45. order by t1.weight desc
  46. </if>
  47. <if test="dto.field != null and dto.field != '' and dto.field == 'score'">
  48. order by t1.score desc
  49. </if>
  50. </if>
  51. </if>
  52. </select>
  53. <select id="satisfyStudentSure" parameterType="com.xjrsoft.module.banding.dto.StudentDto" resultType="com.xjrsoft.module.student.vo.BaseNewStudentPageVo">
  54. SELECT t1.id,t1.graduate_school,t1.name,t1.gender,t2.name AS gender_cn,t1.credential_number,t1.height,t1.weight,
  55. t1.score,t1.graduate_class,t6.name as source,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t7.name as first_ambition,
  56. t8.name as second_ambition,t1.is_adjust,t1.status,t1.remarks FROM base_new_student t1
  57. INNER JOIN banding_task_class_student_sure t5 ON t1.id = t5.new_student_id
  58. LEFT JOIN xjr_dictionary_detail t2 ON t1.gender = t2.code AND t2.item_id = 2023000000000000004
  59. LEFT JOIN xjr_dictionary_detail t3 ON t1.stduy_status = t3.code AND t3.item_id = 2023000000000000030
  60. LEFT JOIN xjr_dictionary_detail t6 ON t1.source = t6.code AND t6.item_id = 2023000000000000028
  61. LEFT JOIN enrollment_plan t4 ON t1.enrollment_plan_id = t4.id
  62. LEFT JOIN base_major_set t7 ON t1.first_ambition = t7.id
  63. LEFT JOIN base_major_set t8 ON t1.second_ambition = t8.id
  64. WHERE t1.delete_mark = 0 AND t5.delete_mark = 0 and t1.is_can_banding = 1
  65. AND t5.banding_task_class_id = #{dto.bandingTaskClassId}
  66. <if test="dto.name != null and dto.name != ''">
  67. and t1.name like concat('%', #{dto.name},'%')
  68. </if>
  69. <if test="dto.gender != null and dto.gender != ''">
  70. and t1.gender = #{dto.gender}
  71. </if>
  72. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  73. and t1.credential_number like concat('%', #{dto.credentialNumber},'%')
  74. </if>
  75. <if test="dto.order != null">
  76. <if test="dto.order == 'ascend'">
  77. <if test="dto.field != null and dto.field == 'height'">
  78. order by t1.height asc
  79. </if>
  80. <if test="dto.field != null and dto.field == 'weight'">
  81. order by t1.weight asc
  82. </if>
  83. <if test="dto.field != null and dto.field != '' and dto.field == 'score'">
  84. order by t1.score asc
  85. </if>
  86. </if>
  87. <if test="dto.order == 'descend'">
  88. <if test="dto.field != null and dto.field == 'height'">
  89. order by t1.height desc
  90. </if>
  91. <if test="dto.field != null and dto.field == 'weight'">
  92. order by t1.weight desc
  93. </if>
  94. <if test="dto.field != null and dto.field != '' and dto.field == 'score'">
  95. order by t1.score desc
  96. </if>
  97. </if>
  98. </if>
  99. </select>
  100. <select id="surplusStudent" parameterType="com.xjrsoft.module.banding.dto.StudentDto" resultType="com.xjrsoft.module.student.vo.BaseNewStudentPageVo">
  101. SELECT t1.id,t1.graduate_school,t1.name,t1.gender,t2.name AS gender_cn,t1.credential_number,t1.height,t1.weight,
  102. t1.score,t1.graduate_class,t6.name as source,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t7.name as first_ambition,
  103. t8.name as second_ambition,t1.is_adjust,t1.status,t1.remarks FROM base_new_student t1
  104. LEFT JOIN xjr_dictionary_detail t2 ON t1.gender = t2.code AND t2.item_id = 2023000000000000004
  105. LEFT JOIN xjr_dictionary_detail t3 ON t1.stduy_status = t3.code AND t3.item_id = 2023000000000000030
  106. LEFT JOIN enrollment_plan t4 ON t1.enrollment_plan_id = t4.id
  107. LEFT JOIN banding_task t5 ON t4.grade_id = t5.grade_id AND t4.enroll_type = t5.enroll_type
  108. LEFT JOIN xjr_dictionary_detail t6 ON t1.source = t6.code AND t6.item_id = 2023000000000000028
  109. LEFT JOIN base_major_set t7 ON t1.first_ambition = t7.id
  110. LEFT JOIN base_major_set t8 ON t1.second_ambition = t8.id
  111. WHERE t1.delete_mark = 0 AND t5.id = #{dto.bandingTaskId}
  112. and t1.is_can_banding = 1
  113. AND (t1.first_ambition_id = #{dto.majorSetId} or t1.second_ambition_id = #{dto.majorSetId})
  114. and t1.id not in (SELECT new_student_id FROM banding_task_class_student c1
  115. INNER JOIN banding_task_class c2 ON c1.banding_task_class_id = c2.id
  116. WHERE c1.delete_mark = 0 AND c2.delete_mark = 0 AND c2.banding_task_id = #{dto.bandingTaskId}
  117. )
  118. <if test="dto.name != null and dto.name != ''">
  119. and t1.name like concat('%', #{dto.name},'%')
  120. </if>
  121. <if test="dto.gender != null and dto.gender != ''">
  122. and t1.gender = #{dto.gender}
  123. </if>
  124. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  125. and t1.credential_number like concat('%', #{dto.credentialNumber},'%')
  126. </if>
  127. <if test="dto.order != null">
  128. <if test="dto.order == 'ascend'">
  129. <if test="dto.field != null and dto.field == 'height'">
  130. order by t1.height asc
  131. </if>
  132. <if test="dto.field != null and dto.field == 'weight'">
  133. order by t1.weight asc
  134. </if>
  135. <if test="dto.field != null and dto.field != '' and dto.field == 'score'">
  136. order by t1.score asc
  137. </if>
  138. </if>
  139. <if test="dto.order == 'descend'">
  140. <if test="dto.field != null and dto.field == 'height'">
  141. order by t1.height desc
  142. </if>
  143. <if test="dto.field != null and dto.field == 'weight'">
  144. order by t1.weight desc
  145. </if>
  146. <if test="dto.field != null and dto.field != '' and dto.field == 'score'">
  147. order by t1.score desc
  148. </if>
  149. </if>
  150. </if>
  151. </select>
  152. <select id="surplusStudentSure" parameterType="com.xjrsoft.module.banding.dto.StudentDto" resultType="com.xjrsoft.module.student.vo.BaseNewStudentPageVo">
  153. SELECT t1.id,t1.graduate_school,t1.name,t1.gender,t2.name AS gender_cn,t1.credential_number,t1.height,t1.weight,
  154. t1.score,t1.graduate_class,t6.name as source,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t7.name as first_ambition,
  155. t8.name as second_ambition,t1.is_adjust,t1.status,t1.remarks FROM base_new_student t1
  156. LEFT JOIN xjr_dictionary_detail t2 ON t1.gender = t2.code AND t2.item_id = 2023000000000000004
  157. LEFT JOIN xjr_dictionary_detail t3 ON t1.stduy_status = t3.code AND t3.item_id = 2023000000000000030
  158. LEFT JOIN enrollment_plan t4 ON t1.enrollment_plan_id = t4.id
  159. LEFT JOIN banding_task t5 ON t4.grade_id = t5.grade_id AND t4.enroll_type = t5.enroll_type
  160. LEFT JOIN xjr_dictionary_detail t6 ON t1.source = t6.code AND t6.item_id = 2023000000000000028
  161. LEFT JOIN base_major_set t7 ON t1.first_ambition = t7.id
  162. LEFT JOIN base_major_set t8 ON t1.second_ambition = t8.id
  163. WHERE t1.delete_mark = 0 AND t5.id = #{dto.bandingTaskId}
  164. and t1.is_can_banding = 1
  165. AND (t1.first_ambition_id = #{dto.majorSetId} or t1.second_ambition_id = #{dto.majorSetId})
  166. and t1.id not in (SELECT new_student_id FROM banding_task_class_student_sure c1
  167. INNER JOIN banding_task_class c2 ON c1.banding_task_class_id = c2.id
  168. WHERE c1.delete_mark = 0 AND c2.delete_mark = 0 AND c2.banding_task_id = #{dto.bandingTaskId}
  169. )
  170. <if test="dto.name != null and dto.name != ''">
  171. and t1.name like concat('%', #{dto.name},'%')
  172. </if>
  173. <if test="dto.gender != null and dto.gender != ''">
  174. and t1.gender = #{dto.gender}
  175. </if>
  176. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  177. and t1.credential_number like concat('%', #{dto.credentialNumber},'%')
  178. </if>
  179. <if test="dto.order != null">
  180. <if test="dto.order == 'ascend'">
  181. <if test="dto.field != null and dto.field == 'height'">
  182. order by t1.height asc
  183. </if>
  184. <if test="dto.field != null and dto.field == 'weight'">
  185. order by t1.weight asc
  186. </if>
  187. <if test="dto.field != null and dto.field != '' and dto.field == 'score'">
  188. order by t1.score asc
  189. </if>
  190. </if>
  191. <if test="dto.order == 'descend'">
  192. <if test="dto.field != null and dto.field == 'height'">
  193. order by t1.height desc
  194. </if>
  195. <if test="dto.field != null and dto.field == 'weight'">
  196. order by t1.weight desc
  197. </if>
  198. <if test="dto.field != null and dto.field != '' and dto.field == 'score'">
  199. order by t1.score desc
  200. </if>
  201. </if>
  202. </if>
  203. </select>
  204. <select id="getSyncStudentDataList" resultType="com.xjrsoft.module.banding.vo.SyncStudentDataListVo">
  205. SELECT t2.id AS new_student_id,t4.class_id,t6.banding_task_class_id,t4.stduy_status FROM student_report_record t1
  206. INNER JOIN base_new_student t2 ON t1.user_id = t2.id
  207. INNER JOIN xjr_user t3 ON t2.credential_number = t3.credential_number AND t3.delete_mark = 0
  208. INNER JOIN base_student_school_roll t4 ON t3.id = t4.user_id AND t4.delete_mark = 0
  209. LEFT JOIN banding_task_class t5 ON t4.class_id = t5.base_class_id
  210. LEFT JOIN banding_task_class_student t6 ON t2.id = t6.new_student_id AND t6.delete_mark = 0
  211. WHERE t1.delete_mark = 0 AND t1.student_report_plan_id = #{studentReportPlanId}
  212. </select>
  213. </mapper>