|
@@ -5,7 +5,7 @@
|
|
|
<!-- 素材产出占比 快手 -->
|
|
|
<select id="getMeterialProduceRateKuaiShou" resultType="java.util.LinkedHashMap">
|
|
|
SELECT t.* ,
|
|
|
- CONCAT(ROUND(t.meterialNum / t.total,2) ,'%')as rate
|
|
|
+ CONCAT(ROUND(t.meterialNum / t.total * 100,2) ,'%')as rate
|
|
|
from (
|
|
|
SELECT
|
|
|
COUNT( material_id ) meterialNum ,
|
|
@@ -19,7 +19,7 @@
|
|
|
end area,
|
|
|
company_name as companyName,
|
|
|
(SELECT COUNT(material_id) as num
|
|
|
- FROM app_kuaishou_material_info
|
|
|
+ FROM application.app_kuaishou_material_info
|
|
|
<where>
|
|
|
<if test="startTime !=null and startTime != ''">
|
|
|
AND media_time >= #{startTime}
|
|
@@ -30,7 +30,7 @@
|
|
|
</where>
|
|
|
) as total
|
|
|
FROM
|
|
|
- app_kuaishou_material_info
|
|
|
+ application.app_kuaishou_material_info
|
|
|
<where>
|
|
|
<if test="startTime !=null and startTime != ''">
|
|
|
AND media_time >= #{startTime}
|
|
@@ -62,7 +62,7 @@
|
|
|
end area,
|
|
|
company_name as companyName,
|
|
|
(SELECT COUNT(material_id) as num
|
|
|
- FROM app_bytedance_material_info
|
|
|
+ FROM application.app_bytedance_material_info
|
|
|
<where>
|
|
|
<if test="startTime !=null and startTime != ''">
|
|
|
AND media_time >= #{startTime}
|
|
@@ -73,7 +73,7 @@
|
|
|
</where>
|
|
|
) as total
|
|
|
FROM
|
|
|
- app_bytedance_material_info
|
|
|
+ application.app_bytedance_material_info
|
|
|
<where>
|
|
|
<if test="startTime !=null and startTime != ''">
|
|
|
AND media_time >= #{startTime}
|
|
@@ -84,7 +84,528 @@
|
|
|
</where>
|
|
|
GROUP BY
|
|
|
company_id) t
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 分公司素材消耗 头条 -->
|
|
|
+ <select id="getCompanyMeterialConsumeBytedance" resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT
|
|
|
+ t.*,
|
|
|
+ SUM(t.cost) tcost
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ company_id,
|
|
|
+ company_name,
|
|
|
+ SUM(cost) cost,
|
|
|
+ CASE
|
|
|
+ company_id
|
|
|
+ WHEN 'd57fecdcf7a94d009736d9c850731582' THEN '华北'
|
|
|
+ WHEN '6608ed13c0dd42de93c790dbdf124234' THEN '华南'
|
|
|
+ WHEN '4b10089775c040119e139087517aed88' THEN '华东'
|
|
|
+ WHEN '3321d5893bcd430cab1238a99bc7db11' THEN '石家庄'
|
|
|
+ WHEN '5e46b5dea3d740eeb8ff1a2895015a4b' THEN '骄阳'
|
|
|
+ WHEN '1648c7ceb4d449a9a13fbed7a8d9976c' THEN '杭州'
|
|
|
+ ELSE '其他'
|
|
|
+ END area,
|
|
|
+ ( SELECT SUM(cost) FROM application.bytedance_material_video_report_daily_dw
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND stat_datetime >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND stat_datetime <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) totalCost
|
|
|
+ FROM
|
|
|
+ application.bytedance_material_video_report_daily_dw
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND stat_datetime >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND stat_datetime <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ company_id ) t
|
|
|
+ GROUP BY
|
|
|
+ t.area;
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 分公司素材消耗 快手 -->
|
|
|
+ <select id="getCompanyMeterialConsumeKuaishou" resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT t.*,
|
|
|
+ SUM(t.cost) as tcost
|
|
|
+ from (
|
|
|
+ SELECT company_id,company_name,SUM(charge) cost,
|
|
|
+ CASE company_id
|
|
|
+ WHEN 'd57fecdcf7a94d009736d9c850731582' then '华北'
|
|
|
+ WHEN '6608ed13c0dd42de93c790dbdf124234' then '华南'
|
|
|
+ WHEN '4b10089775c040119e139087517aed88' then '华东'
|
|
|
+ WHEN '3321d5893bcd430cab1238a99bc7db11' then '石家庄'
|
|
|
+ WHEN '5e46b5dea3d740eeb8ff1a2895015a4b' then '骄阳'
|
|
|
+ WHEN '1648c7ceb4d449a9a13fbed7a8d9976c' then '杭州'
|
|
|
+ else '其他'
|
|
|
+ end area,
|
|
|
+ (SELECT SUM(charge) from application.kuaishou_material_video_report_daily_dw
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND stat_date >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND stat_date <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>) totalCost
|
|
|
+ FROM
|
|
|
+ application.kuaishou_material_video_report_daily_dw
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND stat_date >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND stat_date <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ company_id
|
|
|
+ ) t
|
|
|
+ GROUP BY t.area;
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 素材相关===素材使用率===头条 -->
|
|
|
+ <select id="getMeterialUseRateBytedanc" resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT t.*,
|
|
|
+ CONCAT(ROUND(t.bytedanceTatol / t.total * 100,2) ,'%') as useRate
|
|
|
+ from (
|
|
|
+ SELECT COUNT(material_id) total,
|
|
|
+ (SELECT COUNT(material_id) tatol from application.app_bytedance_material_info
|
|
|
+ where sync_bytedance = 2
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND help_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND help_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+ ) as bytedanceTatol
|
|
|
+ FROM
|
|
|
+ application.app_bytedance_material_info
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND help_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND help_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) t
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 素材相关===素材使用率===快手 -->
|
|
|
+ <select id="getMeterialUseRateKuaishou" resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT t.*,
|
|
|
+ CONCAT(ROUND(t.kuaiShouTatol / t.total * 100,2) ,'%') as useRate
|
|
|
+ from (
|
|
|
+ SELECT COUNT(material_id) total,
|
|
|
+ (SELECT COUNT(material_id) tatol from application.app_kuaishou_material_info
|
|
|
+ where sync_kuaishou = 2
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND help_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND help_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+ ) as kuaiShouTatol
|
|
|
+ FROM
|
|
|
+ application.app_kuaishou_material_info
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND help_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND help_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) t
|
|
|
+ </select>
|
|
|
+
|
|
|
+<!-- 素材相关===素材爆款率===头条 -->
|
|
|
+ <select id="getMeterialFaddishRateBytedance" resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT t.*,
|
|
|
+ CONCAT(ROUND(t.faddish / t.total * 100,2) ,'%') as faddishRate
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT COUNT(material_id) total,
|
|
|
+ (SELECT COUNT(material_id) tatol from application.app_bytedance_material_info
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND faddish_date >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND faddish_date <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) as faddish
|
|
|
+ FROM
|
|
|
+ application.app_bytedance_material_info
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND help_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND help_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) t
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+<!-- 素材相关===素材爆款率===快手 -->
|
|
|
+ <select id="getMeterialFaddishRateKuaishou" resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT t.*,
|
|
|
+ CONCAT(ROUND(t.faddish / t.total * 100,2) ,'%') as faddishRate
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT COUNT(material_id) total,
|
|
|
+ (SELECT COUNT(material_id) tatol from application.app_kuaishou_material_info
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND faddish_date >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND faddish_date <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) as faddish
|
|
|
+ FROM
|
|
|
+ application.app_kuaishou_material_info
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND help_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND help_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) t
|
|
|
+ </select>
|
|
|
+
|
|
|
+<!-- 素材相关===素材创新率===头条 -->
|
|
|
+ <select id="getMeterialInnovateRateBytedance" resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT t.*,
|
|
|
+ CONCAT(ROUND(t.innovate / t.total * 100,2) ,'%') as innovateRate
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT COUNT(material_id) total,
|
|
|
+ (SELECT COUNT(material_id) tatol from application.app_bytedance_material_info
|
|
|
+ where material_innovate = 2
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND help_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND help_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+ ) as innovate
|
|
|
+ FROM
|
|
|
+ application.app_bytedance_material_info
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND help_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND help_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) t
|
|
|
+ </select>
|
|
|
+
|
|
|
+<!-- 素材相关===素材创新率===快手 -->
|
|
|
+ <select id="getMeterialInnovateRateKuaishou" resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT t.*,
|
|
|
+ CONCAT(ROUND(t.innovate / t.total * 100,2) ,'%') as innovateRate
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT COUNT(material_id) total,
|
|
|
+ (SELECT COUNT(material_id) tatol from application.app_kuaishou_material_info
|
|
|
+ where material_innovate = 2
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND help_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND help_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+ ) as innovate
|
|
|
+ FROM
|
|
|
+ application.app_kuaishou_material_info
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND help_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND help_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) t
|
|
|
+ </select>
|
|
|
+
|
|
|
+<!-- 分公司投放数据-账户-头条 -->
|
|
|
+ <select id="getCompanyAccountDataBytedance" resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT
|
|
|
+ t.*,
|
|
|
+ SUM(t.cost) tcost,
|
|
|
+ CONCAT(ROUND(SUM(t.cost) / t.totalCost * 100,2) ,'%')as rate
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ company_id,
|
|
|
+ company_name,
|
|
|
+ SUM(cost) cost,
|
|
|
+ CASE
|
|
|
+ company_id
|
|
|
+ WHEN 'd57fecdcf7a94d009736d9c850731582' THEN '华北'
|
|
|
+ WHEN '6608ed13c0dd42de93c790dbdf124234' THEN '华南'
|
|
|
+ WHEN '4b10089775c040119e139087517aed88' THEN '华东'
|
|
|
+ WHEN '3321d5893bcd430cab1238a99bc7db11' THEN '石家庄'
|
|
|
+ WHEN '5e46b5dea3d740eeb8ff1a2895015a4b' THEN '骄阳'
|
|
|
+ WHEN '1648c7ceb4d449a9a13fbed7a8d9976c' THEN '杭州'
|
|
|
+ ELSE '其他'
|
|
|
+ END area,
|
|
|
+ ( SELECT SUM(cost) FROM application.bytedance_advertiser_report_daily_dw
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND stat_datetime >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND stat_datetime <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) totalCost
|
|
|
+ FROM
|
|
|
+ application.bytedance_advertiser_report_daily_dw
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND stat_datetime >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND stat_datetime <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ company_id ) t
|
|
|
+ GROUP BY
|
|
|
+ t.area;
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+<!-- 分公司投放数据-账户-快手 -->
|
|
|
+ <select id="getCompanyAccountDataKuaishou" resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT
|
|
|
+ t.*,
|
|
|
+ SUM(t.cost) tcost,
|
|
|
+ CONCAT(ROUND(SUM(t.cost) / t.totalCost * 100,2) ,'%')as rate
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ company_id,
|
|
|
+ company_name,
|
|
|
+ SUM(charge) cost,
|
|
|
+ CASE
|
|
|
+ company_id
|
|
|
+ WHEN 'd57fecdcf7a94d009736d9c850731582' THEN '华北'
|
|
|
+ WHEN '6608ed13c0dd42de93c790dbdf124234' THEN '华南'
|
|
|
+ WHEN '4b10089775c040119e139087517aed88' THEN '华东'
|
|
|
+ WHEN '3321d5893bcd430cab1238a99bc7db11' THEN '石家庄'
|
|
|
+ WHEN '5e46b5dea3d740eeb8ff1a2895015a4b' THEN '骄阳'
|
|
|
+ WHEN '1648c7ceb4d449a9a13fbed7a8d9976c' THEN '杭州'
|
|
|
+ ELSE '其他'
|
|
|
+ END area,
|
|
|
+ ( SELECT SUM(charge) FROM application.kuaishou_account_report_daily_dw
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND stat_date >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND stat_date <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) totalCost
|
|
|
+ FROM
|
|
|
+ application.kuaishou_account_report_daily_dw
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND stat_date >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND stat_date <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ company_id ) t
|
|
|
+ GROUP BY
|
|
|
+ t.area;
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+<!-- 分媒体投放数据-账户维度 -->
|
|
|
+ <select id="getMediaTypeAccountData" resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT
|
|
|
+ t.stat_datetime as time,
|
|
|
+ t.bCost as bytedanceCost,
|
|
|
+ k.KCost as kuaishouCost
|
|
|
+ from
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ stat_datetime,
|
|
|
+ SUM(cost) bCost
|
|
|
+ FROM
|
|
|
+ application.bytedance_advertiser_report_daily_dw
|
|
|
+ <where>
|
|
|
+ <if test="firstDay !=null and firstDay != ''">
|
|
|
+ AND stat_datetime >= #{firstDay}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY stat_datetime
|
|
|
+ ORDER BY stat_datetime
|
|
|
+ ) t
|
|
|
+ LEFT JOIN
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ stat_date,
|
|
|
+ SUM(charge) KCost
|
|
|
+ FROM
|
|
|
+ application.kuaishou_account_report_daily_dw
|
|
|
+ <where>
|
|
|
+ <if test="firstDay !=null and firstDay != ''">
|
|
|
+ AND stat_date >= #{firstDay}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY stat_date
|
|
|
+ ORDER BY stat_date
|
|
|
+ ) k
|
|
|
+ on t.stat_datetime = k.stat_date
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+<!-- 分媒体公司消耗-账户维度-分日数据 -折线图-头条-->
|
|
|
+ <select id="getMediaTypeAccountTrendBytedance" resultType="org.jeecg.ctop.material.entity.AccountTrendPojo">
|
|
|
+ SELECT
|
|
|
+ stat_datetime as time,
|
|
|
+ SUM(cost) as cost,
|
|
|
+ CASE
|
|
|
+ company_id
|
|
|
+ WHEN 'd57fecdcf7a94d009736d9c850731582' THEN '华北'
|
|
|
+ WHEN '6608ed13c0dd42de93c790dbdf124234' THEN '华南'
|
|
|
+ WHEN '4b10089775c040119e139087517aed88' THEN '华东'
|
|
|
+ WHEN '5e46b5dea3d740eeb8ff1a2895015a4b' THEN '骄阳'
|
|
|
+ ELSE '其他'
|
|
|
+ END area
|
|
|
+ FROM
|
|
|
+ application.bytedance_advertiser_report_daily_dw
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND stat_datetime >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND stat_datetime <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY stat_datetime,company_id
|
|
|
+ ORDER BY stat_datetime
|
|
|
+ </select>
|
|
|
+
|
|
|
+<!-- 分媒体公司消耗-账户维度-分日数据-折线图-快手 -->
|
|
|
+ <select id="getMediaTypeAccountTrendKuaishou" resultType="org.jeecg.ctop.material.entity.AccountTrendPojo">
|
|
|
+ SELECT
|
|
|
+ stat_date as time,
|
|
|
+ SUM(charge) as cost,
|
|
|
+ CASE
|
|
|
+ company_id
|
|
|
+ WHEN 'd57fecdcf7a94d009736d9c850731582' THEN '华北'
|
|
|
+ WHEN '6608ed13c0dd42de93c790dbdf124234' THEN '华南'
|
|
|
+ WHEN '4b10089775c040119e139087517aed88' THEN '华东'
|
|
|
+ WHEN '5e46b5dea3d740eeb8ff1a2895015a4b' THEN '骄阳'
|
|
|
+ ELSE '其他'
|
|
|
+ END area
|
|
|
+ FROM
|
|
|
+ application.kuaishou_account_report_daily_dw
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND stat_date >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND stat_date <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY stat_date,company_id
|
|
|
+ ORDER BY stat_date
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 项目消耗排行 top10 头条-->
|
|
|
+ <select id="getMediaTypeProjectCostBytedance" resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT
|
|
|
+ a.project_id as projectId,
|
|
|
+ a.project_name as projectName,
|
|
|
+ SUM(a.cost) as totalCost,
|
|
|
+ IFNULL(SUM(b.new_ad_num),0) as baseNum
|
|
|
+ FROM
|
|
|
+ application.bytedance_advertiser_report_daily_dw a
|
|
|
+ LEFT JOIN application.app_bytedance_account_base_info_d b
|
|
|
+ on a.project_id = b.project_id
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND a.stat_datetime >= #{startTime}
|
|
|
+ AND b.stat_date >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND a.stat_datetime <= #{endTime}
|
|
|
+ AND b.stat_date <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY a.project_id
|
|
|
+ ORDER BY totalCost DESC
|
|
|
+ limit 10
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 项目消耗排行 top10 快手-->
|
|
|
+ <select id="getMediaTypeProjectCostKuaishou" resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT
|
|
|
+ a.project_id as projectId,
|
|
|
+ a.project_name as projectName,
|
|
|
+ SUM(a.charge) as totalCost,
|
|
|
+ IFNULL(SUM(b.new_unit_num),0) as baseNum
|
|
|
+ FROM
|
|
|
+ application.kuaishou_account_report_daily_dw a
|
|
|
+ LEFT JOIN application.app_kuaishou_account_base_info_d b
|
|
|
+ on a.project_id = b.project_id
|
|
|
+ <where>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND a.stat_date >= #{startTime}
|
|
|
+ AND b.stat_date >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND a.stat_date <= #{endTime}
|
|
|
+ AND b.stat_date <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY a.project_id
|
|
|
+ ORDER BY totalCost DESC
|
|
|
+ limit 10
|
|
|
|
|
|
</select>
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
</mapper>
|