BaseStudentSchoolRollMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. t12.name AS archives_status,
  30. t8.name AS stduy_status,
  31. t13.name AS roll_modality,
  32. t11.name AS student_form,
  33. CONCAT(t16.name, ' ', t15.room_name, ' ', t14.bed_number) AS bed_info
  34. FROM base_student t1
  35. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  36. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  37. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  38. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  39. LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.nation
  40. LEFT JOIN xjr_dictionary_detail t7 ON t7.code = t2.gender
  41. LEFT JOIN xjr_dictionary_detail t8 ON t8.code = t3.stduy_status
  42. LEFT JOIN xjr_dictionary_detail t11 ON t11.code = t3.student_type
  43. LEFT JOIN xjr_dictionary_detail t12 ON t12.code = t3.archives_status
  44. LEFT JOIN xjr_dictionary_detail t13 ON t13.code = t3.roll_modality
  45. LEFT JOIN xjr_dictionary_detail t10 ON t2.gender = t10.code
  46. LEFT JOIN room_bed t14 ON t14.student_user_id = t2.id
  47. LEFT JOIN room t15 ON t14.room_id = t15.id
  48. LEFT JOIN base_office_build t16 ON t15.office_build_id = t16.id
  49. WHERE t2.delete_mark = 0
  50. AND t1.delete_mark = 0
  51. AND t3.archives_status = 'FB2901'
  52. <if test="dto.gradeId != null">
  53. AND t4.grade_id = #{dto.gradeId}
  54. </if>
  55. <if test="dto.majorSetId != null">
  56. AND t3.major_set_id = #{dto.majorSetId}
  57. </if>
  58. <if test="dto.classId != null">
  59. AND t4.id = #{dto.classId}
  60. </if>
  61. <if test="dto.teacherId != null">
  62. AND t4.teacher_id = #{dto.teacherId}
  63. </if>
  64. <if test="dto.keyWord != null and dto.keyWord != ''">
  65. AND (t4.name LIKE concat('%', #{dto.keyWord}, '%')
  66. OR t2.name LIKE concat('%', #{dto.keyWord}, '%')
  67. OR t5.name LIKE concat('%', #{dto.keyWord}, '%')
  68. OR t1.student_id LIKE concat('%', #{dto.keyWord}, '%')
  69. OR t2.mobile LIKE concat('%', #{dto.keyWord}, '%')
  70. )
  71. </if>
  72. </select>
  73. <select id="getInfoById" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoDetailDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo">
  74. SELECT t2.id,
  75. t2.name AS student_name,
  76. t2.mobile AS phone,
  77. t2.gender,
  78. t11.name AS genderCn,
  79. t1.student_id,
  80. t5.name AS teacher_name,
  81. t5.mobile AS teacher_phone,
  82. t4.name AS class_name,
  83. (SELECT mobile
  84. FROM base_student_family_member
  85. WHERE delete_mark = 0
  86. AND user_id = t2.id
  87. AND is_guardian = 1) AS guardian_phone,
  88. t8.name AS archives_status,
  89. t7.name AS stduy_status,
  90. t9.name AS roll_modality,
  91. t2.birth_date,
  92. t2.gender,
  93. t2.avatar,
  94. t6.name AS nation,
  95. t10.name AS major_set_name,
  96. t3.archives_status as archivesStatusCode,
  97. t3.stduy_status as stduyStatusCode,
  98. t3.roll_modality as rollModalityCode,
  99. t12.name AS student_form,
  100. REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode LIKE '999010604%' AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS jxf,
  101. REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode = 103042766003001 AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS ssf,
  102. REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode LIKE '999010603%' AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS jcf,
  103. CONCAT(t17.name, ' ', t16.room_name, ' ', t15.bed_number) AS bed_info
  104. FROM base_student t1
  105. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  106. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  107. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  108. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  109. LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.nation AND t6.item_id = 2023000000000000008
  110. LEFT JOIN xjr_dictionary_detail t7 ON t7.code = t3.stduy_status AND t7.item_id = 2023000000000000030
  111. LEFT JOIN xjr_dictionary_detail t8 ON t8.code = t3.archives_status AND t8.item_id = 2023000000000000029
  112. LEFT JOIN xjr_dictionary_detail t9 ON t9.code = t3.roll_modality AND t9.item_id = 1762024751192084482
  113. LEFT JOIN base_major_set t10 ON t3.major_set_id = t10.id
  114. LEFT JOIN xjr_dictionary_detail t11 ON t11.code = t2.gender
  115. LEFT JOIN xjr_dictionary_detail t12 ON t12.code = t3.student_type
  116. left join room_bed t15 on t15.student_user_id = t1.user_id
  117. left join room t16 on t16.id = t15.room_id
  118. left join base_office_build t17 on t17.id = t16.office_build_id
  119. WHERE t2.id = #{dto.id}
  120. </select>
  121. <update id="updateInfoByUserId" parameterType="com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto">
  122. UPDATE base_student_school_roll SET delete_mark = delete_mark
  123. <if test="dto.rollModality != null and dto.rollModality != ''">,roll_modality = #{dto.rollModality},learn_status = #{dto.rollModality} </if>
  124. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">,archives_status = #{dto.archivesStatus} </if>
  125. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">,stduy_status = #{dto.stduyStatus} </if>
  126. where user_id = #{id}
  127. </update>
  128. <select id="getGenderCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
  129. SELECT t2.gender as category,COUNT(*) as number FROM base_student t1
  130. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  131. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  132. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  133. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  134. LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
  135. WHERE t2.delete_mark = 0
  136. AND t1.delete_mark = 0
  137. and t3.archives_status = 'FB2901'
  138. <if test="dto.gradeId != null">
  139. and t4.grade_id = #{dto.gradeId}
  140. </if>
  141. <if test="dto.majorSetId != null">
  142. and t3.major_set_id = #{dto.majorSetId}
  143. </if>
  144. <if test="dto.classId != null">
  145. and t4.id = #{dto.classId}
  146. </if>
  147. <if test="dto.teacherId != null">
  148. and t4.teacher_id = #{dto.teacherId}
  149. </if>
  150. <if test="dto.keyWord != null and dto.keyWord != ''">
  151. and (t4.name like concat('%', #{dto.keyWord}, '%')
  152. or t2.name like concat('%', #{dto.keyWord}, '%')
  153. or t5.name like concat('%', #{dto.keyWord}, '%')
  154. or t1.student_id like concat('%', #{dto.keyWord}, '%')
  155. or t2.mobile like concat('%', #{dto.keyWord}, '%')
  156. or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
  157. )
  158. </if>
  159. group by t2.gender
  160. </select>
  161. <select id="getStudyStatusCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
  162. SELECT t3.stduy_status as category,COUNT(*) as number,t2.gender 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
  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 t3.stduy_status,t2.gender
  193. </select>
  194. </mapper>