BaseStudentSchoolRollMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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.BaseStudentSchoolRollMapper">
  6. <select id="getMobilePage" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoPageVo">
  7. SELECT
  8. t2.id,
  9. t2.name AS student_name,
  10. t1.student_id,
  11. t2.mobile AS phone,
  12. t5.mobile AS teacher_phone,
  13. t5.name AS teacher_name,
  14. t4.name AS class_name,
  15. (SELECT mobile
  16. FROM base_student_family_member
  17. WHERE delete_mark = 0
  18. AND user_id = t2.id
  19. AND is_guardian = 1) AS guardian_phone,
  20. t7.name AS gender_cn,
  21. t8.name AS stduyStatus,
  22. t2.gender,
  23. t10.name AS genderCn,
  24. t2.birth_date,
  25. t6.name AS nation,
  26. t3.archives_status AS archivesStatusCode,
  27. t3.stduy_status AS stduyStatusCode,
  28. t3.roll_modality AS rollModalityCode,
  29. t3.roll_number AS rollNumber,
  30. t12.name AS archives_status,
  31. t8.name AS stduy_status,
  32. t13.name AS roll_modality,
  33. t11.name AS student_form,
  34. t2.credential_number,
  35. t17.name as internship_state_cn,
  36. CONCAT(t16.name, ' ', t15.room_name, ' ', t14.bed_number) AS bed_info
  37. FROM base_student t1
  38. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  39. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  40. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  41. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  42. LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.nation
  43. LEFT JOIN xjr_dictionary_detail t7 ON t7.code = t2.gender
  44. LEFT JOIN xjr_dictionary_detail t8 ON t8.code = t3.stduy_status
  45. LEFT JOIN xjr_dictionary_detail t11 ON t11.code = t3.student_type
  46. LEFT JOIN xjr_dictionary_detail t12 ON t12.code = t3.archives_status
  47. LEFT JOIN xjr_dictionary_detail t13 ON t13.code = t3.roll_modality
  48. LEFT JOIN xjr_dictionary_detail t10 ON t2.gender = t10.code
  49. LEFT JOIN room_bed t14 ON t14.student_user_id = t2.id
  50. LEFT JOIN room t15 ON t14.room_id = t15.id
  51. LEFT JOIN base_office_build t16 ON t15.office_build_id = t16.id
  52. LEFT JOIN xjr_dictionary_detail t17 ON t3.internship_state = t17.code
  53. WHERE t2.delete_mark = 0
  54. AND t1.delete_mark = 0 and t1.is_normal = 1
  55. AND t3.archives_status = 'FB2901'
  56. <if test="dto.gradeId != null">
  57. AND t4.grade_id = #{dto.gradeId}
  58. </if>
  59. <if test="dto.majorSetId != null">
  60. AND t3.major_set_id = #{dto.majorSetId}
  61. </if>
  62. <if test="dto.classId != null">
  63. AND t4.id = #{dto.classId}
  64. </if>
  65. <if test="dto.teacherId != null">
  66. AND t4.teacher_id = #{dto.teacherId}
  67. </if>
  68. <if test="dto.keyWord != null and dto.keyWord != ''">
  69. AND (t4.name LIKE concat('%', #{dto.keyWord}, '%')
  70. OR t2.name LIKE concat('%', #{dto.keyWord}, '%')
  71. OR t5.name LIKE concat('%', #{dto.keyWord}, '%')
  72. OR t1.student_id LIKE concat('%', #{dto.keyWord}, '%')
  73. OR t2.mobile LIKE concat('%', #{dto.keyWord}, '%')
  74. )
  75. </if>
  76. <if test="dto.name != null and dto.name != ''">
  77. AND t2.name LIKE concat('%', #{dto.name}, '%')
  78. </if>
  79. <if test="dto.mobile != null and dto.mobile != ''">
  80. AND t2.mobile LIKE concat('%', #{dto.mobile}, '%')
  81. </if>
  82. <if test="dto.className != null and dto.className != ''">
  83. AND t4.name LIKE concat('%', #{dto.className}, '%')
  84. </if>
  85. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  86. AND t2.credential_number LIKE concat('%', #{dto.credentialNumber}, '%')
  87. </if>
  88. <if test="dto.notInIds != null and dto.notInIds.size() > 0">
  89. and t2.id in
  90. <foreach item="notInId" index="index" collection="dto.notInIds" open="(" close=")" separator=",">
  91. #{notInId}
  92. </foreach>
  93. </if>
  94. <if test="dto.inIds != null and dto.inIds.size() > 0">
  95. and t2.id in
  96. <foreach item="inId" index="index" collection="dto.inIds" open="(" close=")" separator=",">
  97. #{inId}
  98. </foreach>
  99. </if>
  100. </select>
  101. <select id="getInfoById" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoDetailDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo">
  102. SELECT t2.id,
  103. t2.name AS student_name,
  104. t2.mobile AS phone,
  105. t2.credential_number,
  106. t2.gender,
  107. t11.name AS genderCn,
  108. t1.student_id,
  109. t5.name AS teacher_name,
  110. t5.mobile AS teacher_phone,
  111. t4.name AS class_name,
  112. (SELECT mobile
  113. FROM base_student_family_member
  114. WHERE delete_mark = 0
  115. AND user_id = t2.id
  116. AND is_guardian = 1) AS guardian_phone,
  117. t8.name AS archives_status,
  118. t7.name AS stduy_status,
  119. t9.name AS roll_modality,
  120. t2.birth_date,
  121. t2.gender,
  122. t2.avatar,
  123. t6.name AS nation,
  124. t10.name AS major_set_name,
  125. t3.archives_status as archivesStatusCode,
  126. t3.stduy_status as stduyStatusCode,
  127. t3.roll_modality as rollModalityCode,
  128. t3.roll_number AS rollNumber,
  129. t12.name AS student_form,t3.archives_number,
  130. REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode LIKE '999010604%' AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS jxf,
  131. REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode = 103042766003001 AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS ssf,
  132. REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode LIKE '999010603%' AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS jcf,
  133. CONCAT(t17.name, ' ', t16.room_name, ' ', t15.bed_number) AS bed_info,
  134. t18.name as internship_state_cn,t3.internship_state
  135. FROM base_student t1
  136. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  137. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  138. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  139. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  140. LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.nation AND t6.item_id = 2023000000000000008
  141. LEFT JOIN xjr_dictionary_detail t7 ON t7.code = t3.stduy_status AND t7.item_id = 2023000000000000030
  142. LEFT JOIN xjr_dictionary_detail t8 ON t8.code = t3.archives_status AND t8.item_id = 2023000000000000029
  143. LEFT JOIN xjr_dictionary_detail t9 ON t9.code = t3.roll_modality AND t9.item_id = 1762024751192084482
  144. LEFT JOIN base_major_set t10 ON t3.major_set_id = t10.id
  145. LEFT JOIN xjr_dictionary_detail t11 ON t11.code = t2.gender
  146. LEFT JOIN xjr_dictionary_detail t12 ON t12.code = t3.student_type
  147. left join room_bed t15 on t15.student_user_id = t1.user_id
  148. left join room t16 on t16.id = t15.room_id
  149. left join base_office_build t17 on t17.id = t16.office_build_id
  150. LEFT JOIN xjr_dictionary_detail t18 ON t3.internship_state = t18.code
  151. WHERE t2.id = #{dto.id}
  152. </select>
  153. <update id="updateInfoByUserId" parameterType="com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto">
  154. UPDATE base_student_school_roll SET delete_mark = delete_mark
  155. <if test="dto.rollModality != null and dto.rollModality != ''">,roll_modality = #{dto.rollModality},learn_status = #{dto.rollModality} </if>
  156. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">,archives_status = #{dto.archivesStatus} </if>
  157. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">,stduy_status = #{dto.stduyStatus} </if>
  158. <if test="dto.internshipState != null and dto.internshipState != ''">,internship_state = #{dto.internshipState} </if>
  159. where user_id = #{id}
  160. </update>
  161. <select id="getGenderCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
  162. SELECT t2.gender as category,COUNT(*) as number FROM base_student t1
  163. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  164. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  165. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  166. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  167. LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
  168. WHERE t2.delete_mark = 0
  169. AND t1.delete_mark = 0 and t1.is_normal = 1
  170. and t3.archives_status = 'FB2901'
  171. <if test="dto.gradeId != null">
  172. and t4.grade_id = #{dto.gradeId}
  173. </if>
  174. <if test="dto.majorSetId != null">
  175. and t3.major_set_id = #{dto.majorSetId}
  176. </if>
  177. <if test="dto.classId != null">
  178. and t4.id = #{dto.classId}
  179. </if>
  180. <if test="dto.teacherId != null">
  181. and t4.teacher_id = #{dto.teacherId}
  182. </if>
  183. <if test="dto.keyWord != null and dto.keyWord != ''">
  184. and (t4.name like concat('%', #{dto.keyWord}, '%')
  185. or t2.name like concat('%', #{dto.keyWord}, '%')
  186. or t5.name like concat('%', #{dto.keyWord}, '%')
  187. or t1.student_id like concat('%', #{dto.keyWord}, '%')
  188. or t2.mobile like concat('%', #{dto.keyWord}, '%')
  189. or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
  190. )
  191. </if>
  192. group by t2.gender
  193. </select>
  194. <select id="getStudyStatusCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
  195. SELECT t3.stduy_status as category,COUNT(*) as number,t2.gender FROM base_student t1
  196. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  197. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  198. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  199. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  200. LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
  201. WHERE t2.delete_mark = 0
  202. AND t1.delete_mark = 0 and t1.is_normal = 1
  203. and t3.archives_status = 'FB2901'
  204. <if test="dto.gradeId != null">
  205. and t4.grade_id = #{dto.gradeId}
  206. </if>
  207. <if test="dto.majorSetId != null">
  208. and t3.major_set_id = #{dto.majorSetId}
  209. </if>
  210. <if test="dto.classId != null">
  211. and t4.id = #{dto.classId}
  212. </if>
  213. <if test="dto.teacherId != null">
  214. and t4.teacher_id = #{dto.teacherId}
  215. </if>
  216. <if test="dto.keyWord != null and dto.keyWord != ''">
  217. and (t4.name like concat('%', #{dto.keyWord}, '%')
  218. or t2.name like concat('%', #{dto.keyWord}, '%')
  219. or t5.name like concat('%', #{dto.keyWord}, '%')
  220. or t1.student_id like concat('%', #{dto.keyWord}, '%')
  221. or t2.mobile like concat('%', #{dto.keyWord}, '%')
  222. or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
  223. )
  224. </if>
  225. group by t3.stduy_status,t2.gender
  226. </select>
  227. <select id="getInternshipStateCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
  228. SELECT t3.internship_state as category,COUNT(*) as number FROM base_student t1
  229. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  230. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  231. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  232. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  233. LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
  234. WHERE t2.delete_mark = 0
  235. AND t1.delete_mark = 0 and t1.is_normal = 1
  236. and t3.archives_status = 'FB2901'
  237. <if test="dto.gradeId != null">
  238. and t4.grade_id = #{dto.gradeId}
  239. </if>
  240. <if test="dto.majorSetId != null">
  241. and t3.major_set_id = #{dto.majorSetId}
  242. </if>
  243. <if test="dto.classId != null">
  244. and t4.id = #{dto.classId}
  245. </if>
  246. <if test="dto.teacherId != null">
  247. and t4.teacher_id = #{dto.teacherId}
  248. </if>
  249. <if test="dto.keyWord != null and dto.keyWord != ''">
  250. and (t4.name like concat('%', #{dto.keyWord}, '%')
  251. or t2.name like concat('%', #{dto.keyWord}, '%')
  252. or t5.name like concat('%', #{dto.keyWord}, '%')
  253. or t1.student_id like concat('%', #{dto.keyWord}, '%')
  254. or t2.mobile like concat('%', #{dto.keyWord}, '%')
  255. or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
  256. )
  257. </if>
  258. group by t3.internship_state
  259. </select>
  260. <select id="getClassNameByUserId" resultType="java.lang.String">
  261. SELECT t1.name FROM base_class t1
  262. INNER JOIN base_student_school_roll t2 ON t1.id = t2.class_id
  263. WHERE t2.user_id = #{userId}
  264. </select>
  265. <select id="getClassIdByUserId" resultType="java.lang.Long">
  266. SELECT t1.id FROM base_class t1
  267. INNER JOIN base_student_school_roll t2 ON t1.id = t2.class_id
  268. WHERE t2.user_id = #{userId}
  269. </select>
  270. <select id="getStudyingList" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoPageVo">
  271. SELECT
  272. t2.id,
  273. t2.name AS student_name,
  274. t1.student_id,
  275. t2.mobile AS phone,
  276. t5.mobile AS teacher_phone,
  277. t5.name AS teacher_name,
  278. t4.name AS class_name,
  279. (SELECT mobile
  280. FROM base_student_family_member
  281. WHERE delete_mark = 0
  282. AND user_id = t2.id
  283. AND is_guardian = 1) AS guardian_phone,
  284. t7.name AS gender_cn,
  285. t8.name AS stduyStatus,
  286. t2.gender,
  287. t10.name AS genderCn,
  288. t2.birth_date,
  289. t6.name AS nation,
  290. t3.archives_status AS archivesStatusCode,
  291. t3.stduy_status AS stduyStatusCode,
  292. t3.roll_modality AS rollModalityCode,
  293. t12.name AS archives_status,
  294. t8.name AS stduy_status,
  295. t13.name AS roll_modality,
  296. t11.name AS student_form,
  297. CONCAT(t16.name, ' ', t15.room_name, ' ', t14.bed_number) AS bed_info
  298. FROM base_student t1
  299. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  300. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  301. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  302. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  303. LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.nation
  304. LEFT JOIN xjr_dictionary_detail t7 ON t7.code = t2.gender
  305. LEFT JOIN xjr_dictionary_detail t8 ON t8.code = t3.stduy_status
  306. LEFT JOIN xjr_dictionary_detail t11 ON t11.code = t3.student_type
  307. LEFT JOIN xjr_dictionary_detail t12 ON t12.code = t3.archives_status
  308. LEFT JOIN xjr_dictionary_detail t13 ON t13.code = t3.roll_modality
  309. LEFT JOIN xjr_dictionary_detail t10 ON t2.gender = t10.code
  310. LEFT JOIN room_bed t14 ON t14.student_user_id = t2.id
  311. LEFT JOIN room t15 ON t14.room_id = t15.id
  312. LEFT JOIN base_office_build t16 ON t15.office_build_id = t16.id
  313. WHERE t2.delete_mark = 0
  314. AND t1.delete_mark = 0
  315. AND t3.archives_status = 'FB2901'
  316. </select>
  317. </mapper>