BaseStudentSchoolRollMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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. </select>
  77. <select id="getInfoById" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoDetailDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo">
  78. SELECT t2.id,
  79. t2.name AS student_name,
  80. t2.mobile AS phone,
  81. t2.credential_number,
  82. t2.gender,
  83. t11.name AS genderCn,
  84. t1.student_id,
  85. t5.name AS teacher_name,
  86. t5.mobile AS teacher_phone,
  87. t4.name AS class_name,
  88. (SELECT mobile
  89. FROM base_student_family_member
  90. WHERE delete_mark = 0
  91. AND user_id = t2.id
  92. AND is_guardian = 1) AS guardian_phone,
  93. t8.name AS archives_status,
  94. t7.name AS stduy_status,
  95. t9.name AS roll_modality,
  96. t2.birth_date,
  97. t2.gender,
  98. t2.avatar,
  99. t6.name AS nation,
  100. t10.name AS major_set_name,
  101. t3.archives_status as archivesStatusCode,
  102. t3.stduy_status as stduyStatusCode,
  103. t3.roll_modality as rollModalityCode,
  104. t3.roll_number AS rollNumber,
  105. t12.name AS student_form,t3.archives_number,
  106. REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode LIKE '999010604%' AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS jxf,
  107. REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode = 103042766003001 AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS ssf,
  108. REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode LIKE '999010603%' AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS jcf,
  109. CONCAT(t17.name, ' ', t16.room_name, ' ', t15.bed_number) AS bed_info,
  110. t18.name as internship_state_cn,t3.internship_state
  111. FROM base_student t1
  112. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  113. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  114. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  115. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  116. LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.nation AND t6.item_id = 2023000000000000008
  117. LEFT JOIN xjr_dictionary_detail t7 ON t7.code = t3.stduy_status AND t7.item_id = 2023000000000000030
  118. LEFT JOIN xjr_dictionary_detail t8 ON t8.code = t3.archives_status AND t8.item_id = 2023000000000000029
  119. LEFT JOIN xjr_dictionary_detail t9 ON t9.code = t3.roll_modality AND t9.item_id = 1762024751192084482
  120. LEFT JOIN base_major_set t10 ON t3.major_set_id = t10.id
  121. LEFT JOIN xjr_dictionary_detail t11 ON t11.code = t2.gender
  122. LEFT JOIN xjr_dictionary_detail t12 ON t12.code = t3.student_type
  123. left join room_bed t15 on t15.student_user_id = t1.user_id
  124. left join room t16 on t16.id = t15.room_id
  125. left join base_office_build t17 on t17.id = t16.office_build_id
  126. LEFT JOIN xjr_dictionary_detail t18 ON t3.internship_state = t18.code
  127. WHERE t2.id = #{dto.id}
  128. </select>
  129. <update id="updateInfoByUserId" parameterType="com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto">
  130. UPDATE base_student_school_roll SET delete_mark = delete_mark
  131. <if test="dto.rollModality != null and dto.rollModality != ''">,roll_modality = #{dto.rollModality},learn_status = #{dto.rollModality} </if>
  132. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">,archives_status = #{dto.archivesStatus} </if>
  133. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">,stduy_status = #{dto.stduyStatus} </if>
  134. <if test="dto.internshipState != null and dto.internshipState != ''">,internship_state = #{dto.internshipState} </if>
  135. where user_id = #{id}
  136. </update>
  137. <select id="getGenderCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
  138. SELECT t2.gender as category,COUNT(*) as number FROM base_student t1
  139. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  140. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  141. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  142. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  143. LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
  144. WHERE t2.delete_mark = 0
  145. AND t1.delete_mark = 0 and t1.is_normal = 1
  146. and t3.archives_status = 'FB2901'
  147. <if test="dto.gradeId != null">
  148. and t4.grade_id = #{dto.gradeId}
  149. </if>
  150. <if test="dto.majorSetId != null">
  151. and t3.major_set_id = #{dto.majorSetId}
  152. </if>
  153. <if test="dto.classId != null">
  154. and t4.id = #{dto.classId}
  155. </if>
  156. <if test="dto.teacherId != null">
  157. and t4.teacher_id = #{dto.teacherId}
  158. </if>
  159. <if test="dto.keyWord != null and dto.keyWord != ''">
  160. and (t4.name like concat('%', #{dto.keyWord}, '%')
  161. or t2.name like concat('%', #{dto.keyWord}, '%')
  162. or t5.name like concat('%', #{dto.keyWord}, '%')
  163. or t1.student_id like concat('%', #{dto.keyWord}, '%')
  164. or t2.mobile like concat('%', #{dto.keyWord}, '%')
  165. or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
  166. )
  167. </if>
  168. group by t2.gender
  169. </select>
  170. <select id="getStudyStatusCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
  171. SELECT t3.stduy_status as category,COUNT(*) as number,t2.gender FROM base_student t1
  172. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  173. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  174. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  175. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  176. LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
  177. WHERE t2.delete_mark = 0
  178. AND t1.delete_mark = 0 and t1.is_normal = 1
  179. and t3.archives_status = 'FB2901'
  180. <if test="dto.gradeId != null">
  181. and t4.grade_id = #{dto.gradeId}
  182. </if>
  183. <if test="dto.majorSetId != null">
  184. and t3.major_set_id = #{dto.majorSetId}
  185. </if>
  186. <if test="dto.classId != null">
  187. and t4.id = #{dto.classId}
  188. </if>
  189. <if test="dto.teacherId != null">
  190. and t4.teacher_id = #{dto.teacherId}
  191. </if>
  192. <if test="dto.keyWord != null and dto.keyWord != ''">
  193. and (t4.name like concat('%', #{dto.keyWord}, '%')
  194. or t2.name like concat('%', #{dto.keyWord}, '%')
  195. or t5.name like concat('%', #{dto.keyWord}, '%')
  196. or t1.student_id like concat('%', #{dto.keyWord}, '%')
  197. or t2.mobile like concat('%', #{dto.keyWord}, '%')
  198. or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
  199. )
  200. </if>
  201. group by t3.stduy_status,t2.gender
  202. </select>
  203. <select id="getInternshipStateCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
  204. SELECT t3.internship_state as category,COUNT(*) as number FROM base_student t1
  205. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  206. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  207. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  208. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  209. LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
  210. WHERE t2.delete_mark = 0
  211. AND t1.delete_mark = 0 and t1.is_normal = 1
  212. and t3.archives_status = 'FB2901'
  213. <if test="dto.gradeId != null">
  214. and t4.grade_id = #{dto.gradeId}
  215. </if>
  216. <if test="dto.majorSetId != null">
  217. and t3.major_set_id = #{dto.majorSetId}
  218. </if>
  219. <if test="dto.classId != null">
  220. and t4.id = #{dto.classId}
  221. </if>
  222. <if test="dto.teacherId != null">
  223. and t4.teacher_id = #{dto.teacherId}
  224. </if>
  225. <if test="dto.keyWord != null and dto.keyWord != ''">
  226. and (t4.name like concat('%', #{dto.keyWord}, '%')
  227. or t2.name like concat('%', #{dto.keyWord}, '%')
  228. or t5.name like concat('%', #{dto.keyWord}, '%')
  229. or t1.student_id like concat('%', #{dto.keyWord}, '%')
  230. or t2.mobile like concat('%', #{dto.keyWord}, '%')
  231. or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
  232. )
  233. </if>
  234. group by t3.internship_state
  235. </select>
  236. <select id="getClassNameByUserId" resultType="java.lang.String">
  237. SELECT t1.name FROM base_class t1
  238. INNER JOIN base_student_school_roll t2 ON t1.id = t2.class_id
  239. WHERE t2.user_id = #{userId}
  240. </select>
  241. <select id="getClassIdByUserId" resultType="java.lang.Long">
  242. SELECT t1.id FROM base_class t1
  243. INNER JOIN base_student_school_roll t2 ON t1.id = t2.class_id
  244. WHERE t2.user_id = #{userId}
  245. </select>
  246. <select id="getStudyingList" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoPageVo">
  247. SELECT
  248. t2.id,
  249. t2.name AS student_name,
  250. t1.student_id,
  251. t2.mobile AS phone,
  252. t5.mobile AS teacher_phone,
  253. t5.name AS teacher_name,
  254. t4.name AS class_name,
  255. (SELECT mobile
  256. FROM base_student_family_member
  257. WHERE delete_mark = 0
  258. AND user_id = t2.id
  259. AND is_guardian = 1) AS guardian_phone,
  260. t7.name AS gender_cn,
  261. t8.name AS stduyStatus,
  262. t2.gender,
  263. t10.name AS genderCn,
  264. t2.birth_date,
  265. t6.name AS nation,
  266. t3.archives_status AS archivesStatusCode,
  267. t3.stduy_status AS stduyStatusCode,
  268. t3.roll_modality AS rollModalityCode,
  269. t12.name AS archives_status,
  270. t8.name AS stduy_status,
  271. t13.name AS roll_modality,
  272. t11.name AS student_form,
  273. CONCAT(t16.name, ' ', t15.room_name, ' ', t14.bed_number) AS bed_info
  274. FROM base_student t1
  275. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  276. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  277. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  278. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  279. LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.nation
  280. LEFT JOIN xjr_dictionary_detail t7 ON t7.code = t2.gender
  281. LEFT JOIN xjr_dictionary_detail t8 ON t8.code = t3.stduy_status
  282. LEFT JOIN xjr_dictionary_detail t11 ON t11.code = t3.student_type
  283. LEFT JOIN xjr_dictionary_detail t12 ON t12.code = t3.archives_status
  284. LEFT JOIN xjr_dictionary_detail t13 ON t13.code = t3.roll_modality
  285. LEFT JOIN xjr_dictionary_detail t10 ON t2.gender = t10.code
  286. LEFT JOIN room_bed t14 ON t14.student_user_id = t2.id
  287. LEFT JOIN room t15 ON t14.room_id = t15.id
  288. LEFT JOIN base_office_build t16 ON t15.office_build_id = t16.id
  289. WHERE t2.delete_mark = 0
  290. AND t1.delete_mark = 0
  291. AND t3.archives_status = 'FB2901'
  292. </select>
  293. </mapper>