|
@@ -109,6 +109,7 @@
|
|
|
IFNULL( t6.num, 0 ) AS 'num',
|
|
|
IFNULL(concat(round((sum(cost) - t7.costs) / t7.costs * 100, 2), '%'), '-') as 'rio',
|
|
|
IFNULL(t8.unitNum,0) as 'unitNum',
|
|
|
+ IFNULL(t8.projectNum,0) as 'projectNum',
|
|
|
'-' AS 'ssAd',
|
|
|
'-' AS 'sxhAd',
|
|
|
'-' AS 'lmAd',
|
|
@@ -148,7 +149,8 @@
|
|
|
</if>
|
|
|
) t7 ON t1.project_id = t7.project_id
|
|
|
LEFT JOIN (
|
|
|
- SELECT project_id , SUM(new_ad_num) as 'unitNum' FROM application.app_bytedance_account_base_info_d
|
|
|
+ SELECT project_id , SUM(new_ad_num) as 'unitNum',SUM(new_cpd_project_num) as 'projectNum' FROM
|
|
|
+ application.app_bytedance_account_base_info_d
|
|
|
WHERE stat_date =DATE_FORMAT(DATE_SUB(#{startTime}, INTERVAL 1 DAY ), '%Y%m%d')
|
|
|
AND company_id in ('5e46b5dea3d740eeb8ff1a2895015a4b' , 'd57fecdcf7a94d009736d9c850731582')
|
|
|
GROUP BY project_id
|
|
@@ -212,6 +214,7 @@
|
|
|
IFNULL(t6.num, 0 ) AS 'num',
|
|
|
'-' as 'rio',
|
|
|
IFNULL(t8.unitNum,0) as 'unitNum',
|
|
|
+ IFNULL(t8.projectNum,0) as 'projectNum',
|
|
|
'-' AS 'ssAd',
|
|
|
'-' AS 'sxhAd',
|
|
|
'-' AS 'lmAd',
|
|
@@ -239,7 +242,8 @@
|
|
|
</if>
|
|
|
) t6 ON t1.project_id = t6.project_id
|
|
|
LEFT JOIN (
|
|
|
- SELECT project_id , SUM(new_ad_num) as 'unitNum' FROM application.app_bytedance_account_base_info_d
|
|
|
+ SELECT project_id , SUM(new_ad_num) as 'unitNum',SUM(new_cpd_project_num) as 'projectNum' FROM
|
|
|
+ application.app_bytedance_account_base_info_d
|
|
|
WHERE stat_date >= #{startTime}
|
|
|
AND stat_date <= #{endTime}
|
|
|
AND company_id in ('5e46b5dea3d740eeb8ff1a2895015a4b' , 'd57fecdcf7a94d009736d9c850731582')
|
|
@@ -330,7 +334,8 @@
|
|
|
COUNT(DISTINCT t.project_id) 'projectNum',
|
|
|
SUM(t.cost) 'totalCost',
|
|
|
t.user_id as 'userId',
|
|
|
- t2.realname as 'userName' ,
|
|
|
+ t2.realname as 'userName',
|
|
|
+ IFNULL(t4.projectNum,0) as 'projectNum',
|
|
|
CONCAT(CAST(IFNULL(ROUND((SUM(t.cost) - t3.lastCost) / t3.lastCost * 100, 2), 0) AS CHAR), '%') AS 'rate',
|
|
|
'-' as 'newUnitNum',
|
|
|
'-' as 'newCampaignNum'
|
|
@@ -355,6 +360,12 @@
|
|
|
</if>
|
|
|
GROUP BY d.user_id
|
|
|
) t3 ON t.user_id = t3.user_id
|
|
|
+ left join (
|
|
|
+ SELECT user_id, SUM(new_cpd_project_num) as 'projectNum' FROM
|
|
|
+ app_bytedance_account_base_info_d
|
|
|
+ WHERE stat_date = #{startDate}
|
|
|
+ GROUP BY user_id
|
|
|
+ ) t4 ON t4.user_id = t.user_id
|
|
|
WHERE t.cost > 0
|
|
|
AND hour <= #{hour}
|
|
|
AND t.stat_datetime >= #{startDate}
|
|
@@ -375,10 +386,11 @@
|
|
|
COUNT(DISTINCT t.project_id) 'projectNum',
|
|
|
SUM(t.cost) 'totalCost',
|
|
|
t.user_id as 'userId',
|
|
|
- t2.realname as 'userName' ,
|
|
|
+ t2.realname as 'userName',
|
|
|
CONCAT(CAST(IFNULL(ROUND((SUM(t.cost) - t3.lastCost) / t3.lastCost * 100, 2), 0) AS CHAR), '%') AS 'rate',
|
|
|
IFNULL(t4.newUnitNum,'-') as 'newUnitNum',
|
|
|
- IFNULL(t4.newCampaignNum,'-') as 'newCampaignNum'
|
|
|
+ IFNULL(t4.newCampaignNum,'-') as 'newCampaignNum',
|
|
|
+ IFNULL(t4.projectNum,0) as 'projectNum'
|
|
|
FROM `application`.bytedance_advertiser_report_daily_dw t
|
|
|
LEFT JOIN `jeecg-boot`.ctop_user_allocation t1 ON t.account_id = t1.account_id
|
|
|
LEFT JOIN `jeecg-boot`.sys_user t2 ON t.user_id = t2.id
|
|
@@ -402,7 +414,8 @@
|
|
|
LEFT JOIN (
|
|
|
SELECT user_id,
|
|
|
IFNULL(SUM(new_ad_num),0) + IFNULL(SUM(trust_unit_num),0) as 'newUnitNum',
|
|
|
- IFNULL(SUM(new_campaign_num),0) as 'newCampaignNum'
|
|
|
+ IFNULL(SUM(new_campaign_num),0) as 'newCampaignNum',
|
|
|
+ SUM(new_cpd_project_num) as 'projectNum'
|
|
|
FROM application.app_bytedance_account_base_info_d
|
|
|
WHERE stat_date >= #{startDate}
|
|
|
AND stat_date <= #{endDate}
|
|
@@ -439,7 +452,8 @@
|
|
|
t3.lastCost,
|
|
|
CONCAT( CAST( IFNULL( ROUND(( SUM( t1.totalCost ) - t3.lastCost )/ t3.lastCost * 100, 2 ), 0 ) AS CHAR ), '%' )
|
|
|
AS 'yearOnYearCost',
|
|
|
- '-' as 'unitNum'
|
|
|
+ t4.unitNum,
|
|
|
+ t4.projectNum
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
@@ -486,7 +500,20 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
) t3 ON 1 = 1
|
|
|
-
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT IFNULL(SUM(new_ad_num),'-') as 'unitNum',
|
|
|
+ IFNULL(SUM(new_cpd_project_num),0) as 'projectNum'
|
|
|
+ FROM application.app_bytedance_account_base_info_d
|
|
|
+ WHERE stat_date >= #{startDate}
|
|
|
+ AND stat_date <= #{endDate}
|
|
|
+ <if test='list!=null and list.size()>0'>
|
|
|
+ AND user_id IN
|
|
|
+ <foreach collection="list" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ ) t4 ON 1=1
|
|
|
</select>
|
|
|
|
|
|
<select id="getToutiaoOperateGroupInfo" resultType="com.alibaba.fastjson.JSONObject">
|
|
@@ -498,7 +525,8 @@
|
|
|
t3.lastCost,
|
|
|
CONCAT( CAST( IFNULL( ROUND(( SUM( t1.totalCost ) - t3.lastCost )/ t3.lastCost * 100, 2 ), 0 ) AS CHAR ), '%' )
|
|
|
AS 'yearOnYearCost',
|
|
|
- t4.unitNum
|
|
|
+ t4.unitNum,
|
|
|
+ t4.projectNum
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
@@ -544,7 +572,8 @@
|
|
|
</if>
|
|
|
) t3 ON 1 = 1
|
|
|
LEFT JOIN (
|
|
|
- SELECT IFNULL(SUM(new_ad_num),'-') as 'unitNum'
|
|
|
+ SELECT IFNULL(SUM(new_ad_num),'-') as 'unitNum',
|
|
|
+ IFNULL(SUM(new_cpd_project_num),0) as 'projectNum'
|
|
|
FROM application.app_bytedance_account_base_info_d
|
|
|
WHERE stat_date >= #{startDate}
|
|
|
AND stat_date <= #{endDate}
|