|
@@ -73,7 +73,7 @@
|
|
|
t2.operator_id as 'operatorId',
|
|
|
t2.operator_name as 'operatorName',
|
|
|
SUM(cost_total) as 'costTotal',
|
|
|
- IFNULL(ROUND(SUM(t1.t0_gmv) / SUM(cost_total), 2), 0) as 'roi'
|
|
|
+ IFNULL(ROUND(SUM(t1.gmv) / SUM(cost_total), 2), 0) as 'roi'
|
|
|
FROM kuaishou_live_account_report_hourly_dw t1
|
|
|
LEFT JOIN `kuaishou_project` t2 ON t1.project_id = t2.id
|
|
|
WHERE report_date = #{today}
|
|
@@ -86,13 +86,14 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
GROUP BY t1.project_id
|
|
|
+ HAVING SUM(cost_total)>0
|
|
|
) t1
|
|
|
LEFT JOIN
|
|
|
(
|
|
|
SELECT
|
|
|
t1.project_id as 'projectId',
|
|
|
SUM(cost_total) as 'costTotal',
|
|
|
- IFNULL(ROUND(SUM(t1.t0_gmv) / SUM(cost_total), 2), 0) as 'roi'
|
|
|
+ IFNULL(ROUND(SUM(t1.gmv) / SUM(cost_total), 2), 0) as 'roi'
|
|
|
FROM kuaishou_live_account_report_hourly_dw t1
|
|
|
WHERE report_date = #{yesterday}
|
|
|
AND hour <= #{hour}
|
|
@@ -119,7 +120,7 @@
|
|
|
t2.operator_id as 'operatorId',
|
|
|
t2.operator_name as 'operatorName',
|
|
|
SUM(cost_total) as 'costTotal',
|
|
|
- IFNULL(ROUND(SUM(t1.t0_gmv) / SUM(cost_total), 2), 0) as 'roi'
|
|
|
+ IFNULL(ROUND(SUM(t1.gmv) / SUM(cost_total), 2), 0) as 'roi'
|
|
|
FROM kuaishou_live_account_report_daily_dw t1
|
|
|
LEFT JOIN `kuaishou_project` t2 ON t1.project_id = t2.id
|
|
|
WHERE report_date >= #{startDate}
|
|
@@ -132,13 +133,14 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
GROUP BY t1.project_id
|
|
|
+ HAVING SUM(cost_total)>0
|
|
|
) t1
|
|
|
LEFT JOIN
|
|
|
(
|
|
|
SELECT
|
|
|
project_id as 'projectId',
|
|
|
SUM(cost_total) as 'costTotal',
|
|
|
- IFNULL(ROUND(SUM(t0_gmv) / SUM(cost_total), 2), 0) as 'roi'
|
|
|
+ IFNULL(ROUND(SUM(gmv) / SUM(cost_total), 2), 0) as 'roi'
|
|
|
FROM kuaishou_live_account_report_daily_dw
|
|
|
WHERE report_date >=#{lastStart}
|
|
|
AND report_date <=#{lastEnd}
|
|
@@ -243,13 +245,14 @@
|
|
|
t2.operator_id AS 'userId',
|
|
|
t2.operator_name AS 'userName',
|
|
|
SUM(cost_total) AS 'costTotal',
|
|
|
- count( DISTINCT CASE WHEN t1.cost_total > 0 THEN t1.account_id ELSE 0 END ) AS 'accountNum',
|
|
|
- count( DISTINCT CASE WHEN t1.cost_total > 0 THEN t1.project_id ELSE 0 END ) AS 'projectNum'
|
|
|
+ count( DISTINCT t1.account_id ) AS 'accountNum',
|
|
|
+ count( DISTINCT t1.project_id) AS 'projectNum'
|
|
|
FROM
|
|
|
kuaishou_live_account_report_hourly_dw t1
|
|
|
LEFT JOIN kuaishou_account t2 ON t1.account_id = t2.account_id
|
|
|
WHERE report_date = #{today}
|
|
|
AND hour <= #{hour}
|
|
|
+ AND t1.cost_total >0
|
|
|
AND t2.account_type = 1
|
|
|
<if test="userList != null and userList.size() > 0 ">
|
|
|
AND t1.user_id IN
|
|
@@ -291,13 +294,14 @@
|
|
|
t2.operator_id AS 'userId',
|
|
|
t2.operator_name AS 'userName',
|
|
|
SUM(cost_total) AS 'costTotal',
|
|
|
- count( DISTINCT CASE WHEN t1.cost_total > 0 THEN t1.account_id ELSE 0 END ) AS 'accountNum',
|
|
|
- count( DISTINCT CASE WHEN t1.cost_total > 0 THEN t1.project_id ELSE 0 END ) AS 'projectNum'
|
|
|
+ count( DISTINCT t1.account_id ) AS 'accountNum',
|
|
|
+ count( DISTINCT t1.project_id) AS 'projectNum'
|
|
|
FROM
|
|
|
kuaishou_live_account_report_daily_dw t1
|
|
|
LEFT JOIN kuaishou_account t2 ON t1.account_id = t2.account_id
|
|
|
WHERE report_date >= #{startDate}
|
|
|
AND report_date <= #{endDate}
|
|
|
+ AND t1.cost_total >0
|
|
|
AND t2.account_type = 1
|
|
|
<if test="userList != null and userList.size() > 0 ">
|
|
|
AND user_id IN
|
|
@@ -339,14 +343,15 @@
|
|
|
SELECT
|
|
|
'汇总' AS 'userName',
|
|
|
SUM(cost_total) AS 'costTotal',
|
|
|
- count( DISTINCT CASE WHEN t1.cost_total > 0 THEN t1.account_id ELSE 0 END ) AS 'accountNum',
|
|
|
- count( DISTINCT CASE WHEN t1.cost_total > 0 THEN t1.project_id ELSE 0 END ) AS 'projectNum'
|
|
|
+ count( DISTINCT t1.account_id ) AS 'accountNum',
|
|
|
+ count( DISTINCT t1.project_id) AS 'projectNum'
|
|
|
FROM
|
|
|
kuaishou_live_account_report_hourly_dw t1
|
|
|
LEFT JOIN kuaishou_account t2 ON t1.account_id = t2.account_id
|
|
|
WHERE report_date = #{today}
|
|
|
AND hour <= #{hour}
|
|
|
AND t2.account_type = 1
|
|
|
+ AND t1.cost_total >0
|
|
|
<if test="userList != null and userList.size() > 0 ">
|
|
|
AND t1.user_id IN
|
|
|
<foreach collection="userList" item="userId" open="(" separator="," close=")">
|
|
@@ -380,14 +385,15 @@
|
|
|
SELECT
|
|
|
'汇总' AS 'userName',
|
|
|
SUM(cost_total) AS 'costTotal',
|
|
|
- count( DISTINCT CASE WHEN t1.cost_total > 0 THEN t1.account_id ELSE 0 END ) AS 'accountNum',
|
|
|
- count( DISTINCT CASE WHEN t1.cost_total > 0 THEN t1.project_id ELSE 0 END ) AS 'projectNum'
|
|
|
+ count( DISTINCT t1.account_id ) AS 'accountNum',
|
|
|
+ count( DISTINCT t1.project_id) AS 'projectNum'
|
|
|
FROM
|
|
|
kuaishou_live_account_report_daily_dw t1
|
|
|
LEFT JOIN kuaishou_account t2 ON t1.account_id = t2.account_id
|
|
|
WHERE report_date >= #{startDate}
|
|
|
AND report_date <= #{endDate}
|
|
|
AND t2.account_type = 1
|
|
|
+ AND t1.cost_total >0
|
|
|
<if test="userList != null and userList.size() > 0 ">
|
|
|
AND user_id IN
|
|
|
<foreach collection="userList" item="userId" open="(" separator="," close=")">
|
|
@@ -468,8 +474,8 @@
|
|
|
(
|
|
|
SELECT
|
|
|
IFNULL(SUM(cost_total),0)AS'costTotal',
|
|
|
- IFNULL(SUM(t0_gmv),0)AS't0Gmv',
|
|
|
- IFNULL(SUM(t0_gmv)/SUM(cost_total),0)AS't0Roi',
|
|
|
+ IFNULL(SUM(gmv),0)AS't0Gmv',
|
|
|
+ IFNULL(SUM(gmv)/SUM(cost_total),0)AS't0Roi',
|
|
|
IFNULL(SUM(cost_total)/SUM(standard_live_played_started),0)AS'viewCost',
|
|
|
IFNULL(SUM(merchant_reco_fans),0)AS'upFans',
|
|
|
IFNULL(SUM(cost_total)/SUM(t0_order_cnt),0)AS'orderCost'
|
|
@@ -489,8 +495,8 @@
|
|
|
(
|
|
|
SELECT
|
|
|
IFNULL(SUM(cost_total),0)AS'costTotal',
|
|
|
- IFNULL(SUM(t0_gmv),0)AS't0Gmv',
|
|
|
- IFNULL(SUM(t0_gmv)/SUM(cost_total),0)AS't0Roi',
|
|
|
+ IFNULL(SUM(gmv),0)AS't0Gmv',
|
|
|
+ IFNULL(SUM(gmv)/SUM(cost_total),0)AS't0Roi',
|
|
|
IFNULL(SUM(cost_total)/SUM(standard_live_played_started),0)AS'viewCost',
|
|
|
IFNULL(SUM(merchant_reco_fans),0)AS'upFans',
|
|
|
IFNULL(SUM(cost_total)/SUM(t0_order_cnt),0)AS'orderCost'
|
|
@@ -525,8 +531,8 @@
|
|
|
(
|
|
|
SELECT
|
|
|
IFNULL(SUM(cost_total),0)AS'costTotal',
|
|
|
- IFNULL(SUM(t0_gmv),0)AS't0Gmv',
|
|
|
- IFNULL(SUM(t0_gmv)/SUM(cost_total),0)AS't0Roi',
|
|
|
+ IFNULL(SUM(gmv),0)AS't0Gmv',
|
|
|
+ IFNULL(SUM(gmv)/SUM(cost_total),0)AS't0Roi',
|
|
|
IFNULL(SUM(cost_total)/SUM(standard_live_played_started),0)AS'viewCost',
|
|
|
IFNULL(SUM(merchant_reco_fans),0)AS'upFans',
|
|
|
IFNULL(SUM(cost_total)/SUM(t0_order_cnt),0)AS'orderCost'
|
|
@@ -546,8 +552,8 @@
|
|
|
(
|
|
|
SELECT
|
|
|
IFNULL(SUM(cost_total),0)AS'costTotal',
|
|
|
- IFNULL(SUM(t0_gmv),0)AS't0Gmv',
|
|
|
- IFNULL(SUM(t0_gmv)/SUM(cost_total),0)AS't0Roi',
|
|
|
+ IFNULL(SUM(gmv),0)AS't0Gmv',
|
|
|
+ IFNULL(SUM(gmv)/SUM(cost_total),0)AS't0Roi',
|
|
|
IFNULL(SUM(cost_total)/SUM(standard_live_played_started),0)AS'viewCost',
|
|
|
IFNULL(SUM(merchant_reco_fans),0)AS'upFans',
|
|
|
IFNULL(SUM(cost_total)/SUM(t0_order_cnt),0)AS'orderCost'
|