BaseStudentMapper.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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,
  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. <if test="dto.name != null and dto.name != ''">
  66. and t1.name like concat('%', #{dto.name},'%')
  67. </if>
  68. <if test="dto.userName != null and dto.userName != ''">
  69. and t1.user_name like concat('%', #{dto.userName},'%')
  70. </if>
  71. <if test="dto.mobile != null and dto.mobile != ''">
  72. and t1.mobile like concat('%', #{dto.mobile},'%')
  73. </if>
  74. <if test="dto.email != null and dto.email != ''">
  75. and t1.email like concat('%', #{dto.email},'%')
  76. </if>
  77. <if test="dto.classId != null">
  78. and t4.id = #{dto.classId}
  79. </if>
  80. <if test="dto.order == null">
  81. order by t1.id
  82. </if>
  83. <if test="dto.order != null">
  84. <if test="dto.order == 'ascend'">
  85. <if test="dto.field != null and dto.field == 'stduyStatusCn'">
  86. order by t8.name
  87. </if>
  88. <if test="dto.field != null and dto.field == 'name'">
  89. order by t1.name asc
  90. </if>
  91. </if>
  92. <if test="dto.order == 'descend'">
  93. <if test="dto.field != null and dto.field == 'stduyStatusCn'">
  94. order by t8.name desc
  95. </if>
  96. <if test="dto.field != null and dto.field == 'name'">
  97. order by t1.name desc
  98. </if>
  99. </if>
  100. </if>
  101. </select>
  102. </mapper>