StudentHonorsMapper.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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.StudentHonorsMapper">
  6. <select id="getPage" parameterType="com.xjrsoft.module.student.dto.StudentHonorsPageDto"
  7. resultType="com.xjrsoft.module.student.vo.StudentHonorsPageVo">
  8. SELECT t1.id,t1.sort_code,t2.name AS student_name,t1.student_id,t3.name AS honors_level,t4.name AS honors_type,
  9. t5.name AS honors_grade,t1.name, t1.award_date,t1.status,t1.file_id FROM student_honors t1
  10. LEFT JOIN xjr_user t2 ON t1.student_user_id = t2.id
  11. LEFT JOIN xjr_dictionary_detail t3 ON t1.honors_level = t3.code AND t3.item_id = 1731576278748352514
  12. LEFT JOIN xjr_dictionary_detail t4 ON t1.honors_type = t4.code AND t4.item_id = 1731577666295418881
  13. LEFT JOIN xjr_dictionary_detail t5 ON t1.honors_grade = t5.code AND t5.item_id = 1731577201793028098
  14. WHERE t1.delete_mark = 0
  15. <if test="dto.classIdList != null">
  16. and t1.class_id in
  17. <foreach item="classId" index="index" collection="dto.classIdList" open="(" close=")"
  18. separator=",">
  19. #{classId}
  20. </foreach>
  21. </if>
  22. <if test="dto.classId != null and dto.classId > 0">
  23. AND t1.class_id = #{dto.classId}
  24. </if>
  25. <if test="dto.baseSemesterId != null and dto.baseSemesterId > 0">
  26. AND t1.base_semester_id = #{dto.baseSemesterId}
  27. </if>
  28. <if test="dto.honorsLevel != null and dto.honorsLevel != ''">
  29. AND t1.honors_level = #{dto.honorsLevel}
  30. </if>
  31. <if test="dto.honorsGrade != null and dto.honorsGrade != ''">
  32. AND t1.honors_grade = #{dto.honorsGrade}
  33. </if>
  34. <if test="dto.honorsType != null and dto.honorsType != ''">
  35. AND t1.honors_type = #{dto.honorsType}
  36. </if>
  37. <if test="dto.awardDate != null and dto.awardDate != ''">
  38. AND t1.award_date > #{dto.awardDate}
  39. </if>
  40. <if test="dto.userName != null and dto.userName != ''">
  41. AND t2.name like concat('%',#{dto.userName},'%')
  42. </if>
  43. <if test="dto.studentUserId != null and dto.studentUserId != ''">
  44. AND t1.student_user_id = #{dto.studentUserId}
  45. </if>
  46. and t1.status = 1
  47. order by t1.id desc
  48. </select>
  49. <select id="getSemesterInfo" resultType="com.xjrsoft.module.student.vo.StudentHonorsListVo">
  50. SELECT DISTINCT t1.base_semester_id as id, t2.name
  51. FROM student_honors t1
  52. INNER JOIN base_semester t2 ON t1.base_semester_id = t2.id
  53. WHERE t1.delete_mark = 0
  54. </select>
  55. <select id="getClassInfo" resultType="com.xjrsoft.module.student.vo.StudentHonorsListVo">
  56. SELECT DISTINCT t1.class_id as id, t2.name, t1.base_semester_id as parent_id
  57. FROM student_honors t1
  58. INNER JOIN base_class t2 ON t1.class_id = t2.id
  59. WHERE t1.delete_mark = 0
  60. </select>
  61. <select id="getInfo" resultType="com.xjrsoft.module.student.vo.StudentHonorsVo">
  62. SELECT t1.id,
  63. t2.name AS student_name,
  64. t1.student_id,
  65. t3.grade_id,
  66. t4.name AS grade_name,
  67. t1.class_id,
  68. t5.name AS class_name,
  69. t1.major_set_id,
  70. t11.name AS major_set_name,
  71. t1.applicant_user_id,
  72. t1.name AS applicant_user_name,
  73. t1.award_date,
  74. t1.name,
  75. t1.honors_level,
  76. t8.name AS honors_level_cn,
  77. t1.honors_type,
  78. t9.name AS honors_type_cn,
  79. t1.honors_grade,
  80. t10.name AS honors_grade_cn,
  81. t1.file_id,
  82. t1.base_semester_id,
  83. t1.student_user_id
  84. FROM student_honors t1
  85. LEFT JOIN xjr_user t2 ON t1.student_user_id = t2.id
  86. LEFT JOIN base_student_school_roll t3 ON t1.student_user_id = t3.user_id
  87. LEFT JOIN base_grade t4 ON t3.grade_id = t4.id
  88. LEFT JOIN base_class t5 ON t1.class_id = t5.id
  89. LEFT JOIN base_major_set t6 ON t3.major_set_id = t6.id
  90. LEFT JOIN xjr_user t7 ON t1.applicant_user_id = t7.id
  91. LEFT JOIN xjr_dictionary_detail t8 ON t1.honors_level = t8.code AND t8.item_id = 1731576278748352514
  92. LEFT JOIN xjr_dictionary_detail t9 ON t1.honors_type = t9.code AND t9.item_id = 1731577666295418881
  93. LEFT JOIN xjr_dictionary_detail t10 ON t1.honors_grade = t10.code AND t10.item_id = 1731577201793028098
  94. LEFT JOIN base_major_set t11 ON t1.major_set_id = t11.id
  95. WHERE t1.id = #{id}
  96. and t1.delete_mark = 0
  97. </select>
  98. <select id="getSortCode" resultType="java.lang.Integer">
  99. SELECT IFNULL(MAX(IFNULL(sort_code, 0)), 0) + 1
  100. FROM student_honors
  101. </select>
  102. </mapper>