首页查询优化

This commit is contained in:
谭凯凯
2024-12-30 21:49:23 +08:00
committed by Tankaikai
parent 0aed96e92e
commit 7cb257317c
2 changed files with 9 additions and 8 deletions

View File

@@ -4,8 +4,9 @@
<!--查找指定短剧的目录 按照顺序数字升序-->
<select id="findByCourseId" resultType="com.sqx.modules.course.entity.CourseDetails">
select c.*,
cc.isGood
select
c.*,
ifnull(cc.isGood,0) as isGood
from course_details c
left join (select course_details_id,count(*) isGood from course_collect where user_id=#{userId} and classify=2 group by course_details_id) cc on c.course_details_id = c.course_details_id
where c.course_id=#{id} order by c.sort asc
@@ -37,7 +38,7 @@
c.advertising,
c.view_count as viewCount,
c.play_complete_count as playCompleteCount,
cc.isGood
ifnull(cc.isGood,0) as isGood
from course_details c
left join (select course_details_id,count(*) as isGood from course_collect where user_id=#{userId} and classify=2 group by course_details_id) cc on cc.course_details_id = c.course_details_id
where c.course_id=#{id} order by c.sort asc