BaseStudentSchoolRollMapper.xml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 t2.id,
  8. t2.name AS student_name,
  9. t1.student_id,
  10. t2.mobile AS phone,
  11. t2.mobile AS teacher_phone,t5.name as teacher_name,
  12. t4.name AS class_name,
  13. t6.mobile AS guardian_phone
  14. FROM base_student t1
  15. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  16. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  17. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  18. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  19. LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
  20. WHERE t2.delete_mark = 0
  21. AND t1.delete_mark = 0
  22. AND t3.archives_status = 'FB2901'
  23. <if test="dto.gradeId != null">
  24. and t4.grade_id = #{dto.gradeId}
  25. </if>
  26. <if test="dto.majorSetId != null">
  27. and t3.major_set_id = #{dto.majorSetId}
  28. </if>
  29. <if test="dto.classId != null">
  30. and t4.id = #{dto.classId}
  31. </if>
  32. <if test="dto.teacherId != null">
  33. and t4.teacher_id = #{dto.teacherId}
  34. </if>
  35. <if test="dto.keyWord != null and dto.keyWord != ''">
  36. and (t4.name like concat('%', #{dto.keyWord}, '%')
  37. or t2.name like concat('%', #{dto.keyWord}, '%')
  38. or t5.name like concat('%', #{dto.keyWord}, '%')
  39. or t1.student_id like concat('%', #{dto.keyWord}, '%')
  40. or t2.mobile like concat('%', #{dto.keyWord}, '%')
  41. or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
  42. )
  43. </if>
  44. </select>
  45. <select id="getInfoById" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo">
  46. SELECT t2.id,t2.name AS student_name,t1.student_id,CONCAT(t5.name, ' ', t5.mobile) AS teacher_name, t5.mobile AS teacher_phone,t4.name AS class_name,
  47. (SELECT mobile FROM base_student_family_member WHERE delete_mark = 0 AND user_id = t2.id AND is_guardian = 1) AS guardian_phone,
  48. t8.name AS archives_status,t7.name AS stduy_status,t9.name AS roll_modality,t2.birth_date, t2.gender,t2.avatar,
  49. t6.name AS nation,t10.name AS major_set_name,t3.archives_status as archivesStatusCode,t3.stduy_status as stduyStatusCode,t3.roll_modality as rollModalityCode
  50. FROM base_student t1
  51. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  52. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  53. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  54. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  55. LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.nation AND t6.item_id = 2023000000000000008
  56. LEFT JOIN xjr_dictionary_detail t7 ON t7.code = t3.stduy_status AND t7.item_id = 2023000000000000030
  57. LEFT JOIN xjr_dictionary_detail t8 ON t8.code = t3.archives_status AND t8.item_id = 2023000000000000029
  58. LEFT JOIN xjr_dictionary_detail t9 ON t9.code = t3.roll_modality AND t9.item_id = 1762024751192084482
  59. LEFT JOIN base_major_set t10 ON t3.major_set_id = t10.id
  60. WHERE t2.id = #{id}
  61. </select>
  62. <update id="updateInfoByUserId" parameterType="com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto">
  63. UPDATE base_student_school_roll SET delete_mark = delete_mark
  64. <if test="dto.rollModality != null and dto.rollModality != ''">,roll_modality = #{dto.rollModality},learn_status = #{dto.rollModality} </if>
  65. <if test="dto.archivesStatus != null and dto.archivesStatus != ''">,archives_status = #{dto.archivesStatus} </if>
  66. <if test="dto.stduyStatus != null and dto.stduyStatus != ''">,stduy_status = #{dto.stduyStatus} </if>
  67. where user_id = #{id}
  68. </update>
  69. <select id="getGenderCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
  70. SELECT t2.gender as category,COUNT(*) as number FROM base_student t1
  71. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  72. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  73. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  74. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  75. LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
  76. WHERE t2.delete_mark = 0
  77. AND t1.delete_mark = 0
  78. and t3.archives_status = 'FB2901'
  79. <if test="dto.gradeId != null">
  80. and t4.grade_id = #{dto.gradeId}
  81. </if>
  82. <if test="dto.majorSetId != null">
  83. and t3.major_set_id = #{dto.majorSetId}
  84. </if>
  85. <if test="dto.classId != null">
  86. and t4.id = #{dto.classId}
  87. </if>
  88. <if test="dto.teacherId != null">
  89. and t4.teacher_id = #{dto.teacherId}
  90. </if>
  91. <if test="dto.keyWord != null and dto.keyWord != ''">
  92. and (t4.name like concat('%', #{dto.keyWord}, '%')
  93. or t2.name like concat('%', #{dto.keyWord}, '%')
  94. or t5.name like concat('%', #{dto.keyWord}, '%')
  95. or t1.student_id like concat('%', #{dto.keyWord}, '%')
  96. or t2.mobile like concat('%', #{dto.keyWord}, '%')
  97. or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
  98. )
  99. </if>
  100. group by t2.gender
  101. </select>
  102. <select id="getStudyStatusCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
  103. SELECT t3.stduy_status as category,COUNT(*) as number FROM base_student t1
  104. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  105. INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  106. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  107. LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
  108. LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
  109. WHERE t2.delete_mark = 0
  110. AND t1.delete_mark = 0
  111. <if test="dto.gradeId != null">
  112. and t4.grade_id = #{dto.gradeId}
  113. </if>
  114. <if test="dto.majorSetId != null">
  115. and t3.major_set_id = #{dto.majorSetId}
  116. </if>
  117. <if test="dto.classId != null">
  118. and t4.id = #{dto.classId}
  119. </if>
  120. <if test="dto.teacherId != null">
  121. and t4.teacher_id = #{dto.teacherId}
  122. </if>
  123. <if test="dto.keyWord != null and dto.keyWord != ''">
  124. and (t4.name like concat('%', #{dto.keyWord}, '%')
  125. or t2.name like concat('%', #{dto.keyWord}, '%')
  126. or t5.name like concat('%', #{dto.keyWord}, '%')
  127. or t1.student_id like concat('%', #{dto.keyWord}, '%')
  128. or t2.mobile like concat('%', #{dto.keyWord}, '%')
  129. or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
  130. )
  131. </if>
  132. group by t3.stduy_status
  133. </select>
  134. </mapper>