CoursePatrolEvaluationMapper.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.ym.mec.biz.dal.mapper.CoursePatrolEvaluationMapper">
  4. <select id="selectPage" resultType="com.ym.mec.biz.dal.wrapper.CoursePatrolEvaluationWrapper$CoursePatrolEvaluationInfo">
  5. SELECT t.id_
  6. , mg.organ_id_ as organId
  7. , mg.cooperation_organ_id_ as cooperationOrganId
  8. , cs.id_ as courseScheduleId
  9. , cs.type_ as courseType
  10. , cs.name_ as courseName
  11. , cs.class_date_ as courseDate
  12. , cs.start_class_time_ as startClassTime
  13. , cs.end_class_time_ as endClassTime
  14. , cs.status_ as courseStatus
  15. , cs.actual_teacher_id_ as teacherId
  16. , t.user_id_ as userId
  17. , t.evaluate_status_ as evaluateStatus
  18. , t.problem_type_ as problemType
  19. , t.problem_desc_ as problemDesc
  20. , t.handle_status_ as handleStatus
  21. , t.suggestion_ as suggestion
  22. , t.attachment_url_ as attachmentUrl
  23. FROM course_schedule cs
  24. left join course_patrol_evaluation t on cs.id_ = t.course_schedule_id_
  25. left join music_group mg on mg.id_ = cs.music_group_id_
  26. <if test="param.keyword != null and param.keyword != ''">
  27. left join sys_user su on cs.actual_teacher_id_ = su.id_
  28. </if>
  29. <where>
  30. <if test="param.patrolFlag != null and param.patrolFlag">
  31. and t.id_ is not null
  32. </if>
  33. <if test="param.keyword != null and param.keyword != ''">
  34. and (su.real_name_ like concat('%', #{param.keyword}, '%')
  35. or su.id_ like concat('%', #{param.keyword}, '%')
  36. or su.phone_ like concat('%', #{param.keyword}, '%'))
  37. </if>
  38. <if test="param.startTime != null">
  39. and cs.class_date_ &gt;= date_format(#{param.startTime}, '%Y-%m-%d')
  40. </if>
  41. <if test="param.endTime != null">
  42. and cs.class_date_ &lt;= date_format(#{param.endTime}, '%Y-%m-%d')
  43. </if>
  44. <if test="param.organId != null and param.organId != ''">
  45. and find_in_set(mg.organ_id_, #{param.organId})
  46. </if>
  47. <if test="param.cooperationOrganId != null">
  48. and mg.cooperation_organ_id_ = #{param.cooperationOrganId}
  49. </if>
  50. <if test="param.courseType != null">
  51. and cs.type_ = #{param.courseType}
  52. </if>
  53. <if test="param.evaluateStatus != null">
  54. and t.evaluate_status_ = #{param.evaluateStatus}
  55. </if>
  56. <if test="param.problemType != null">
  57. and find_in_set(#{param.problemType}, t.problem_type_)
  58. </if>
  59. <if test="param.handleStatus != null">
  60. and t.handle_status_ = #{param.handleStatus}
  61. </if>
  62. <if test="param.evaluateFlag != null">
  63. <if test="param.evaluateFlag">
  64. and t.evaluate_status_ is not null
  65. </if>
  66. <if test="param.evaluateFlag == false">
  67. and t.evaluate_status_ is null
  68. </if>
  69. </if>
  70. <if test="param.id != null">
  71. and t.id_ = #{param.id}
  72. </if>
  73. <if test="param.status != null">
  74. and cs.status_ = #{param.status}
  75. </if>
  76. </where>
  77. order by cs.start_class_time_, cs.id_
  78. </select>
  79. <select id="pageStat"
  80. resultType="com.ym.mec.biz.dal.wrapper.CoursePatrolEvaluationWrapper$CoursePatrolEvaluationStat">
  81. select
  82. cs.class_date_ as `date`
  83. ,count(distinct cs.id_) as `totalCount`
  84. ,sum( if(cs.type_ = 'SINGLE',1,0)) as singleCourseCount
  85. ,sum( if(cs.type_ = 'MIX',1,0)) as minCourseCount
  86. ,sum( if(cpe.id_ is not null,1,0)) as patrolCount
  87. from
  88. course_schedule cs
  89. left join music_group mg on mg.id_ = cs.music_group_id_
  90. left join course_patrol_evaluation cpe on cpe.course_schedule_id_ = cs.id_
  91. <where>
  92. cs.teach_mode_ = 'OFFLINE'
  93. <if test="param.startTime != null">
  94. and cs.class_date_ &gt;= date_format(#{param.startTime},'%Y-%m-%d')
  95. </if>
  96. <if test="param.endTime != null">
  97. and cs.class_date_ &lt;= date_format(#{param.endTime},'%Y-%m-%d')
  98. </if>
  99. <if test="param.cooperationOrganId != null">
  100. and mg.cooperation_organ_id_ = #{param.cooperationOrganId}
  101. </if>
  102. </where>
  103. group by cs.class_date_
  104. order by cs.class_date_
  105. </select>
  106. </mapper>