BaseStudentMapper.xml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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.BaseStudentMapper">
  6. <select id="getStudentInfo" resultType="com.xjrsoft.module.student.vo.StudentInfoVo">
  7. SELECT t1.user_id,t5.id as grade_id,t5.name AS grade_name,t4.id as class_id,t4.name AS class_name,t2.name AS student_name,t1.student_id,t2.gender,t3.enrollment_type,t6.id as major_id,t6.name AS major_name FROM base_student t1
  8. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  9. LEFT JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  10. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  11. LEFT JOIN base_grade t5 ON t3.grade_id = t5.id
  12. LEFT JOIN base_major_set t6 ON t3.major_set_id = t6.id
  13. where t1.delete_mark=0 and t2.delete_mark=0 and t1.user_id=#{userId};
  14. </select>
  15. <!--姓名和性别,测试阶段采用姓名第一个字拼接user_id的方式脱敏-->
  16. <select id="getJianyueStudentList" resultType="com.xjrsoft.module.schedule.vo.StudentJianyuekbVo">
  17. SELECT t1.id AS registerNo, CONCAT(SUBSTRING(t2.name,1,1),t2.id) AS realName,t3.grade_id AS gradeSerialNo,CONCAT(SUBSTRING(t2.name,1,1),t2.id) AS alias,t2.gender,t2.id AS extendId FROM base_student t1
  18. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  19. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  20. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
  21. AND t1.student_id IS NOT NULL AND t1.student_id != ''
  22. AND t3.archives_status = 'FB2901';
  23. </select>
  24. <!--个人财务画像,查询学生个人信息-->
  25. <select id="getPersonalInfo" resultType="com.xjrsoft.module.student.vo.StudentPersonalInfoVo">
  26. SELECT t1.user_id,t2.name,t5.name AS gender_cn,t4.id as class_id, t4.name AS class_name,t2.credential_number,t2.birth_date,t2.mobile,
  27. t6.name AS archives_status_cn,t7.name AS roll_modality_cn,t1.student_id,t8.name AS major_set_name,
  28. t9.name AS stduy_status_cn,t10.name AS teacher_name,t10.mobile AS teacher_phone,t11.bed_number,t12.room_name,
  29. t13.name AS build_name,t14.is_indemnify FROM base_student t1
  30. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  31. INNER JOIN base_student_school_roll t3 ON t2.id = t3.user_id
  32. LEFT JOIN base_class t4 ON t4.id = t3.class_id
  33. LEFT JOIN xjr_dictionary_detail t5 ON t2.gender = t5.code AND t5.item_id = 2023000000000000004
  34. LEFT JOIN xjr_dictionary_detail t6 ON t3.archives_status = t6.code AND t6.item_id = 2023000000000000029
  35. LEFT JOIN xjr_dictionary_detail t7 ON t3.roll_modality = t7.code AND t7.item_id = 1762024751192084482
  36. LEFT JOIN base_major_set t8 ON t3.major_set_id = t8.id
  37. LEFT JOIN xjr_dictionary_detail t9 ON t3.stduy_status = t9.code AND t9.item_id = 2023000000000000030
  38. LEFT JOIN xjr_user t10 ON t4.teacher_id = t10.id
  39. LEFT JOIN room_bed t11 ON t1.user_id = t11.student_user_id
  40. LEFT JOIN room t12 ON t11.room_id = t12.id
  41. LEFT JOIN base_office_build t13 ON t12.office_build_id = t13.id
  42. LEFT JOIN base_student_subsidize t14 ON t1.user_id = t14.user_id
  43. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
  44. AND t2.id = #{id}
  45. </select>
  46. <!--查询系统中所有学生的身份证号-->
  47. <select id="getCredentialNumbers" resultType="java.lang.String">
  48. SELECT t1.credential_number FROM xjr_user t1
  49. INNER JOIN base_student t2 ON t1.id = t2.user_id
  50. </select>
  51. <select id="getStudentPage" parameterType="com.xjrsoft.module.student.dto.BaseStudentUserPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentUserPageVo">
  52. SELECT t1.id,t4.name AS class_name,t5.name AS teacher_name,t1.name,t6.name AS gender_cn,t1.credential_number,t1.user_name,t4.id as class_id,
  53. t1.mobile,t7.name AS archives_status_cn ,t8.name AS stduy_status_cn,t9.name AS student_type_cn,t10.name as learn_status_cn FROM xjr_user t1
  54. INNER JOIN base_student t2 ON t1.id = t2.user_id
  55. LEFT JOIN base_student_school_roll t3 ON t1.id = t3.user_id
  56. LEFT JOIN base_class t4 ON t4.id = t3.class_id
  57. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  58. LEFT JOIN xjr_dictionary_detail t6 ON t1.gender = t6.code AND t6.item_id = 2023000000000000004
  59. LEFT JOIN xjr_dictionary_detail t7 ON t3.archives_status = t7.code AND t7.item_id = 2023000000000000029
  60. LEFT JOIN xjr_dictionary_detail t8 ON t3.stduy_status = t8.code AND t8.item_id = 2023000000000000030
  61. LEFT JOIN xjr_dictionary_detail t9 ON t3.student_type = t9.code AND t9.item_id = 2023000000000000028
  62. LEFT JOIN xjr_dictionary_detail t10 ON t3.learn_status = t10.code AND t10.item_id = 1762024751192084482
  63. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
  64. and t3.archives_status = 'FB2901'
  65. and t2.is_normal = 1
  66. <if test="dto.name != null and dto.name != ''">
  67. and t1.name like concat('%', #{dto.name},'%')
  68. </if>
  69. <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
  70. and t1.credential_number like concat('%', #{dto.credentialNumber},'%')
  71. </if>
  72. <if test="dto.userName != null and dto.userName != ''">
  73. and t1.user_name like concat('%', #{dto.userName},'%')
  74. </if>
  75. <if test="dto.mobile != null and dto.mobile != ''">
  76. and t1.mobile like concat('%', #{dto.mobile},'%')
  77. </if>
  78. <if test="dto.email != null and dto.email != ''">
  79. and t1.email like concat('%', #{dto.email},'%')
  80. </if>
  81. <if test="dto.treeType != null and dto.queryId != null">
  82. <if test="dto.treeType == 1">
  83. and t4.org_id = #{dto.queryId}
  84. </if>
  85. <if test="dto.treeType == 2">
  86. and t3.major_set_id = #{dto.queryId}
  87. </if>
  88. <if test="dto.treeType == 3">
  89. and t4.grade_id = #{dto.queryId} and t3.major_set_id = #{dto.treeId}
  90. </if>
  91. <if test="dto.treeType == 4">
  92. and t4.id = #{dto.queryId}
  93. </if>
  94. </if>
  95. <if test="dto.gradeId != null">
  96. and t4.grade_id = #{dto.gradeId}
  97. </if>
  98. <if test="dto.teacherId != null">
  99. and t4.teacher_id = #{dto.teacherId}
  100. </if>
  101. <if test="dto.classIds != null and dto.classIds.size() > 0">
  102. and t3.class_id in
  103. <foreach item="classId" index="index" collection="dto.classIds" open="(" close=")" separator=",">
  104. #{classId}
  105. </foreach>
  106. </if>
  107. <if test="dto.credentialNumbers != null and dto.credentialNumbers.size() > 0">
  108. and t1.credential_number in
  109. <foreach item="credentialNumber" index="index" collection="dto.credentialNumbers" open="(" close=")" separator=",">
  110. #{credentialNumber}
  111. </foreach>
  112. </if>
  113. <if test="dto.order == null">
  114. order by t1.id
  115. </if>
  116. <if test="dto.order != null">
  117. <if test="dto.order == 'ascend'">
  118. <if test="dto.field != null and dto.field == 'stduyStatusCn'">
  119. order by t8.name
  120. </if>
  121. <if test="dto.field != null and dto.field == 'name'">
  122. order by t1.name asc
  123. </if>
  124. </if>
  125. <if test="dto.order == 'descend'">
  126. <if test="dto.field != null and dto.field == 'stduyStatusCn'">
  127. order by t8.name desc
  128. </if>
  129. <if test="dto.field != null and dto.field == 'name'">
  130. order by t1.name desc
  131. </if>
  132. </if>
  133. </if>
  134. </select>
  135. <select id="getStudentList" parameterType="com.xjrsoft.module.student.dto.BaseStudentUserPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentUserPageVo">
  136. SELECT t1.id,t4.name AS class_name,t5.name AS teacher_name,t1.name,t1.gender AS gender_cn,t1.credential_number,
  137. t1.mobile,t3.archives_status AS archives_status_cn ,t3.stduy_status AS stduy_status_cn,t3.student_type AS student_type_cn,
  138. t3.learn_status as learn_status_cn,t3.grade_id,t6.name as grade_name,t3.class_id,t1.open_id,t2.student_id,t7.name as major_set_name, t3.major_set_id FROM xjr_user t1
  139. INNER JOIN base_student t2 ON t1.id = t2.user_id
  140. LEFT JOIN base_student_school_roll t3 ON t1.id = t3.user_id
  141. LEFT JOIN base_class t4 ON t4.id = t3.class_id
  142. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  143. LEFT JOIN base_grade t6 ON t3.grade_id = t6.id
  144. left join base_major_set t7 on t3.major_set_id = t7.id
  145. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
  146. and t3.archives_status = 'FB2901' and t2.is_normal = 1
  147. <if test="dto.classIds != null and dto.classIds.size() > 0">
  148. and t3.class_id in
  149. <foreach item="classId" index="index" collection="dto.classIds" open="(" close=")" separator=",">
  150. #{classId}
  151. </foreach>
  152. </if>
  153. <if test="dto.credentialNumbers != null and dto.credentialNumbers.size() > 0">
  154. and t1.credential_number in
  155. <foreach item="credentialNumber" index="index" collection="dto.credentialNumbers" open="(" close=")" separator=",">
  156. #{credentialNumber}
  157. </foreach>
  158. </if>
  159. </select>
  160. </mapper>