CourseTable.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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.courseTable.mapper.CourseTableMapper">
  6. <select id="getList" parameterType="com.xjrsoft.module.schedule.dto.CourseTableDto" resultType="com.xjrsoft.module.schedule.vo.CourseDetailVo">
  7. SELECT distinct t1.course_name, t1.teacher_name,CONCAT(t4.name,t3.name) AS classroom_name,t1.weeks,t1.time_period,t1.time_number,t5.name as class_name,t1.schedule_date,t1.adjust_type FROM course_table t1
  8. LEFT JOIN base_classroom t3 ON t1.site_id = t3.id
  9. LEFT JOIN base_office_build t4 ON t3.office_build_id = t4.id
  10. LEFT JOIN base_class t5 ON t1.class_id = t5.id
  11. LEFT JOIN base_class_major_set t7 ON t7.class_id = t5.id
  12. LEFT JOIN base_grade t6 ON t5.grade_id = t6.id
  13. where t1.status = 1
  14. <if test="dto.semesterId != null">
  15. and t1.base_semester_id = #{dto.semesterId}
  16. </if>
  17. <if test="dto.weekDay != null">
  18. and t1.weeks = #{dto.weekDay}
  19. </if>
  20. <if test="dto.courseType != null and dto.courseType != '' and dto.courseType == 'teacher' and dto.teacherId != null">
  21. and t1.teacher_id like concat('%', #{dto.teacherId}, '%')
  22. </if>
  23. <if test="dto.courseType != null and dto.courseType != '' and dto.courseType == 'class'">
  24. <if test="dto.gradeId != null">
  25. and t6.id = #{dto.gradeId}
  26. </if>
  27. <if test="dto.classId != null">
  28. and t5.id = #{dto.classId}
  29. </if>
  30. <if test="dto.majorSetId != null">
  31. and t7.major_set_id = #{dto.majorSetId}
  32. </if>
  33. </if>
  34. <if test="dto.startDate != null and dto.endDate != null">
  35. and t1.schedule_date between #{dto.startDate} and #{dto.endDate}
  36. </if>
  37. <if test="dto.toDay != null">
  38. and t1.schedule_date = #{dto.toDay}
  39. </if>
  40. <if test="dto.teacherId != null">
  41. and t1.teacher_id like concat('%', #{dto.teacherId}, '%')
  42. </if>
  43. <if test="dto.classId != null">
  44. and t5.id = #{dto.classId}
  45. </if>
  46. ORDER BY t1.weeks,t1.time_period,t1.time_number
  47. </select>
  48. <select id="getAdjustList" parameterType="com.xjrsoft.module.schedule.dto.CourseTableAdjustDto" resultType="com.xjrsoft.module.schedule.vo.CourseListVo">
  49. SELECT t1.time_period,t4.short_name as time_number,t1.course_name,t2.name AS class_name,t3.name AS classroom_name,t1.id,t2.id as class_id FROM course_table t1
  50. LEFT JOIN base_class t2 ON t1.class_id = t2.id
  51. LEFT JOIN base_classroom t3 ON t1.site_id = t3.id
  52. left join class_time t4 on t1.time_number = t4.number and t1.time_period = t4.time_period
  53. WHERE t1.status = 1
  54. <if test="dto.adjustType != null and dto.adjustType == 'course_exchange'">
  55. AND t1.teacher_id = #{dto.teacherId}
  56. </if>
  57. <if test="dto.adjustType != null and dto.adjustType == 'course_substitute'">
  58. AND t1.teacher_id like concat('%', #{dto.teacherId},'%')
  59. </if>
  60. AND t1.weeks = #{dto.week} AND t1.schedule_date = #{dto.adjustDate}
  61. <if test="dto.classId != null and dto.classId != ''">
  62. and t1.class_id = #{dto.classId}
  63. </if>
  64. <if test="dto.exceptCourseList != null and dto.exceptCourseList.size > 0">
  65. AND t1.id not in
  66. <foreach item="courseId" collection="dto.exceptCourseList" open="(" separator="," close=")">
  67. #{courseId}
  68. </foreach>
  69. </if>
  70. order by t4.number asc
  71. </select>
  72. <select id="getExceptCourseList" parameterType="java.lang.Long" resultType="com.xjrsoft.module.schedule.entity.WfCourseAdjust">
  73. SELECT a1.* FROM wf_course_adjust a1
  74. INNER JOIN xjr_workflow_form_relation a2 ON a1.id = a2.form_key_value
  75. WHERE a1.delete_mark = 0 and a1.enabled_mark = 1 AND a2.current_state IN ('COMPLETED','ACTIVE')
  76. and a1.user_id = #{userId}
  77. </select>
  78. <select id="getExceptCourseIds" parameterType="java.lang.Long" resultType="java.lang.Long">
  79. SELECT a0.id FROM course_table_bak a0
  80. INNER JOIN wf_course_adjust a1 ON a1.id = a0.wf_course_adjust_id
  81. INNER JOIN xjr_workflow_form_relation a2 ON a1.id = a2.form_key_value
  82. WHERE a1.delete_mark = 0 AND a1.enabled_mark = 1 AND a2.current_state IN ('COMPLETED','ACTIVE')
  83. AND a1.user_id = #{userId}
  84. </select>
  85. <select id="getClassListByTeacherId" parameterType="com.xjrsoft.module.schedule.dto.ClassOptionDto" resultType="com.xjrsoft.module.schedule.vo.ClassOptionVo">
  86. SELECT id,name FROM base_class WHERE delete_mark = 0 AND id IN (
  87. SELECT DISTINCT class_id FROM course_table WHERE teacher_id like concat('%', #{dto.userId},'%')
  88. )
  89. </select>
  90. <select id="getClassTeacherIds" parameterType="com.xjrsoft.module.courseTable.dto.ClassTeacherDto" resultType="com.xjrsoft.module.courseTable.vo.ClassTeacherVo">
  91. SELECT DISTINCT t1.class_id,t1.teacher_id FROM course_table t1
  92. WHERE t1.class_id IN (SELECT id FROM base_class WHERE grade_id = #{dto.gradeId})
  93. AND t1.schedule_date BETWEEN #{dto.startDate} AND #{dto.endDate}
  94. AND (t1.adjust_type = 'course_exchange' OR t1.adjust_type = 'course_replace' OR t1.adjust_type IS NULL)
  95. UNION
  96. SELECT DISTINCT t1.class_id,t1.teacher_id FROM course_table_bak t1
  97. WHERE t1.class_id IN (SELECT id FROM base_class WHERE grade_id = #{dto.gradeId})
  98. AND t1.schedule_date BETWEEN #{dto.startDate} AND #{dto.endDate}
  99. AND (t1.adjust_type = 'course_exchange' OR t1.adjust_type = 'course_replace' OR t1.adjust_type IS NULL)
  100. </select>
  101. <select id="getSubstituteTeacherCourseCountByParams" parameterType="com.xjrsoft.module.courseTable.dto.ClassTeacherDto" resultType="java.lang.Integer">
  102. SELECT COUNT(t1.id) FROM course_table t1
  103. INNER JOIN course_table_bak t2 ON t1.schedule_date = t2.schedule_date
  104. AND t1.time_number = t2.time_number
  105. AND t1.time_period = t2.time_period
  106. WHERE t2.wf_course_adjust_id = #{dto.wfCourseAdjustId}
  107. AND t1.teacher_id LIKE concat('%', #{dto.teacherId},'%') AND t1.adjust_type IS NULL;
  108. </select>
  109. </mapper>