|
|
@@ -41,12 +41,12 @@
|
|
|
) tb2
|
|
|
</select>
|
|
|
<select id="tmpTopMovie" resultType="java.util.Map">
|
|
|
- select case ot1.movie_source when 2 then movie_name else concat('欢瑞自制-', movie_name) end as movie_name,
|
|
|
+ select case ot1.movie_source when 2 then movie_name else concat('欢瑞自制-', movie_name) end as movie_name,
|
|
|
ot1.rk, ot1.share_end_amount, ot1.end_amount, ot2.cost_amount, ot2.real_cost_amount,
|
|
|
concat(round(if(ifnull(cost_amount,0)=0, 0, end_amount/cost_amount*100), 2), '%') AS water_roi,
|
|
|
concat(round(if(ifnull(real_cost_amount,0)=0, 0, share_end_amount/real_cost_amount*100), 2), '%') AS real_roi
|
|
|
FROM
|
|
|
- (select ifnull(tb2.movie_name, tb1.movie_id) as movie_name, tb2.movie_source,
|
|
|
+ (select ifnull(tb2.movie_name, tb1.movie_id) as movie_name, movie_source,
|
|
|
rank() over (order by sum(end_amount) desc) as rk, sum(end_amount) as end_amount, sum(share_end_amount) as share_end_amount
|
|
|
from
|
|
|
(select
|
|
|
@@ -61,11 +61,12 @@
|
|
|
order by end_amount desc
|
|
|
) tb1
|
|
|
left join
|
|
|
- (select distinct moive_id, movie_name, movie_source from deepthink.all_moive) tb2 on tb1.movie_id=tb2.moive_id
|
|
|
+ (select distinct moive_id, movie_name, movie_source from deepthink.all_moive union
|
|
|
+ select series_id, ifnull(replace(series_name,REGEXP_SUBSTR(series_name, '[0-9]+$'),''),series_name),4 from media_api.kuaishou_drama_series_info) tb2 on tb1.movie_id=tb2.moive_id
|
|
|
group by movie_name order by rk limit 10) ot1
|
|
|
left join
|
|
|
- (select product_name, round(ifnull(sum(cost_amount),0),2) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
|
- from application.media_product_report_daily where stat_date=${date} group by product_name
|
|
|
+ (select ifnull(replace(product_name,REGEXP_SUBSTR(product_name, '[0-9]+$'),''),product_name) as product_name, round(ifnull(sum(cost_amount),0),2) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
|
+ from application.media_product_report_daily where stat_date=${date} group by ifnull(replace(product_name,REGEXP_SUBSTR(product_name, '[0-9]+$'),''),product_name)
|
|
|
) ot2 on ot1.movie_name=ot2.product_name
|
|
|
order by rk
|
|
|
</select>
|