首页查询优化

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

@ -39,7 +39,7 @@
c.dy_show as dyShow,
c.sort,
round(10000*rand(),0) as goodNum,
d.courseDetailsCount,
ifnull(d.courseDetailsCount,0) as courseDetailsCount,
null AS courseDetailsName,
null AS courseDetailsId,
round(10000*rand(),0) as weekGoodNum,
@ -139,7 +139,7 @@
c.course_type as courseType,
c.banner_id as bannerId,
b.name as bannerName,
d.viewCounts,
ifnull(d.viewCounts,0) as viewCounts,
c.dy_img_id as dyImgId,
c.dy_course_id as dyCourseId,
c.dy_status as dyStatus,
@ -170,10 +170,10 @@
c.`wx_course_status` as wxCourseStatus,
t.dyUrlStatus,
o.payMoney,
d.goodNum,
d.courseDetailsCount,
ifnull(d.goodNum,0) as goodNum,
ifnull(d.courseDetailsCount) as courseDetailsCount,
0 as weekGoodNum,
tt.isRecommend
ifnull(tt.isRecommend,0) as isRecommend
FROM
course AS c
LEFT JOIN course_classification AS cc ON c.classify_id = cc.classification_id

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