移除广播表

短剧首页 关联查询修改
This commit is contained in:
2025-01-03 11:30:43 +08:00
parent 3ef249a5d4
commit c49a165dd9
8 changed files with 54 additions and 38 deletions

View File

@@ -28,19 +28,9 @@
c.title_img AS titleImg,
c.update_time AS updateTime,
c.course_type AS courseType,
c.banner_id AS bannerId,
COALESCE(d.courseDetailsCount, 0) AS courseDetailsCount
c.banner_id AS bannerId
FROM
course AS c
LEFT JOIN (
SELECT
course_id,
COUNT(*) AS courseDetailsCount
FROM
course_details
GROUP BY
course_id
) AS d ON d.course_id = c.course_id
WHERE
c.is_delete = 0
@@ -71,9 +61,9 @@
<if test="over!=null">
and c.is_over=#{over}
</if>
<if test="isRecommend!=null and isRecommend!=-1">
and c.course_id in (select course_id from course_details where good=1)
</if>
<!-- <if test="isRecommend!=null and isRecommend!=-1">-->
<!-- and c.course_id in (select course_id from course_details where good=1)-->
<!-- </if>-->
<if test="status!=null and status!=0">
and c.status=#{status}
</if>
@@ -123,7 +113,6 @@
c.course_type as courseType,
c.banner_id as bannerId,
b.name as bannerName,
ifnull(d.viewCounts,0) as viewCounts,
c.dy_img_id as dyImgId,
c.dy_course_id as dyCourseId,
c.dy_status as dyStatus,
@@ -152,20 +141,14 @@
c.`cost_of_production` as costOfProduction,
c.`cost_commitment_letter_material_id` as costCommitmentLetterMaterialId,
c.`wx_course_status` as wxCourseStatus,
t.dyUrlStatus,
o.payMoney,
ifnull(d.goodNum,0) as goodNum,
ifnull(d.courseDetailsCount, 0) as courseDetailsCount,
0 as weekGoodNum,
ifnull(tt.isRecommend,0) as isRecommend
-- t.dyUrlStatus,
0 as weekGoodNum
FROM
course AS c
LEFT JOIN course_classification AS cc ON c.classify_id = cc.classification_id
left join banner as b on b.id=c.banner_id
left join (select 1 as id,count(*) as dyUrlStatus from course_details where dy_url_status in (1,3) or dy_url_status=null group by course_id) t on t.id = 1
left join (select course_id,sum(pay_money) as payMoney from orders where status=1 group by course_id) o on o.course_id = c.course_id
left join (select course_id,sum(view_count) as viewCounts,sum(good_num) as goodNum,count(*) as courseDetailsCount from course_details group by course_id) d on d.course_id = c.course_id
left join (select course_id,count(*) as isRecommend from course_details where good=1 group by course_id) tt on tt.course_id = c.course_id
-- left join (select 1 as id,count(*) as dyUrlStatus from course_details where dy_url_status in (1,3) or dy_url_status=null group by course_id) t on t.id = 1
WHERE
1 = 1
AND c.is_delete = 0
@@ -199,9 +182,9 @@
<if test="over!=null and over==2">
and (c.is_over is null or c.is_over=2)
</if>
<if test="isRecommend!=null and isRecommend!=-1">
and c.course_id in (select course_id from course_details where good=1)
</if>
<!-- <if test="isRecommend!=null and isRecommend!=-1">-->
<!-- and c.course_id in (select course_id from course_details where good=1)-->
<!-- </if>-->
<if test="status!=null and status!=0">
and c.status=#{status}
</if>