|
@@ -93,7 +93,7 @@
|
|
|
) tb2
|
|
) tb2
|
|
|
</select>
|
|
</select>
|
|
|
<select id="tmpTopMovie" resultType="java.util.Map">
|
|
<select id="tmpTopMovie" resultType="java.util.Map">
|
|
|
- select tb4.standard_movie_name as movie_name,
|
|
|
|
|
|
|
+ select tb4.standard_movie_name as movie_name, tb4.movie_project_source, tb5.dict_name as movie_project_source_name,
|
|
|
group_concat(distinct case tb4.movie_source when 2 then '2' else '1' end) as movie_source,
|
|
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,
|
|
rank() over (order by sum(iaa_amount)+sum(pay_amount) desc) as rk,
|
|
|
<include refid="endAmount"/>,
|
|
<include refid="endAmount"/>,
|
|
@@ -131,12 +131,15 @@
|
|
|
group by movie_id
|
|
group by movie_id
|
|
|
) tb3 on tb1.product_id=tb3.movie_id
|
|
) tb3 on tb1.product_id=tb3.movie_id
|
|
|
left join
|
|
left join
|
|
|
- (select moive_id, standard_movie_id, standard_movie_name, movie_source from tidb.deepthink.all_moive
|
|
|
|
|
|
|
+ (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_project_source from tidb.deepthink.all_moive
|
|
|
) tb4 on tb1.product_id=tb4.moive_id
|
|
) tb4 on tb1.product_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.product_id!='-9999'
|
|
where 1=1 and tb1.product_id!='-9999'
|
|
|
- group by tb4.standard_movie_name
|
|
|
|
|
|
|
+ group by tb4.standard_movie_name, tb4.movie_project_source, tb5.dict_name
|
|
|
order by sum(iaa_amount)+sum(pay_amount) desc
|
|
order by sum(iaa_amount)+sum(pay_amount) desc
|
|
|
- limit 10
|
|
|
|
|
|
|
+ limit 20
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="adDailyData" resultType="java.util.Map">
|
|
<select id="adDailyData" resultType="java.util.Map">
|
|
@@ -164,7 +167,7 @@
|
|
|
|
|
|
|
|
<select id="todayTopMovie" resultType="com.alibaba.fastjson.JSONObject" >
|
|
<select id="todayTopMovie" resultType="com.alibaba.fastjson.JSONObject" >
|
|
|
select
|
|
select
|
|
|
- tb4.standard_movie_name as movie_name,
|
|
|
|
|
|
|
+ tb4.standard_movie_name as movie_name, tb4.movie_project_source, tb6.dict_name as movie_project_source_name,
|
|
|
group_concat(distinct case tb4.movie_source when 2 then '2' else '1' end) as movie_source,
|
|
group_concat(distinct case tb4.movie_source when 2 then '2' else '1' end) as movie_source,
|
|
|
<include refid="endAmount"/>,
|
|
<include refid="endAmount"/>,
|
|
|
<include refid="waterEndAmount"/>,
|
|
<include refid="waterEndAmount"/>,
|
|
@@ -201,21 +204,24 @@
|
|
|
group by movie_id
|
|
group by movie_id
|
|
|
) tb3 on tb1.product_id=tb3.movie_id
|
|
) tb3 on tb1.product_id=tb3.movie_id
|
|
|
left join
|
|
left join
|
|
|
- (select moive_id, standard_movie_id, standard_movie_name, movie_source from tidb.deepthink.all_moive
|
|
|
|
|
|
|
+ (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_project_source from tidb.deepthink.all_moive
|
|
|
) tb4 on tb1.product_id=tb4.moive_id
|
|
) tb4 on tb1.product_id=tb4.moive_id
|
|
|
left join
|
|
left join
|
|
|
(select product_id, ifnull(sum(cost_amount), 0) as hour_cost_amount from application.media_product_report_hourly
|
|
(select product_id, ifnull(sum(cost_amount), 0) as hour_cost_amount from application.media_product_report_hourly
|
|
|
where stat_date=${date} and `hour`=${hour} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_type not in (2,4,6))
|
|
where stat_date=${date} and `hour`=${hour} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_type not in (2,4,6))
|
|
|
group by product_id) tb5 on tb1.product_id=tb5.product_id
|
|
group by product_id) tb5 on tb1.product_id=tb5.product_id
|
|
|
|
|
+ left join
|
|
|
|
|
+ (select dict_key, dict_name from tidb.deepthink.dt_dictionary where select_key='movie_project_source'
|
|
|
|
|
+ ) tb6 on tb4.movie_project_source=tb6.dict_key
|
|
|
where 1=1 and tb1.product_id != '-9999'
|
|
where 1=1 and tb1.product_id != '-9999'
|
|
|
- group by tb4.standard_movie_name
|
|
|
|
|
|
|
+ group by tb4.standard_movie_name, tb4.movie_project_source, tb6.dict_name
|
|
|
order by end_amount desc
|
|
order by end_amount desc
|
|
|
- limit 10
|
|
|
|
|
|
|
+ limit 20
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="optimizerCostRank" resultType="java.util.Map">
|
|
<select id="optimizerCostRank" resultType="java.util.Map">
|
|
|
- select tb1.user_id, tb4.phonenumber, tb4.nick_name, tb4.dept_id, tb5.dept_name,
|
|
|
|
|
|
|
+ select tb1.user_id, tb4.phonenumber, tb4.nick_name, tb5.dept_id, tb5.dept_name,
|
|
|
rank() over (order by sum(cost_amount) desc) as rk,
|
|
rank() over (order by sum(cost_amount) desc) as rk,
|
|
|
<include refid="costAmount"/>,
|
|
<include refid="costAmount"/>,
|
|
|
<include refid="iaaRoi"/>,
|
|
<include refid="iaaRoi"/>,
|
|
@@ -247,14 +253,20 @@
|
|
|
on tb1.advertiser_id = tb3.advertiser_id
|
|
on tb1.advertiser_id = tb3.advertiser_id
|
|
|
left join (select user_id, nick_name, phonenumber, dept_id from tidb.deepthink.sys_user) tb4
|
|
left join (select user_id, nick_name, phonenumber, dept_id from tidb.deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_id
|
|
on tb1.user_id=tb4.user_id
|
|
|
- left join (select dept_id, dept_name from tidb.deepthink.sys_dept) tb5
|
|
|
|
|
- on tb4.dept_id = tb5.dept_id
|
|
|
|
|
- group by tb1.user_id, tb4.phonenumber, tb4.nick_name, tb4.dept_id, tb5.dept_name
|
|
|
|
|
|
|
+ left join (
|
|
|
|
|
+ select dp.dept_id, dp.dept_name, ifnull(subdp.dept_id, dp.dept_id) as sub_dept_id, ifnull(subdp.dept_name, dp.dept_name) as sub_dept_name from (select * from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)) dp
|
|
|
|
|
+ right join tidb.deepthink.sys_dept subdp on dp.dept_id=subdp.parent_id
|
|
|
|
|
+ where dp.dept_id is not null
|
|
|
|
|
+ union all
|
|
|
|
|
+ select dept_id, dept_name, dept_id as sub_dept_id, dept_name as sub_dept_name from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)
|
|
|
|
|
+ ) tb5
|
|
|
|
|
+ on tb4.dept_id = tb5.sub_dept_id
|
|
|
|
|
+ group by tb1.user_id, tb4.phonenumber, tb4.nick_name, tb5.dept_id, tb5.dept_name
|
|
|
having sum(cost_amount)>1
|
|
having sum(cost_amount)>1
|
|
|
order by rk asc
|
|
order by rk asc
|
|
|
</select>
|
|
</select>
|
|
|
<select id="optimizerDateData" resultType="java.util.Map">
|
|
<select id="optimizerDateData" resultType="java.util.Map">
|
|
|
- select tb1.user_id,tb4.phonenumber,tb4.nick_name, tb4.dept_id,
|
|
|
|
|
|
|
+ select tb1.user_id,tb4.phonenumber,tb4.nick_name, tb5.dept_id,
|
|
|
<include refid="costAmount"/>,
|
|
<include refid="costAmount"/>,
|
|
|
<include refid="iaaAmount"/>,
|
|
<include refid="iaaAmount"/>,
|
|
|
<include refid="payAmount"/>,
|
|
<include refid="payAmount"/>,
|
|
@@ -275,7 +287,15 @@
|
|
|
group by advertiser_id) tb3 on tb1.advertiser_id = tb3.advertiser_id
|
|
group by advertiser_id) tb3 on tb1.advertiser_id = tb3.advertiser_id
|
|
|
left join (select user_id, nick_name, phonenumber, dept_id from tidb.deepthink.sys_user) tb4
|
|
left join (select user_id, nick_name, phonenumber, dept_id from tidb.deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_id
|
|
on tb1.user_id=tb4.user_id
|
|
|
- group by tb1.user_id, tb4.phonenumber, tb4.nick_name, tb4.dept_id
|
|
|
|
|
|
|
+ left join (
|
|
|
|
|
+ select dp.dept_id, dp.dept_name, ifnull(subdp.dept_id, dp.dept_id) as sub_dept_id, ifnull(subdp.dept_name, dp.dept_name) as sub_dept_name from (select * from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)) dp
|
|
|
|
|
+ right join tidb.deepthink.sys_dept subdp on dp.dept_id=subdp.parent_id
|
|
|
|
|
+ where dp.dept_id is not null
|
|
|
|
|
+ union all
|
|
|
|
|
+ select dept_id, dept_name, dept_id as sub_dept_id, dept_name as sub_dept_name from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)
|
|
|
|
|
+ ) tb5
|
|
|
|
|
+ on tb4.dept_id = tb5.sub_dept_id
|
|
|
|
|
+ group by tb1.user_id, tb4.phonenumber, tb4.nick_name, tb5.dept_id
|
|
|
having sum(cost_amount)>0
|
|
having sum(cost_amount)>0
|
|
|
</select>
|
|
</select>
|
|
|
<select id="optimizerHourData" resultType="java.util.Map">
|
|
<select id="optimizerHourData" resultType="java.util.Map">
|
|
@@ -305,7 +325,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="deptCostRank" resultType="java.util.Map">
|
|
<select id="deptCostRank" resultType="java.util.Map">
|
|
|
- select tb4.dept_id, tb5.dept_name,
|
|
|
|
|
|
|
+ select tb5.dept_id, tb5.dept_name,
|
|
|
rank() over (order by sum(cost_amount) desc) as rk,
|
|
rank() over (order by sum(cost_amount) desc) as rk,
|
|
|
<include refid="costAmount"/>,
|
|
<include refid="costAmount"/>,
|
|
|
ifnull(sum(cost_amount_hour), 0) as cost_amount_hour
|
|
ifnull(sum(cost_amount_hour), 0) as cost_amount_hour
|
|
@@ -321,9 +341,15 @@
|
|
|
on tb1.advertiser_id = tb3.advertiser_id
|
|
on tb1.advertiser_id = tb3.advertiser_id
|
|
|
left join (select user_id, nick_name, phonenumber, dept_id from tidb.deepthink.sys_user) tb4
|
|
left join (select user_id, nick_name, phonenumber, dept_id from tidb.deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_id
|
|
on tb1.user_id=tb4.user_id
|
|
|
- left join (select dept_id, dept_name from tidb.deepthink.sys_dept) tb5
|
|
|
|
|
- on tb4.dept_id = tb5.dept_id
|
|
|
|
|
- group by tb4.dept_id, tb5.dept_name
|
|
|
|
|
|
|
+ left join (
|
|
|
|
|
+ select dp.dept_id, dp.dept_name, ifnull(subdp.dept_id, dp.dept_id) as sub_dept_id, ifnull(subdp.dept_name, dp.dept_name) as sub_dept_name from (select * from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)) dp
|
|
|
|
|
+ right join tidb.deepthink.sys_dept subdp on dp.dept_id=subdp.parent_id
|
|
|
|
|
+ where dp.dept_id is not null
|
|
|
|
|
+ union all
|
|
|
|
|
+ select dept_id, dept_name, dept_id as sub_dept_id, dept_name as sub_dept_name from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)
|
|
|
|
|
+ ) tb5
|
|
|
|
|
+ on tb4.dept_id = tb5.sub_dept_id
|
|
|
|
|
+ group by tb5.dept_id, tb5.dept_name
|
|
|
having sum(cost_amount)>1
|
|
having sum(cost_amount)>1
|
|
|
order by rk asc
|
|
order by rk asc
|
|
|
limit 10
|
|
limit 10
|
|
@@ -393,7 +419,7 @@
|
|
|
order by tb2.user_id
|
|
order by tb2.user_id
|
|
|
</select>
|
|
</select>
|
|
|
<select id="deptRank2" resultType="java.util.Map">
|
|
<select id="deptRank2" resultType="java.util.Map">
|
|
|
- select tb4.dept_id, tb5.dept_name,
|
|
|
|
|
|
|
+ select tb5.dept_id, tb5.dept_name,
|
|
|
rank() over (order by sum(cost_amount) desc) as rk,
|
|
rank() over (order by sum(cost_amount) desc) as rk,
|
|
|
<include refid="costAmount"/>,
|
|
<include refid="costAmount"/>,
|
|
|
<include refid="iaaRoi"/>,
|
|
<include refid="iaaRoi"/>,
|
|
@@ -425,9 +451,15 @@
|
|
|
on tb1.advertiser_id = tb3.advertiser_id
|
|
on tb1.advertiser_id = tb3.advertiser_id
|
|
|
left join (select user_id, nick_name, phonenumber, dept_id from tidb.deepthink.sys_user) tb4
|
|
left join (select user_id, nick_name, phonenumber, dept_id from tidb.deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_id
|
|
on tb1.user_id=tb4.user_id
|
|
|
- left join (select dept_id, dept_name from tidb.deepthink.sys_dept) tb5
|
|
|
|
|
- on tb4.dept_id = tb5.dept_id
|
|
|
|
|
- group by tb4.dept_id, tb5.dept_name
|
|
|
|
|
|
|
+ left join (
|
|
|
|
|
+ select dp.dept_id, dp.dept_name, ifnull(subdp.dept_id, dp.dept_id) as sub_dept_id, ifnull(subdp.dept_name, dp.dept_name) as sub_dept_name from (select * from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)) dp
|
|
|
|
|
+ right join tidb.deepthink.sys_dept subdp on dp.dept_id=subdp.parent_id
|
|
|
|
|
+ where dp.dept_id is not null
|
|
|
|
|
+ union all
|
|
|
|
|
+ select dept_id, dept_name, dept_id as sub_dept_id, dept_name as sub_dept_name from tidb.deepthink.sys_dept where parent_id in (select dept_id from tidb.deepthink.sys_dept where parent_id=300)
|
|
|
|
|
+ ) tb5
|
|
|
|
|
+ on tb4.dept_id = tb5.sub_dept_id
|
|
|
|
|
+ group by tb5.dept_id, tb5.dept_name
|
|
|
having sum(cost_amount)>1
|
|
having sum(cost_amount)>1
|
|
|
order by rk
|
|
order by rk
|
|
|
</select>
|
|
</select>
|
|
@@ -484,7 +516,8 @@
|
|
|
) tb2
|
|
) tb2
|
|
|
</select>
|
|
</select>
|
|
|
<select id="allBusinessTopMovie" resultType="java.util.Map">
|
|
<select id="allBusinessTopMovie" resultType="java.util.Map">
|
|
|
- select tb4.standard_movie_name as movie_name, group_concat(distinct case tb4.movie_source when 2 then '2' else '1' end) as movie_source,
|
|
|
|
|
|
|
+ select tb4.standard_movie_name as movie_name, tb4.movie_project_source, tb5.dict_name as movie_project_source_name,
|
|
|
|
|
+ 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,
|
|
rank() over (order by sum(share_iaa_amount)+sum(share_pay_amount) desc) as rk,
|
|
|
<include refid="endAmount"/>,
|
|
<include refid="endAmount"/>,
|
|
|
<include refid="costAmount"/>
|
|
<include refid="costAmount"/>
|
|
@@ -507,12 +540,15 @@
|
|
|
group by movie_id
|
|
group by movie_id
|
|
|
) tb3 on tb1.product_id=tb3.movie_id
|
|
) tb3 on tb1.product_id=tb3.movie_id
|
|
|
left join
|
|
left join
|
|
|
- (select moive_id, standard_movie_id, standard_movie_name, movie_source from tidb.deepthink.all_moive
|
|
|
|
|
|
|
+ (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_project_source from tidb.deepthink.all_moive
|
|
|
) tb4 on tb1.product_id=tb4.moive_id
|
|
) tb4 on tb1.product_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.product_id!='-9999'
|
|
where 1=1 and tb1.product_id!='-9999'
|
|
|
- group by tb4.standard_movie_name
|
|
|
|
|
|
|
+ group by tb4.standard_movie_name, tb4.movie_project_source, tb5.dict_name
|
|
|
order by sum(share_iaa_amount)+sum(share_pay_amount) desc
|
|
order by sum(share_iaa_amount)+sum(share_pay_amount) desc
|
|
|
- limit 10
|
|
|
|
|
|
|
+ limit 20
|
|
|
</select>
|
|
</select>
|
|
|
<select id="businessTypeData" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="businessTypeData" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
select
|
|
select
|