ClassHonorsMapper.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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.ClassHonorsMapper">
  6. <select id="getPagePC" parameterType="com.xjrsoft.module.student.dto.ClassHonorsPageDto" resultType="com.xjrsoft.module.student.vo.ClassHonorsPageVo">
  7. SELECT
  8. t.id,
  9. t.sort_code,
  10. t1.name AS honorsLevelCN,
  11. t2.name AS honorsGradeCN,
  12. t.name,
  13. t.award_date
  14. FROM class_honors t
  15. LEFT JOIN xjr_dictionary_detail t1 ON t1.code = t.honors_level
  16. LEFT JOIN xjr_dictionary_detail t2 ON t2.code = t.honors_grade
  17. WHERE
  18. t.delete_mark = 0
  19. <if test="dto.honorsLevel != null and dto.honorsLevel != ''">
  20. and t.honors_level = #{dto.honorsLevel}
  21. </if>
  22. <if test="dto.honorsGrade != null and dto.honorsGrade != ''">
  23. and t.honors_grade = #{dto.honorsGrade}
  24. </if>
  25. <if test="dto.awardDate != null and dto.awardDate != ''">
  26. and t.award_date = #{dto.awardDate}
  27. </if>
  28. <if test="dto.name != null and dto.name != ''">
  29. and t.name like concat('%',#{dto.name},'%')
  30. </if>
  31. <if test="dto.baseSemesterId != null and dto.baseSemesterId > 0">
  32. and t.base_semester_id = #{dto.baseSemesterId}
  33. </if>
  34. <if test="dto.classId != null and dto.classId > 0">
  35. and t.class_id = #{dto.classId}
  36. </if>
  37. ORDER BY
  38. t.id DESC;
  39. </select>
  40. <select id="getInfoById"
  41. resultType="com.xjrsoft.module.student.vo.ClassHonorsVo">
  42. SELECT
  43. t.*,
  44. t1.name AS honorsLevelCN,
  45. t2.name AS honorsGradeCN,
  46. t3.name AS baseSemesterIdCN,
  47. t4.name AS classIdCN
  48. FROM class_honors t
  49. LEFT JOIN xjr_dictionary_detail t1 ON t1.code = t.honors_level
  50. LEFT JOIN xjr_dictionary_detail t2 ON t2.code = t.honors_grade
  51. LEFT JOIN base_semester t3 ON t3.id = t.base_semester_id
  52. LEFT JOIN base_class t4 ON t4.id = t.class_id
  53. WHERE
  54. t.id = #{id} AND t.delete_mark = 0;
  55. </select>
  56. <select id="getSemester"
  57. resultType="com.xjrsoft.module.student.vo.ClassHonorsSemesterClassVo">
  58. select
  59. distinct
  60. t.base_semester_id,
  61. t1.name AS baseSemesterIdCN
  62. from class_honors t
  63. left join base_semester t1 on t1.id = t.base_semester_id
  64. where
  65. t.delete_mark = 0;
  66. </select>
  67. <select id="getSemesterClass"
  68. resultType="com.xjrsoft.module.student.vo.ClassHonorsSemesterClassVo">
  69. select
  70. distinct
  71. t.base_semester_id,
  72. t.class_id,
  73. t1.name AS semesterName,
  74. t2.name AS classIdCN
  75. from class_honors t
  76. left join base_semester t1 on t1.id = t.base_semester_id
  77. left join base_class t2 on t2.id = t.class_id
  78. where
  79. t.delete_mark = 0;
  80. </select>
  81. </mapper>