|
|
@@ -364,11 +364,11 @@
|
|
|
left join (select user_id, nick_name, phonenumber, dept_id, status, del_flag from tidb.deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_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
|
|
|
+ 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 (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)
|
|
|
+ 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 (300)
|
|
|
) tb5
|
|
|
on tb4.dept_id = tb5.sub_dept_id
|
|
|
where tb1.user_id is not null and (tb4.nick_name not like '%IAP%' and tb4.nick_name not like '%IAA%')
|
|
|
@@ -406,7 +406,7 @@
|
|
|
from application.media_ad_report_daily t1
|
|
|
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 business_line in (1,6,7,4,8,9,10)
|
|
|
+ where stat_date=${date} and t2.business_line in (1,6,7,4,8,9,10)
|
|
|
group by advertiser_id
|
|
|
)subtb2
|
|
|
group by advertiser_id
|
|
|
@@ -422,11 +422,11 @@
|
|
|
left join (select user_id, nick_name, phonenumber, dept_id, status, del_flag from tidb.deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_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
|
|
|
+ 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 (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)
|
|
|
+ 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 (300)
|
|
|
) tb5
|
|
|
on tb4.dept_id = tb5.sub_dept_id
|
|
|
where tb1.user_id is not null and (tb4.nick_name not like '%IAP%' and tb4.nick_name not like '%IAA%')
|
|
|
@@ -458,16 +458,18 @@
|
|
|
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))
|
|
|
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, status, del_flag from tidb.deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_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
|
|
|
+ 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 (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)
|
|
|
+ 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 (300)
|
|
|
) tb5
|
|
|
on tb4.dept_id = tb5.sub_dept_id
|
|
|
+ where tb1.user_id is not null and (tb4.nick_name not like '%IAP%' and tb4.nick_name not like '%IAA%')
|
|
|
+ and tb4.status = 0 and tb4.del_flag = 0
|
|
|
group by tb1.user_id, tb4.phonenumber, tb4.nick_name, tb5.dept_id
|
|
|
having sum(cost_amount)>0
|
|
|
</select>
|
|
|
@@ -491,8 +493,10 @@
|
|
|
from application.user_data_report_hourly
|
|
|
where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
|
|
|
group by advertiser_id) tb3 on tb1.advertiser_id = tb3.advertiser_id
|
|
|
- left join (select user_id, nick_name, phonenumber from tidb.deepthink.sys_user) tb4
|
|
|
+ left join (select user_id, nick_name, phonenumber, status, del_flag from tidb.deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_id
|
|
|
+ where tb1.user_id is not null and (tb4.nick_name not like '%IAP%' and tb4.nick_name not like '%IAA%')
|
|
|
+ and tb4.status = 0 and tb4.del_flag = 0
|
|
|
group by tb1.user_id, tb4.phonenumber
|
|
|
</select>
|
|
|
|
|
|
@@ -513,7 +517,7 @@
|
|
|
from application.media_ad_report_daily t1
|
|
|
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 ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
|
|
|
+ where stat_date=#{date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where t2.business_line in (1,6,7,4,8,9,10))
|
|
|
group by advertiser_id) tb2
|
|
|
on tb1.advertiser_id = tb2.advertiser_id
|
|
|
left join (select advertiser_id, sum(cost_amount) as cost_amount_hour
|
|
|
@@ -523,11 +527,11 @@
|
|
|
left join (select user_id, nick_name, phonenumber, dept_id from tidb.deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_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
|
|
|
+ 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 (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)
|
|
|
+ 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 (300)
|
|
|
) tb5
|
|
|
on tb4.dept_id = tb5.sub_dept_id
|
|
|
group by tb5.dept_id, tb5.dept_name
|
|
|
@@ -629,17 +633,17 @@
|
|
|
left join (select user_id, nick_name, phonenumber, dept_id from tidb.deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_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
|
|
|
+ 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 (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)
|
|
|
+ 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 (300)
|
|
|
) tb5
|
|
|
on tb4.dept_id = tb5.sub_dept_id
|
|
|
where tb4.user_id is not null
|
|
|
</sql>
|
|
|
<select id="deptRank2" resultType="java.util.Map">
|
|
|
- select tb5.dept_id, tb5.dept_name,
|
|
|
+ select tb5.sub_dept_id as dept_id, concat(tb5.dept_name, '-', tb5.sub_dept_name) as dept_name,
|
|
|
rank() over (order by sum(cost_amount) desc) as rk,
|
|
|
<include refid="costAmount"/>,
|
|
|
<include refid="sharePayAmount"/>,
|
|
|
@@ -648,7 +652,7 @@
|
|
|
<include refid="iapRoi"/>
|
|
|
from
|
|
|
<include refid="deptRankSqlPart"/>
|
|
|
- group by tb5.dept_id, tb5.dept_name
|
|
|
+ group by tb5.sub_dept_id, tb5.sub_dept_name, tb5.dept_name
|
|
|
having sum(cost_amount)>1
|
|
|
order by rk
|
|
|
</select>
|