BaseStudentBehaviorManageMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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.BaseStudentBehaviorManageMapper">
  6. <select id="getPage" parameterType="com.xjrsoft.module.student.dto.BaseStudentBehaviorManagePageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentBehaviorManagePageVo">
  7. SELECT t.id, t2.score_type,
  8. t.file_id, t.assessment_address, t3.name AS semester_name, t1.sort_code,
  9. t.assessment_date, t.score, t.score_number, t.total_score, t4.name AS grade_name,
  10. t.is_affect, t1.name AS behaviorCategoryName, t2.name AS behaviorProjectName,
  11. (
  12. SELECT GROUP_CONCAT(b.name) FROM base_student_behavior_class_relation a
  13. LEFT JOIN base_class b ON a.class_id = b.id
  14. WHERE a.base_student_behavior_manage_id = t.id GROUP BY a.base_student_behavior_manage_id
  15. ) AS behavior_class_names,
  16. (
  17. SELECT NAME FROM xjr_user WHERE id = t.assessment_user_id
  18. ) AS assessment_user_name
  19. FROM base_student_behavior_manage t
  20. LEFT JOIN base_student_behavior_category t1 ON t1.id = t.base_student_behavior_category_id
  21. LEFT JOIN base_student_behavior_project t2 ON t2.id = t.base_student_behavior_project_id
  22. LEFT JOIN base_semester t3 ON t3.id = t.base_semester_id
  23. LEFT JOIN base_grade t4 ON t.grade_id = t4.id
  24. WHERE t.delete_mark = 0 AND t1.delete_mark = 0 AND t2.delete_mark = 0 AND t.status = 1 AND t1.delete_mark = 0
  25. <if test="dto.gradeId != null">
  26. and t.grade_id = #{dto.gradeId}
  27. </if>
  28. <if test="dto.semesterId != null">
  29. and t.base_semester_id = #{dto.semesterId}
  30. </if>
  31. <if test="dto.startDate != null and dto.startDate != ''">
  32. and t.assessment_date &gt;= #{dto.startDate}
  33. </if>
  34. <if test="dto.endDate != null and dto.endDate != ''">
  35. and t.assessment_date &lt;= #{dto.endDate}
  36. </if>
  37. <if test="dto.assessmentUserIds != null and dto.assessmentUserIds.size() > 0">
  38. AND t.assessment_user_id in
  39. <foreach item="userId" index="index" collection="dto.assessmentUserIds" open="(" close=")" separator=",">
  40. #{userId}
  41. </foreach>
  42. </if>
  43. </select>
  44. <select id="getInfo" resultType="com.xjrsoft.module.student.vo.BaseStudentBehaviorManageVo">
  45. SELECT t.id, t2.score_type, t1.sort_code,
  46. t.file_id, t.assessment_address, t3.name AS semester_name,
  47. t.assessment_date, t.score, t.score_number, t.total_score, t4.name AS grade_name,
  48. t.is_affect, t1.name AS behaviorCategoryName, t2.name AS behaviorProjectName,
  49. (
  50. SELECT GROUP_CONCAT(b.name) FROM base_student_behavior_class_relation a
  51. LEFT JOIN base_class b ON a.class_id = b.id
  52. WHERE a.base_student_behavior_manage_id = t.id GROUP BY a.base_student_behavior_manage_id
  53. ) AS asbinarysessment_class_names,
  54. (
  55. SELECT name FROM xjr_user WHERE id = t.assessment_user_id
  56. ) AS assessment_user_name
  57. FROM base_student_behavior_manage t
  58. LEFT JOIN base_student_behavior_category t1 ON t1.id = t.base_student_behavior_category_id
  59. LEFT JOIN base_student_behavior_project t2 ON t2.id = t.base_student_behavior_project_id
  60. LEFT JOIN base_semester t3 ON t3.id = t.base_semester_id
  61. LEFT JOIN base_grade t4 ON t.grade_id = t4.id
  62. WHERE t.delete_mark = 0 AND t1.delete_mark = 0 AND t2.delete_mark = 0 AND t.status = 1
  63. AND t.id = #{id}
  64. </select>
  65. <select id="getMobilePage" parameterType="com.xjrsoft.module.student.dto.BaseStudentBehaviorManageMobilePageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentBehaviorManageMobilePageVo">
  66. SELECT t1.sort_code,t1.name,t1.class_name,t.assessment_date,
  67. t3.name AS categoryName,t4.name AS projectName,t.score,t4.score_type,
  68. t2.name AS assessmentUserName,
  69. t.assessment_address,
  70. t3.name AS behaviorCategoryName,
  71. t4.name AS behaviorProjectName
  72. FROM base_student_behavior_manage t
  73. INNER JOIN base_student_behavior_student_relation t1 ON t1.base_student_behavior_manage_id = t.id
  74. <if test="dto.studentName != null and dto.studentName != ''">
  75. and t1.name like concat('%',#{dto.studentName},'%')
  76. </if>
  77. LEFT JOIN xjr_user t2 ON t2.id = t.assessment_user_id
  78. LEFT JOIN base_student_behavior_category t3 ON t3.id = t.base_student_behavior_category_id
  79. LEFT JOIN base_student_behavior_project t4 ON t4.id = t.base_student_behavior_project_id
  80. LEFT JOIN base_student_school_roll t5 ON t1.user_id = t5.user_id
  81. WHERE t.status = 1 AND t.delete_mark = 0 AND t3.delete_mark = 0
  82. AND t5.class_id IN (
  83. SELECT id FROM base_class WHERE teacher_id = #{dto.teacherId}
  84. )
  85. <if test="dto.gradeIds != null and dto.gradeIds.size() > 0">
  86. AND t5.grade_id in
  87. <foreach item="gradeId" index="index" collection="dto.gradeIds" open="(" close=")" separator=",">
  88. #{gradeId}
  89. </foreach>
  90. </if>
  91. <if test="dto.classIds != null and dto.classIds.size() > 0">
  92. AND t5.class_id in
  93. <foreach item="classId" index="index" collection="dto.classIds" open="(" close=")" separator=",">
  94. #{classId}
  95. </foreach>
  96. </if>
  97. <if test="dto.assessmentUserIds != null and dto.assessmentUserIds.size() > 0">
  98. AND t.assessment_user_id in
  99. <foreach item="assessmentUserId" index="index" collection="dto.assessmentUserIds" open="(" close=")" separator=",">
  100. #{assessmentUserId}
  101. </foreach>
  102. </if>
  103. <if test="dto.startDate != null and dto.startDate != ''">
  104. and t.assessment_date &gt;= #{dto.startDate}
  105. </if>
  106. <if test="dto.endDate != null and dto.endDate != ''">
  107. and t.assessment_date &lt;= #{dto.endDate}
  108. </if>
  109. </select>
  110. </mapper>