|
|
@@ -64,55 +64,75 @@
|
|
|
round(ifnull(sum(iap_real_cost_amount), 0), 2) as iap_real_cost_amount
|
|
|
</sql>
|
|
|
|
|
|
+ <sql id="coreIndicatorSqlPart">
|
|
|
+ round(ifnull(sum(cost_amount),0), 2) as cost_amount,
|
|
|
+ round(ifnull(sum(mj_cost_amount),0), 2) as mj_cost_amount,
|
|
|
+ round(ifnull(sum(dj_cost_amount),0), 2) as dj_cost_amount,
|
|
|
+ round(ifnull(sum(real_cost_amount), 0), 2) as real_cost_amount,
|
|
|
+ round(ifnull(sum(dj_real_cost_amount), 0), 2) as dj_real_cost_amount,
|
|
|
+ round(ifnull(sum(mj_real_cost_amount), 0), 2) as mj_real_cost_amount,
|
|
|
+ round(ifnull(sum(pay_amount), 0), 2) AS pay_amount,
|
|
|
+ round(ifnull(sum(dj_pay_amount), 0), 2) AS dj_pay_amount,
|
|
|
+ round(ifnull(sum(mj_pay_amount), 0), 2) AS mj_pay_amount,
|
|
|
+ round(ifnull(sum(share_iaa_amount), 0), 2) as share_iaa_amount,
|
|
|
+ round(ifnull(sum(dj_share_iaa_amount), 0), 2) as dj_share_iaa_amount,
|
|
|
+ round(ifnull(sum(mj_share_iaa_amount), 0), 2) as mj_share_iaa_amount,
|
|
|
+ round(ifnull(sum(share_iaa_amount_3), 0) + ifnull(sum(share_pay_amount), 0) - ifnull(sum(real_cost_amount), 0), 2) AS real_profit,
|
|
|
+ round(ifnull(sum(dj_share_iaa_amount_3), 0) + ifnull(sum(dj_share_pay_amount), 0) - ifnull(sum(dj_real_cost_amount), 0), 2) AS dj_real_profit,
|
|
|
+ round(ifnull(sum(mj_share_iaa_amount_3), 0) + ifnull(sum(mj_share_pay_amount), 0) - ifnull(sum(mj_real_cost_amount), 0), 2) AS mj_real_profit,
|
|
|
+ round(ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) - ifnull(sum(cost_amount), 0), 2) AS water_profit,
|
|
|
+ round(ifnull(sum(dj_iaa_amount), 0) + ifnull(sum(dj_pay_amount), 0) - ifnull(sum(dj_cost_amount), 0), 2) AS dj_water_profit,
|
|
|
+ round(ifnull(sum(mj_iaa_amount), 0) + ifnull(sum(mj_pay_amount), 0) - ifnull(sum(mj_cost_amount), 0), 2) AS mj_water_profit,
|
|
|
+ concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, (ifnull(sum(share_iaa_amount_3),0)+ifnull(sum(share_pay_amount),0))/sum(real_cost_amount)*100), 2), '%') AS real_roi,
|
|
|
+ concat(round(if(ifnull(sum(dj_real_cost_amount),0)=0, 0, (ifnull(sum(dj_share_iaa_amount_3),0)+ifnull(sum(dj_share_pay_amount),0))/sum(dj_real_cost_amount)*100), 2), '%') AS dj_real_roi,
|
|
|
+ concat(round(if(ifnull(sum(mj_real_cost_amount),0)=0, 0, (ifnull(sum(mj_share_iaa_amount_3),0)+ifnull(sum(mj_share_pay_amount),0))/sum(mj_real_cost_amount)*100), 2), '%') AS mj_real_roi,
|
|
|
+ round(ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0), 2) as end_amount,
|
|
|
+ round(ifnull(sum(dj_share_iaa_amount), 0) + ifnull(sum(dj_share_pay_amount), 0), 2) as dj_end_amount,
|
|
|
+ round(ifnull(sum(mj_share_iaa_amount), 0) + ifnull(sum(mj_share_pay_amount), 0), 2) as mj_end_amount
|
|
|
+ </sql>
|
|
|
+
|
|
|
<select id="tmpPushData" resultType="java.util.Map">
|
|
|
select
|
|
|
- <include refid="costAmount"/>,
|
|
|
- <include refid="realCostAmount"/>,
|
|
|
- <include refid="payAmount"/>,
|
|
|
- <include refid="shareIaaAmount"/>,
|
|
|
- <include refid="realProfit"/>,
|
|
|
- <include refid="realRoi"/>,
|
|
|
- <include refid="endAmount"/>
|
|
|
+ <include refid="coreIndicatorSqlPart"/>
|
|
|
FROM
|
|
|
- (select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
|
|
|
- from application.media_ad_report_daily
|
|
|
- where stat_date = ${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
|
|
|
- ) tb1,
|
|
|
- (select sum(pay_amount) as pay_amount,
|
|
|
- sum(iaa_amount) as iaa_amount,
|
|
|
- sum(share_iaa_amount_3) as share_iaa_amount_3,
|
|
|
- sum(share_pay_amount) as share_pay_amount,
|
|
|
- sum(share_iaa_amount) as share_iaa_amount
|
|
|
- from application.user_data_report_daily
|
|
|
- where stat_date = ${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
|
|
|
- ) tb2
|
|
|
+ (select sum(cost_amount) as cost_amount,
|
|
|
+ sum(case t3.movie_type when 'DJ' then ifnull(cost_amount, 0) else 0 end) as dj_cost_amount,
|
|
|
+ sum(case t3.movie_type when 'MJ' then ifnull(cost_amount, 0) else 0 end) as mj_cost_amount,
|
|
|
+ sum(real_cost_amount) as real_cost_amount,
|
|
|
+ sum(case t3.movie_type when 'DJ' then ifnull(real_cost_amount, 0) else 0 end) as dj_real_cost_amount,
|
|
|
+ sum(case t3.movie_type when 'MJ' then ifnull(real_cost_amount, 0) else 0 end) as mj_real_cost_amount,
|
|
|
+ max(t1.update_time) as update_time
|
|
|
+ from application.media_ad_report_daily t1
|
|
|
+ left join tidb.deepthink.mini_app_info t2 on t1.ma_appid = t2.app_id
|
|
|
+ join tidb.deepthink.all_moive t3 on t1.movie_id = t3.moive_id and find_in_set(t3.movie_source, t2.movie_sources) > 0
|
|
|
+ where stat_date = #{date}
|
|
|
+ and t2.business_line in (1,6,7,4,8,9,10)
|
|
|
+ ) tb1,
|
|
|
+ (select sum(pay_amount) as pay_amount,
|
|
|
+ sum(case t3.movie_type when 'DJ' then ifnull(pay_amount, 0) else 0 end) as dj_pay_amount,
|
|
|
+ sum(case t3.movie_type when 'MJ' then ifnull(pay_amount, 0) else 0 end) as mj_pay_amount,
|
|
|
+ sum(share_iaa_amount) as share_iaa_amount,
|
|
|
+ sum(case t3.movie_type when 'DJ' then ifnull(share_iaa_amount, 0) else 0 end) as dj_share_iaa_amount,
|
|
|
+ sum(case t3.movie_type when 'MJ' then ifnull(share_iaa_amount, 0) else 0 end) as mj_share_iaa_amount,
|
|
|
+ sum(share_iaa_amount_3) as share_iaa_amount_3,
|
|
|
+ sum(case t3.movie_type when 'DJ' then ifnull(share_iaa_amount_3, 0) else 0 end) as dj_share_iaa_amount_3,
|
|
|
+ sum(case t3.movie_type when 'MJ' then ifnull(share_iaa_amount_3, 0) else 0 end) as mj_share_iaa_amount_3,
|
|
|
+ sum(share_pay_amount) as share_pay_amount,
|
|
|
+ sum(case t3.movie_type when 'DJ' then ifnull(share_pay_amount, 0) else 0 end) as dj_share_pay_amount,
|
|
|
+ sum(case t3.movie_type when 'MJ' then ifnull(share_pay_amount, 0) else 0 end) as mj_share_pay_amount,
|
|
|
+ sum(iaa_amount) as iaa_amount,
|
|
|
+ sum(case t3.movie_type when 'DJ' then ifnull(iaa_amount, 0) else 0 end) as dj_iaa_amount,
|
|
|
+ sum(case t3.movie_type when 'MJ' then ifnull(iaa_amount, 0) else 0 end) as mj_iaa_amount
|
|
|
+ from application.user_data_report_daily t1
|
|
|
+ left join tidb.deepthink.mini_app_info t2 on t1.ma_appid = t2.app_id
|
|
|
+ join tidb.deepthink.all_moive t3 on t1.movie_id = t3.moive_id and find_in_set(t3.movie_source, t2.movie_sources) > 0
|
|
|
+ where stat_date = #{date}
|
|
|
+ and t2.business_line in (1,6,7,4,8,9,10)
|
|
|
+ ) tb2
|
|
|
</select>
|
|
|
<select id="adHourData" resultType="java.util.Map">
|
|
|
select
|
|
|
- round(ifnull(sum(cost_amount),0), 2) as cost_amount,
|
|
|
- round(ifnull(sum(mj_cost_amount),0), 2) as mj_cost_amount,
|
|
|
- round(ifnull(sum(dj_cost_amount),0), 2) as dj_cost_amount,
|
|
|
- round(ifnull(sum(real_cost_amount), 0), 2) as real_cost_amount,
|
|
|
- round(ifnull(sum(dj_real_cost_amount), 0), 2) as dj_real_cost_amount,
|
|
|
- round(ifnull(sum(mj_real_cost_amount), 0), 2) as mj_real_cost_amount,
|
|
|
- round(ifnull(sum(pay_amount), 0), 2) AS pay_amount,
|
|
|
- round(ifnull(sum(dj_pay_amount), 0), 2) AS dj_pay_amount,
|
|
|
- round(ifnull(sum(mj_pay_amount), 0), 2) AS mj_pay_amount,
|
|
|
- round(ifnull(sum(share_iaa_amount), 0), 2) as share_iaa_amount,
|
|
|
- round(ifnull(sum(dj_share_iaa_amount), 0), 2) as dj_share_iaa_amount,
|
|
|
- round(ifnull(sum(mj_share_iaa_amount), 0), 2) as mj_share_iaa_amount,
|
|
|
- round(ifnull(sum(share_iaa_amount_3), 0) + ifnull(sum(share_pay_amount), 0) - ifnull(sum(real_cost_amount), 0), 2) AS real_profit,
|
|
|
- round(ifnull(sum(dj_share_iaa_amount_3), 0) + ifnull(sum(dj_share_pay_amount), 0) - ifnull(sum(dj_real_cost_amount), 0), 2) AS dj_real_profit,
|
|
|
- round(ifnull(sum(mj_share_iaa_amount_3), 0) + ifnull(sum(mj_share_pay_amount), 0) - ifnull(sum(mj_real_cost_amount), 0), 2) AS mj_real_profit,
|
|
|
- round(ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) - ifnull(sum(cost_amount), 0), 2) AS water_profit,
|
|
|
- round(ifnull(sum(dj_iaa_amount), 0) + ifnull(sum(dj_pay_amount), 0) - ifnull(sum(dj_cost_amount), 0), 2) AS dj_water_profit,
|
|
|
- round(ifnull(sum(mj_iaa_amount), 0) + ifnull(sum(mj_pay_amount), 0) - ifnull(sum(mj_cost_amount), 0), 2) AS mj_water_profit,
|
|
|
- concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, (ifnull(sum(share_iaa_amount_3),0)+ifnull(sum(share_pay_amount),0))/sum(real_cost_amount)*100), 2), '%') AS real_roi,
|
|
|
- concat(round(if(ifnull(sum(dj_real_cost_amount),0)=0, 0, (ifnull(sum(dj_share_iaa_amount_3),0)+ifnull(sum(dj_share_pay_amount),0))/sum(dj_real_cost_amount)*100), 2), '%') AS dj_real_roi,
|
|
|
- concat(round(if(ifnull(sum(mj_real_cost_amount),0)=0, 0, (ifnull(sum(mj_share_iaa_amount_3),0)+ifnull(sum(mj_share_pay_amount),0))/sum(mj_real_cost_amount)*100), 2), '%') AS mj_real_roi,
|
|
|
- round(ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0), 2) as end_amount,
|
|
|
- round(ifnull(sum(dj_share_iaa_amount), 0) + ifnull(sum(dj_share_pay_amount), 0), 2) as dj_end_amount,
|
|
|
- round(ifnull(sum(mj_share_iaa_amount), 0) + ifnull(sum(mj_share_pay_amount), 0), 2) as mj_end_amount
|
|
|
+ <include refid="coreIndicatorSqlPart"/>
|
|
|
from
|
|
|
(select sum(cost_amount) as cost_amount,
|
|
|
sum(case t3.movie_type when 'DJ' then ifnull(cost_amount, 0) else 0 end) as dj_cost_amount,
|
|
|
@@ -149,7 +169,7 @@
|
|
|
) tb2
|
|
|
</select>
|
|
|
<select id="tmpTopMovie" resultType="java.util.Map">
|
|
|
- select tb4.ly_movie_name as movie_name, tb4.movie_project_source, tb5.dict_name as movie_project_source_name,
|
|
|
+ select tb4.ly_movie_name as movie_name, tb4.movie_project_source, tb5.dict_name as movie_project_source_name, tb4.movie_type,
|
|
|
group_concat(distinct case tb4.movie_source when 2 then '2' else '1' end) as movie_source,
|
|
|
rank() over (order by sum(iaa_amount)+sum(pay_amount) desc) as rk,
|
|
|
<include refid="endAmount"/>,
|
|
|
@@ -189,43 +209,21 @@
|
|
|
group by movie_id
|
|
|
) tb3 on tb1.movie_id=tb3.movie_id
|
|
|
left join
|
|
|
- (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_project_source,ly_movie_name from tidb.deepthink.all_moive
|
|
|
+ (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_project_source,project_ad_date, ly_movie_name, movie_type from tidb.deepthink.all_moive
|
|
|
) tb4 on tb1.movie_id=tb4.moive_id
|
|
|
left join
|
|
|
(select dict_key, dict_name from tidb.deepthink.dt_dictionary where select_key='movie_project_source'
|
|
|
) tb5 on tb4.movie_project_source=tb5.dict_key
|
|
|
where 1=1 and tb1.movie_id!='-9999'
|
|
|
- group by tb4.ly_movie_name, tb4.movie_project_source, tb5.dict_name
|
|
|
+ group by tb4.ly_movie_name, tb4.movie_project_source, tb5.dict_name, tb4.movie_type
|
|
|
order by sum(iaa_amount)+sum(pay_amount) desc
|
|
|
limit 20
|
|
|
</select>
|
|
|
|
|
|
<select id="adDailyData" resultType="java.util.Map">
|
|
|
select
|
|
|
- round(ifnull(sum(cost_amount),0), 2) as cost_amount,
|
|
|
- round(ifnull(sum(mj_cost_amount),0), 2) as mj_cost_amount,
|
|
|
- round(ifnull(sum(dj_cost_amount),0), 2) as dj_cost_amount,
|
|
|
- round(ifnull(sum(real_cost_amount), 0), 2) as real_cost_amount,
|
|
|
- round(ifnull(sum(dj_real_cost_amount), 0), 2) as dj_real_cost_amount,
|
|
|
- round(ifnull(sum(mj_real_cost_amount), 0), 2) as mj_real_cost_amount,
|
|
|
- round(ifnull(sum(pay_amount), 0), 2) AS pay_amount,
|
|
|
- round(ifnull(sum(dj_pay_amount), 0), 2) AS dj_pay_amount,
|
|
|
- round(ifnull(sum(mj_pay_amount), 0), 2) AS mj_pay_amount,
|
|
|
- round(ifnull(sum(share_iaa_amount), 0), 2) as share_iaa_amount,
|
|
|
- round(ifnull(sum(dj_share_iaa_amount), 0), 2) as dj_share_iaa_amount,
|
|
|
- round(ifnull(sum(mj_share_iaa_amount), 0), 2) as mj_share_iaa_amount,
|
|
|
- round(ifnull(sum(share_iaa_amount_3), 0) + ifnull(sum(share_pay_amount), 0) - ifnull(sum(real_cost_amount), 0), 2) AS real_profit,
|
|
|
- round(ifnull(sum(dj_share_iaa_amount_3), 0) + ifnull(sum(dj_share_pay_amount), 0) - ifnull(sum(dj_real_cost_amount), 0), 2) AS dj_real_profit,
|
|
|
- round(ifnull(sum(mj_share_iaa_amount_3), 0) + ifnull(sum(mj_share_pay_amount), 0) - ifnull(sum(mj_real_cost_amount), 0), 2) AS mj_real_profit,
|
|
|
- round(ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) - ifnull(sum(cost_amount), 0), 2) AS water_profit,
|
|
|
- round(ifnull(sum(dj_iaa_amount), 0) + ifnull(sum(dj_pay_amount), 0) - ifnull(sum(dj_cost_amount), 0), 2) AS dj_water_profit,
|
|
|
- round(ifnull(sum(mj_iaa_amount), 0) + ifnull(sum(mj_pay_amount), 0) - ifnull(sum(mj_cost_amount), 0), 2) AS mj_water_profit,
|
|
|
- concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, (ifnull(sum(share_iaa_amount_3),0)+ifnull(sum(share_pay_amount),0))/sum(real_cost_amount)*100), 2), '%') AS real_roi,
|
|
|
- concat(round(if(ifnull(sum(dj_real_cost_amount),0)=0, 0, (ifnull(sum(dj_share_iaa_amount_3),0)+ifnull(sum(dj_share_pay_amount),0))/sum(dj_real_cost_amount)*100), 2), '%') AS dj_real_roi,
|
|
|
- concat(round(if(ifnull(sum(mj_real_cost_amount),0)=0, 0, (ifnull(sum(mj_share_iaa_amount_3),0)+ifnull(sum(mj_share_pay_amount),0))/sum(mj_real_cost_amount)*100), 2), '%') AS mj_real_roi,
|
|
|
- round(ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0), 2) as end_amount,
|
|
|
- round(ifnull(sum(dj_share_iaa_amount), 0) + ifnull(sum(dj_share_pay_amount), 0), 2) as dj_end_amount,
|
|
|
- round(ifnull(sum(mj_share_iaa_amount), 0) + ifnull(sum(mj_share_pay_amount), 0), 2) as mj_end_amount,
|
|
|
+ <include refid="coreIndicatorSqlPart"/>
|
|
|
+ ,
|
|
|
date_format(max(update_time), '%Y-%m-%d %H:%i:%s') as update_time
|
|
|
from
|
|
|
(select sum(cost_amount) as cost_amount,
|
|
|
@@ -655,7 +653,7 @@
|
|
|
order by rk
|
|
|
</select>
|
|
|
<select id="deptRankTotal" resultType="java.util.Map">
|
|
|
- select 0 as dept_id, '总计' as dept_name,
|
|
|
+ select 0 as dept_id, '总计' as dept_name, '总计' as rk,
|
|
|
<include refid="costAmount"/>,
|
|
|
<include refid="sharePayAmount"/>,
|
|
|
<include refid="shareIaaAmount3"/>,
|
|
|
@@ -695,30 +693,53 @@
|
|
|
</select>
|
|
|
<select id="allBusinessPushData" resultType="java.util.Map">
|
|
|
select
|
|
|
- <include refid="costAmount"/>,
|
|
|
- <include refid="realCostAmount"/>,
|
|
|
- <include refid="payAmount"/>,
|
|
|
- <include refid="iaaAmount"/>,
|
|
|
- <include refid="shareIaaAmount"/>,
|
|
|
- <include refid="realProfit"/>,
|
|
|
- <include refid="waterProfit"/>,
|
|
|
- <include refid="waterEndAmount"/>,
|
|
|
- <include refid="endAmount"/>,
|
|
|
+ round(ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0), 2) AS water_end_amount,
|
|
|
+ round(ifnull(sum(dj_iaa_amount), 0) + ifnull(sum(dj_pay_amount), 0), 2) AS dj_water_end_amount,
|
|
|
+ round(ifnull(sum(mj_iaa_amount), 0) + ifnull(sum(mj_pay_amount), 0), 2) AS mj_water_end_amount,
|
|
|
+ round(ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0), 2) as end_amount,
|
|
|
+ round(ifnull(sum(dj_share_iaa_amount), 0) + ifnull(sum(dj_share_pay_amount), 0), 2) as dj_end_amount,
|
|
|
+ round(ifnull(sum(mj_share_iaa_amount), 0) + ifnull(sum(mj_share_pay_amount), 0), 2) as mj_end_amount,
|
|
|
+ round(ifnull(sum(share_iaa_amount_3), 0) + ifnull(sum(share_pay_amount), 0) - ifnull(sum(real_cost_amount), 0), 2) AS real_profit,
|
|
|
+ round(ifnull(sum(dj_share_iaa_amount_3), 0) + ifnull(sum(dj_share_pay_amount), 0) - ifnull(sum(dj_real_cost_amount), 0), 2) AS dj_real_profit,
|
|
|
+ round(ifnull(sum(mj_share_iaa_amount_3), 0) + ifnull(sum(mj_share_pay_amount), 0) - ifnull(sum(mj_real_cost_amount), 0), 2) AS mj_real_profit,
|
|
|
date_format(max(update_at), '%Y-%m-%d %H:%i:%s') as update_time
|
|
|
from
|
|
|
- (select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
|
|
|
- from application.media_ad_report_daily
|
|
|
+ (select sum(cost_amount) as cost_amount,
|
|
|
+ sum(case t3.movie_type when 'DJ' then ifnull(cost_amount, 0) else 0 end) as dj_cost_amount,
|
|
|
+ sum(case t3.movie_type when 'MJ' then ifnull(cost_amount, 0) else 0 end) as mj_cost_amount,
|
|
|
+ sum(real_cost_amount) as real_cost_amount,
|
|
|
+ sum(case t3.movie_type when 'DJ' then ifnull(real_cost_amount, 0) else 0 end) as dj_real_cost_amount,
|
|
|
+ sum(case t3.movie_type when 'MJ' then ifnull(real_cost_amount, 0) else 0 end) as mj_real_cost_amount,
|
|
|
+ max(t1.update_time) as update_time
|
|
|
+ from application.media_ad_report_daily t1
|
|
|
+ left join tidb.deepthink.mini_app_info t2 on t1.ma_appid = t2.app_id
|
|
|
+ left join tidb.deepthink.all_moive t3 on t1.movie_id = t3.moive_id and find_in_set(t3.movie_source, t2.movie_sources) > 0
|
|
|
where stat_date = #{date}
|
|
|
) tb1,
|
|
|
- (select sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
|
|
|
- sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount,
|
|
|
- sum(share_iaa_amount_3) as share_iaa_amount_3, max(update_at) as update_at
|
|
|
- from application.user_data_report_daily
|
|
|
+ (select sum(pay_amount) as pay_amount,
|
|
|
+ sum(case t3.movie_type when 'DJ' then ifnull(pay_amount, 0) else 0 end) as dj_pay_amount,
|
|
|
+ sum(case t3.movie_type when 'MJ' then ifnull(pay_amount, 0) else 0 end) as mj_pay_amount,
|
|
|
+ sum(share_iaa_amount) as share_iaa_amount,
|
|
|
+ sum(case t3.movie_type when 'DJ' then ifnull(share_iaa_amount, 0) else 0 end) as dj_share_iaa_amount,
|
|
|
+ sum(case t3.movie_type when 'MJ' then ifnull(share_iaa_amount, 0) else 0 end) as mj_share_iaa_amount,
|
|
|
+ sum(share_iaa_amount_3) as share_iaa_amount_3,
|
|
|
+ sum(case t3.movie_type when 'DJ' then ifnull(share_iaa_amount_3, 0) else 0 end) as dj_share_iaa_amount_3,
|
|
|
+ sum(case t3.movie_type when 'MJ' then ifnull(share_iaa_amount_3, 0) else 0 end) as mj_share_iaa_amount_3,
|
|
|
+ sum(share_pay_amount) as share_pay_amount,
|
|
|
+ sum(case t3.movie_type when 'DJ' then ifnull(share_pay_amount, 0) else 0 end) as dj_share_pay_amount,
|
|
|
+ sum(case t3.movie_type when 'MJ' then ifnull(share_pay_amount, 0) else 0 end) as mj_share_pay_amount,
|
|
|
+ sum(iaa_amount) as iaa_amount,
|
|
|
+ sum(case t3.movie_type when 'DJ' then ifnull(iaa_amount, 0) else 0 end) as dj_iaa_amount,
|
|
|
+ sum(case t3.movie_type when 'MJ' then ifnull(iaa_amount, 0) else 0 end) as mj_iaa_amount, max(update_at) as update_at
|
|
|
+ from application.user_data_report_daily t1
|
|
|
+ left join tidb.deepthink.mini_app_info t2 on t1.ma_appid = t2.app_id
|
|
|
+ left join tidb.deepthink.all_moive t3 on t1.movie_id = t3.moive_id and find_in_set(t3.movie_source, t2.movie_sources) > 0
|
|
|
where stat_date = #{date}
|
|
|
+ and t2.business_line in (1,6,7,4,8,9,10)
|
|
|
) tb2
|
|
|
</select>
|
|
|
<select id="allBusinessTopMovie" resultType="java.util.Map">
|
|
|
- select tb4.ly_movie_name as movie_name, tb4.movie_project_source, tb5.dict_name as movie_project_source_name,
|
|
|
+ select tb4.ly_movie_name as movie_name, tb4.movie_project_source, tb5.dict_name as movie_project_source_name, tb4.movie_type,
|
|
|
group_concat(distinct case tb4.movie_source when 2 then '2' else '1' end) as movie_source,
|
|
|
rank() over (order by sum(share_iaa_amount)+sum(share_pay_amount) desc) as rk,
|
|
|
<include refid="endAmount"/>,
|
|
|
@@ -743,13 +764,13 @@
|
|
|
group by movie_id
|
|
|
) tb3 on tb1.movie_id=tb3.movie_id
|
|
|
left join
|
|
|
- (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_project_source, ly_movie_name from tidb.deepthink.all_moive
|
|
|
+ (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_type, movie_project_source, ly_movie_name from tidb.deepthink.all_moive
|
|
|
) tb4 on tb1.movie_id=tb4.moive_id
|
|
|
left join
|
|
|
(select dict_key, dict_name from tidb.deepthink.dt_dictionary where select_key='movie_project_source'
|
|
|
) tb5 on tb4.movie_project_source=tb5.dict_key
|
|
|
where 1=1 and tb1.movie_id!='-9999'
|
|
|
- group by tb4.ly_movie_name, tb4.movie_project_source, tb5.dict_name
|
|
|
+ group by tb4.ly_movie_name, tb4.movie_project_source, tb5.dict_name, tb4.movie_type
|
|
|
order by sum(share_iaa_amount)+sum(share_pay_amount) desc
|
|
|
limit 20
|
|
|
</select>
|