BaseStudentSchoolRollMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. CONCAT(t16.name, ' ', t15.room_name, ' ', t14.bed_number) AS bed_info
  35. FROM base_student t1
  36. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  37. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  38. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  39. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  40. LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.nation
  41. LEFT JOIN xjr_dictionary_detail t7 ON t7.code = t2.gender
  42. LEFT JOIN xjr_dictionary_detail t8 ON t8.code = t3.stduy_status
  43. LEFT JOIN xjr_dictionary_detail t11 ON t11.code = t3.student_type
  44. LEFT JOIN xjr_dictionary_detail t12 ON t12.code = t3.archives_status
  45. LEFT JOIN xjr_dictionary_detail t13 ON t13.code = t3.roll_modality
  46. LEFT JOIN xjr_dictionary_detail t10 ON t2.gender = t10.code
  47. LEFT JOIN room_bed t14 ON t14.student_user_id = t2.id
  48. LEFT JOIN room t15 ON t14.room_id = t15.id
  49. LEFT JOIN base_office_build t16 ON t15.office_build_id = t16.id
  50. WHERE t2.delete_mark = 0
  51. AND t1.delete_mark = 0
  52. AND t3.archives_status = 'FB2901'
  53. <if test="dto.gradeId != null">
  54. AND t4.grade_id = #{dto.gradeId}
  55. </if>
  56. <if test="dto.majorSetId != null">
  57. AND t3.major_set_id = #{dto.majorSetId}
  58. </if>
  59. <if test="dto.classId != null">
  60. AND t4.id = #{dto.classId}
  61. </if>
  62. <if test="dto.teacherId != null">
  63. AND t4.teacher_id = #{dto.teacherId}
  64. </if>
  65. <if test="dto.keyWord != null and dto.keyWord != ''">
  66. AND (t4.name LIKE concat('%', #{dto.keyWord}, '%')
  67. OR t2.name LIKE concat('%', #{dto.keyWord}, '%')
  68. OR t5.name LIKE concat('%', #{dto.keyWord}, '%')
  69. OR t1.student_id LIKE concat('%', #{dto.keyWord}, '%')
  70. OR t2.mobile LIKE concat('%', #{dto.keyWord}, '%')
  71. )
  72. </if>
  73. </select>
  74. <select id="getInfoById" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoDetailDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo">
  75. SELECT t2.id,
  76. t2.name AS student_name,
  77. t2.mobile AS phone,
  78. t2.gender,
  79. t11.name AS genderCn,
  80. t1.student_id,
  81. t5.name AS teacher_name,
  82. t5.mobile AS teacher_phone,
  83. t4.name AS class_name,
  84. (SELECT mobile
  85. FROM base_student_family_member
  86. WHERE delete_mark = 0
  87. AND user_id = t2.id
  88. AND is_guardian = 1) AS guardian_phone,
  89. t8.name AS archives_status,
  90. t7.name AS stduy_status,
  91. t9.name AS roll_modality,
  92. t2.birth_date,
  93. t2.gender,
  94. t2.avatar,
  95. t6.name AS nation,
  96. t10.name AS major_set_name,
  97. t3.archives_status as archivesStatusCode,
  98. t3.stduy_status as stduyStatusCode,
  99. t3.roll_modality as rollModalityCode,
  100. t3.roll_number AS rollNumber,
  101. t12.name AS student_form,
  102. REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode LIKE '999010604%' AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS jxf,
  103. REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode = 103042766003001 AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS ssf,
  104. REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode LIKE '999010603%' AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS jcf,
  105. CONCAT(t17.name, ' ', t16.room_name, ' ', t15.bed_number) AS bed_info
  106. FROM base_student t1
  107. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  108. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  109. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  110. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  111. LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.nation AND t6.item_id = 2023000000000000008
  112. LEFT JOIN xjr_dictionary_detail t7 ON t7.code = t3.stduy_status AND t7.item_id = 2023000000000000030
  113. LEFT JOIN xjr_dictionary_detail t8 ON t8.code = t3.archives_status AND t8.item_id = 2023000000000000029
  114. LEFT JOIN xjr_dictionary_detail t9 ON t9.code = t3.roll_modality AND t9.item_id = 1762024751192084482
  115. LEFT JOIN base_major_set t10 ON t3.major_set_id = t10.id
  116. LEFT JOIN xjr_dictionary_detail t11 ON t11.code = t2.gender
  117. LEFT JOIN xjr_dictionary_detail t12 ON t12.code = t3.student_type
  118. left join room_bed t15 on t15.student_user_id = t1.user_id
  119. left join room t16 on t16.id = t15.room_id
  120. left join base_office_build t17 on t17.id = t16.office_build_id
  121. WHERE t2.id = #{dto.id}
  122. </select>
  123. <update id="updateInfoByUserId" parameterType="com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto">
  124. UPDATE base_student_school_roll SET delete_mark = delete_mark
  125. <if test="dto.rollModality != null and dto.rollModality != ''">,roll_modality = #{dto.rollModality},learn_status = #{dto.rollModality} </if>
  126. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">,archives_status = #{dto.archivesStatus} </if>
  127. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">,stduy_status = #{dto.stduyStatus} </if>
  128. where user_id = #{id}
  129. </update>
  130. <select id="getGenderCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
  131. SELECT t2.gender as category,COUNT(*) as number FROM base_student t1
  132. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  133. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  134. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  135. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  136. LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
  137. WHERE t2.delete_mark = 0
  138. AND t1.delete_mark = 0
  139. and t3.archives_status = 'FB2901'
  140. <if test="dto.gradeId != null">
  141. and t4.grade_id = #{dto.gradeId}
  142. </if>
  143. <if test="dto.majorSetId != null">
  144. and t3.major_set_id = #{dto.majorSetId}
  145. </if>
  146. <if test="dto.classId != null">
  147. and t4.id = #{dto.classId}
  148. </if>
  149. <if test="dto.teacherId != null">
  150. and t4.teacher_id = #{dto.teacherId}
  151. </if>
  152. <if test="dto.keyWord != null and dto.keyWord != ''">
  153. and (t4.name like concat('%', #{dto.keyWord}, '%')
  154. or t2.name like concat('%', #{dto.keyWord}, '%')
  155. or t5.name like concat('%', #{dto.keyWord}, '%')
  156. or t1.student_id like concat('%', #{dto.keyWord}, '%')
  157. or t2.mobile like concat('%', #{dto.keyWord}, '%')
  158. or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
  159. )
  160. </if>
  161. group by t2.gender
  162. </select>
  163. <select id="getStudyStatusCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
  164. SELECT t3.stduy_status as category,COUNT(*) as number,t2.gender FROM base_student t1
  165. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  166. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  167. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  168. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  169. LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
  170. WHERE t2.delete_mark = 0
  171. AND t1.delete_mark = 0
  172. and t3.archives_status = 'FB2901'
  173. <if test="dto.gradeId != null">
  174. and t4.grade_id = #{dto.gradeId}
  175. </if>
  176. <if test="dto.majorSetId != null">
  177. and t3.major_set_id = #{dto.majorSetId}
  178. </if>
  179. <if test="dto.classId != null">
  180. and t4.id = #{dto.classId}
  181. </if>
  182. <if test="dto.teacherId != null">
  183. and t4.teacher_id = #{dto.teacherId}
  184. </if>
  185. <if test="dto.keyWord != null and dto.keyWord != ''">
  186. and (t4.name like concat('%', #{dto.keyWord}, '%')
  187. or t2.name like concat('%', #{dto.keyWord}, '%')
  188. or t5.name like concat('%', #{dto.keyWord}, '%')
  189. or t1.student_id like concat('%', #{dto.keyWord}, '%')
  190. or t2.mobile like concat('%', #{dto.keyWord}, '%')
  191. or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
  192. )
  193. </if>
  194. group by t3.stduy_status,t2.gender
  195. </select>
  196. <select id="getClassNameByUserId" resultType="java.lang.String">
  197. SELECT t1.name FROM base_class t1
  198. INNER JOIN base_student_school_roll t2 ON t1.id = t2.class_id
  199. WHERE t2.user_id = #{userId}
  200. </select>
  201. <select id="getClassIdByUserId" resultType="java.lang.Long">
  202. SELECT t1.id FROM base_class t1
  203. INNER JOIN base_student_school_roll t2 ON t1.id = t2.class_id
  204. WHERE t2.user_id = #{userId}
  205. </select>
  206. <select id="getStudyingList" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoPageVo">
  207. SELECT
  208. t2.id,
  209. t2.name AS student_name,
  210. t1.student_id,
  211. t2.mobile AS phone,
  212. t5.mobile AS teacher_phone,
  213. t5.name AS teacher_name,
  214. t4.name AS class_name,
  215. (SELECT mobile
  216. FROM base_student_family_member
  217. WHERE delete_mark = 0
  218. AND user_id = t2.id
  219. AND is_guardian = 1) AS guardian_phone,
  220. t7.name AS gender_cn,
  221. t8.name AS stduyStatus,
  222. t2.gender,
  223. t10.name AS genderCn,
  224. t2.birth_date,
  225. t6.name AS nation,
  226. t3.archives_status AS archivesStatusCode,
  227. t3.stduy_status AS stduyStatusCode,
  228. t3.roll_modality AS rollModalityCode,
  229. t12.name AS archives_status,
  230. t8.name AS stduy_status,
  231. t13.name AS roll_modality,
  232. t11.name AS student_form,
  233. CONCAT(t16.name, ' ', t15.room_name, ' ', t14.bed_number) AS bed_info
  234. FROM base_student t1
  235. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  236. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  237. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  238. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  239. LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.nation
  240. LEFT JOIN xjr_dictionary_detail t7 ON t7.code = t2.gender
  241. LEFT JOIN xjr_dictionary_detail t8 ON t8.code = t3.stduy_status
  242. LEFT JOIN xjr_dictionary_detail t11 ON t11.code = t3.student_type
  243. LEFT JOIN xjr_dictionary_detail t12 ON t12.code = t3.archives_status
  244. LEFT JOIN xjr_dictionary_detail t13 ON t13.code = t3.roll_modality
  245. LEFT JOIN xjr_dictionary_detail t10 ON t2.gender = t10.code
  246. LEFT JOIN room_bed t14 ON t14.student_user_id = t2.id
  247. LEFT JOIN room t15 ON t14.room_id = t15.id
  248. LEFT JOIN base_office_build t16 ON t15.office_build_id = t16.id
  249. WHERE t2.delete_mark = 0
  250. AND t1.delete_mark = 0
  251. AND t3.archives_status = 'FB2901'
  252. </select>
  253. </mapper>