BaseStudentSchoolRollMapper.xml 14 KB

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