|
|
@@ -28,10 +28,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
rs.course_id,rs.status,sum(section_num) as section_num,count(chapter_id)
|
|
|
as chapter_num,mc.category_name,sum(total_time) as duration from
|
|
|
(SELECT c.*,count(cs.section_id) as section_num,cs.chapter_id,IFNULL(sum(cs.video_time),0) as total_time
|
|
|
- FROM course c LEFT JOIN course_chapter cc on c.course_id = cc.course_id LEFT JOIN course_section cs
|
|
|
- on cc.chapter_id = cs.chapter_id
|
|
|
+ FROM course c LEFT JOIN course_chapter cc on c.course_id = cc.course_id
|
|
|
+ LEFT JOIN course_section cs
|
|
|
+ on cc.chapter_id = cs.chapter_id
|
|
|
+ <if test="status != null and status.size()!=0 ">
|
|
|
+ WHERE c.status in
|
|
|
+ <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ <if test="courseName != null and courseName != ''">
|
|
|
+ AND c.course_name like concat('%', #{courseName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="categoryId != null and categoryId != ''">
|
|
|
+ AND c.category_id = #{categoryId}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+
|
|
|
GROUP BY cs.chapter_id,c.course_id)rs LEFT JOIN major_category mc on rs.category_id = mc.category_id
|
|
|
GROUP BY course_id
|
|
|
+
|
|
|
</select>
|
|
|
|
|
|
</mapper>
|