|
@@ -46,16 +46,14 @@
|
|
FROM `jeecg-boot`.ctop_project
|
|
FROM `jeecg-boot`.ctop_project
|
|
WHERE company_id = #{companyId}
|
|
WHERE company_id = #{companyId}
|
|
AND ( media_id = 1 OR media_id = 3 )
|
|
AND ( media_id = 1 OR media_id = 3 )
|
|
- AND sale_id IN
|
|
|
|
<if test="userIds !=null and userIds.size()>0">
|
|
<if test="userIds !=null and userIds.size()>0">
|
|
- AND t1.user_id IN
|
|
|
|
|
|
+ AND sale_id IN
|
|
<foreach collection="userIds" item="id" separator=","
|
|
<foreach collection="userIds" item="id" separator=","
|
|
open="(" close=")">
|
|
open="(" close=")">
|
|
#{id}
|
|
#{id}
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
)
|
|
)
|
|
- AND company_id = #{companyId}
|
|
|
|
GROUP BY
|
|
GROUP BY
|
|
account_id
|
|
account_id
|
|
</select>
|
|
</select>
|
|
@@ -74,6 +72,7 @@
|
|
#{id}
|
|
#{id}
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
|
|
+ and company_id = #{companyId}
|
|
and stat_date = DATE_FORMAT(#{statDay}, '%Y%m%d')
|
|
and stat_date = DATE_FORMAT(#{statDay}, '%Y%m%d')
|
|
<if test="hour !=null">
|
|
<if test="hour !=null">
|
|
AND hour <= #{hour}
|
|
AND hour <= #{hour}
|
|
@@ -85,6 +84,7 @@
|
|
SELECT sum(charge) as 'charge'
|
|
SELECT sum(charge) as 'charge'
|
|
FROM application.kuaishou_account_report_hourly_dw
|
|
FROM application.kuaishou_account_report_hourly_dw
|
|
where stat_date = DATE_FORMAT(DATE_ADD(#{statDay},INTERVAL -1 day), '%Y%m%d')
|
|
where stat_date = DATE_FORMAT(DATE_ADD(#{statDay},INTERVAL -1 day), '%Y%m%d')
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
AND account_id in
|
|
AND account_id in
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -105,6 +105,7 @@
|
|
SELECT sum(cost) as 'charge'
|
|
SELECT sum(cost) as 'charge'
|
|
FROM application.bytedance_advertiser_report_hourly_dw
|
|
FROM application.bytedance_advertiser_report_hourly_dw
|
|
where stat_datetime = DATE_FORMAT(#{statDay}, '%Y%m%d')
|
|
where stat_datetime = DATE_FORMAT(#{statDay}, '%Y%m%d')
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
and account_id in
|
|
and account_id in
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -140,6 +141,7 @@
|
|
FROM application.bytedance_advertiser_report_hourly_dw
|
|
FROM application.bytedance_advertiser_report_hourly_dw
|
|
WHERE stat_datetime >= DATE_FORMAT(#{startDay}, '%Y%m%d')
|
|
WHERE stat_datetime >= DATE_FORMAT(#{startDay}, '%Y%m%d')
|
|
and stat_datetime <= DATE_FORMAT(#{endDay}, '%Y%m%d')
|
|
and stat_datetime <= DATE_FORMAT(#{endDay}, '%Y%m%d')
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
and account_id in
|
|
and account_id in
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -154,6 +156,7 @@
|
|
FROM application.bytedance_advertiser_report_hourly_dw
|
|
FROM application.bytedance_advertiser_report_hourly_dw
|
|
WHERE stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d')
|
|
WHERE stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d')
|
|
and stat_datetime <= DATE_FORMAT(#{endTime}, '%Y%m%d')
|
|
and stat_datetime <= DATE_FORMAT(#{endTime}, '%Y%m%d')
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
and account_id in
|
|
and account_id in
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -171,6 +174,7 @@
|
|
WHERE
|
|
WHERE
|
|
stat_date >= DATE_FORMAT(#{startTime}, '%Y%m%d')
|
|
stat_date >= DATE_FORMAT(#{startTime}, '%Y%m%d')
|
|
and stat_date <= DATE_FORMAT(#{endTime}, '%Y%m%d')
|
|
and stat_date <= DATE_FORMAT(#{endTime}, '%Y%m%d')
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
and account_id in
|
|
and account_id in
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -188,6 +192,7 @@
|
|
WHERE
|
|
WHERE
|
|
stat_date >= DATE_FORMAT(#{startDay}, '%Y%m%d')
|
|
stat_date >= DATE_FORMAT(#{startDay}, '%Y%m%d')
|
|
and stat_date <= DATE_FORMAT(#{endDay}, '%Y%m%d')
|
|
and stat_date <= DATE_FORMAT(#{endDay}, '%Y%m%d')
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
and account_id in
|
|
and account_id in
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -210,6 +215,7 @@
|
|
application.app_kuaishou_agent_report_d
|
|
application.app_kuaishou_agent_report_d
|
|
WHERE stat_date >= DATE_FORMAT( #{monthFirstday}, '%Y%m%d' )
|
|
WHERE stat_date >= DATE_FORMAT( #{monthFirstday}, '%Y%m%d' )
|
|
AND stat_date <= DATE_FORMAT( #{statDay}, '%Y%m%d' )
|
|
AND stat_date <= DATE_FORMAT( #{statDay}, '%Y%m%d' )
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
AND account_id IN
|
|
AND account_id IN
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -225,6 +231,7 @@
|
|
application.app_kuaishou_agent_report_d
|
|
application.app_kuaishou_agent_report_d
|
|
WHERE stat_date >= DATE_FORMAT(#{lastMonthFirstday}, '%Y%m%d' )
|
|
WHERE stat_date >= DATE_FORMAT(#{lastMonthFirstday}, '%Y%m%d' )
|
|
AND stat_date < DATE_FORMAT(#{monthFirstday}, '%Y%m%d' )
|
|
AND stat_date < DATE_FORMAT(#{monthFirstday}, '%Y%m%d' )
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
AND
|
|
AND
|
|
account_id IN
|
|
account_id IN
|
|
@@ -249,6 +256,7 @@
|
|
application.app_bytedance_agent_report_d
|
|
application.app_bytedance_agent_report_d
|
|
WHERE stat_datetime >= DATE_FORMAT( #{monthFirstday}, '%Y%m%d' )
|
|
WHERE stat_datetime >= DATE_FORMAT( #{monthFirstday}, '%Y%m%d' )
|
|
AND stat_datetime <= DATE_FORMAT( #{statDay}, '%Y%m%d' )
|
|
AND stat_datetime <= DATE_FORMAT( #{statDay}, '%Y%m%d' )
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
AND
|
|
AND
|
|
account_id IN
|
|
account_id IN
|
|
@@ -321,6 +329,7 @@
|
|
SELECT hour,sum(charge) as 'charge'
|
|
SELECT hour,sum(charge) as 'charge'
|
|
FROM application.kuaishou_account_report_hourly_dw
|
|
FROM application.kuaishou_account_report_hourly_dw
|
|
WHERE stat_date = DATE_FORMAT(#{statDay}, '%Y%m%d' )
|
|
WHERE stat_date = DATE_FORMAT(#{statDay}, '%Y%m%d' )
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
AND account_id in
|
|
AND account_id in
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -336,6 +345,7 @@
|
|
SELECT hour,sum(cost) as 'charge'
|
|
SELECT hour,sum(cost) as 'charge'
|
|
FROM application.bytedance_advertiser_report_hourly_dw
|
|
FROM application.bytedance_advertiser_report_hourly_dw
|
|
WHERE stat_datetime = DATE_FORMAT(#{statDay}, '%Y%m%d' )
|
|
WHERE stat_datetime = DATE_FORMAT(#{statDay}, '%Y%m%d' )
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
AND account_id in
|
|
AND account_id in
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -361,6 +371,7 @@
|
|
application.bytedance_advertiser_report_hourly_dw
|
|
application.bytedance_advertiser_report_hourly_dw
|
|
WHERE stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d' )
|
|
WHERE stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d' )
|
|
AND stat_datetime <= DATE_FORMAT(#{endTime}, '%Y%m%d' )
|
|
AND stat_datetime <= DATE_FORMAT(#{endTime}, '%Y%m%d' )
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
AND account_id IN
|
|
AND account_id IN
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -376,6 +387,7 @@
|
|
application.bytedance_advertiser_report_hourly_dw
|
|
application.bytedance_advertiser_report_hourly_dw
|
|
WHERE stat_datetime >= DATE_FORMAT( #{lastTimeStart}, '%Y%m%d' )
|
|
WHERE stat_datetime >= DATE_FORMAT( #{lastTimeStart}, '%Y%m%d' )
|
|
AND stat_datetime <= DATE_FORMAT( #{lastTimeEnd}, '%Y%m%d' )
|
|
AND stat_datetime <= DATE_FORMAT( #{lastTimeEnd}, '%Y%m%d' )
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
AND account_id IN
|
|
AND account_id IN
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -400,6 +412,7 @@
|
|
application.kuaishou_account_report_hourly_dw
|
|
application.kuaishou_account_report_hourly_dw
|
|
WHERE stat_date >= DATE_FORMAT(#{startTime}, '%Y%m%d' )
|
|
WHERE stat_date >= DATE_FORMAT(#{startTime}, '%Y%m%d' )
|
|
AND stat_date <= DATE_FORMAT(#{endTime}, '%Y%m%d' )
|
|
AND stat_date <= DATE_FORMAT(#{endTime}, '%Y%m%d' )
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
AND account_id IN
|
|
AND account_id IN
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -415,6 +428,7 @@
|
|
application.kuaishou_account_report_hourly_dw
|
|
application.kuaishou_account_report_hourly_dw
|
|
WHERE stat_date >= DATE_FORMAT( #{lastTimeStart}, '%Y%m%d' )
|
|
WHERE stat_date >= DATE_FORMAT( #{lastTimeStart}, '%Y%m%d' )
|
|
AND stat_date <= DATE_FORMAT( #{lastTimeEnd}, '%Y%m%d' )
|
|
AND stat_date <= DATE_FORMAT( #{lastTimeEnd}, '%Y%m%d' )
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
AND account_id IN
|
|
AND account_id IN
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -432,6 +446,7 @@
|
|
(select 1 from application.kuaishou_account_report_hourly_dw t1
|
|
(select 1 from application.kuaishou_account_report_hourly_dw t1
|
|
where t1.stat_date >= DATE_FORMAT(#{startTime}, '%Y%m%d')
|
|
where t1.stat_date >= DATE_FORMAT(#{startTime}, '%Y%m%d')
|
|
and t1.stat_date <= DATE_FORMAT(#{endTime}, '%Y%m%d')
|
|
and t1.stat_date <= DATE_FORMAT(#{endTime}, '%Y%m%d')
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
and account_id IN
|
|
and account_id IN
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -449,6 +464,7 @@
|
|
(select 1 from application.bytedance_advertiser_report_hourly_dw t1
|
|
(select 1 from application.bytedance_advertiser_report_hourly_dw t1
|
|
where t1.stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d')
|
|
where t1.stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d')
|
|
and t1.stat_datetime <= DATE_FORMAT(#{endTime}, '%Y%m%d')
|
|
and t1.stat_datetime <= DATE_FORMAT(#{endTime}, '%Y%m%d')
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
and account_id IN
|
|
and account_id IN
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -480,6 +496,7 @@
|
|
FROM application.app_kuaishou_agent_report_d
|
|
FROM application.app_kuaishou_agent_report_d
|
|
WHERE stat_date >= DATE_FORMAT(#{startTime}, '%Y%m%d' )
|
|
WHERE stat_date >= DATE_FORMAT(#{startTime}, '%Y%m%d' )
|
|
AND stat_date <= DATE_FORMAT(#{endTime}, '%Y%m%d' )
|
|
AND stat_date <= DATE_FORMAT(#{endTime}, '%Y%m%d' )
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
and account_id IN
|
|
and account_id IN
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -492,6 +509,7 @@
|
|
LEFT JOIN (
|
|
LEFT JOIN (
|
|
SELECT project_id, SUM( charge ) AS 'charge' FROM application.kuaishou_account_report_hourly_dw
|
|
SELECT project_id, SUM( charge ) AS 'charge' FROM application.kuaishou_account_report_hourly_dw
|
|
WHERE hour <= #{hour}
|
|
WHERE hour <= #{hour}
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
and account_id IN
|
|
and account_id IN
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -504,6 +522,7 @@
|
|
GROUP BY project_id ) t3 ON t1.project_id = t3.project_id
|
|
GROUP BY project_id ) t3 ON t1.project_id = t3.project_id
|
|
left join(select id,realname from `jeecg-boot`.sys_user )t4 on t1.sale_id=t4.id
|
|
left join(select id,realname from `jeecg-boot`.sys_user )t4 on t1.sale_id=t4.id
|
|
WHERE hour <= #{hour}
|
|
WHERE hour <= #{hour}
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
and t1.account_id IN
|
|
and t1.account_id IN
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -537,6 +556,7 @@
|
|
FROM application.app_bytedance_agent_report_d
|
|
FROM application.app_bytedance_agent_report_d
|
|
WHERE stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d' )
|
|
WHERE stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d' )
|
|
AND stat_datetime <= DATE_FORMAT(#{endTime}, '%Y%m%d' )
|
|
AND stat_datetime <= DATE_FORMAT(#{endTime}, '%Y%m%d' )
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
and account_id IN
|
|
and account_id IN
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -550,6 +570,7 @@
|
|
SELECT project_id, SUM( cost ) AS 'charge' FROM application.bytedance_advertiser_report_hourly_dw
|
|
SELECT project_id, SUM( cost ) AS 'charge' FROM application.bytedance_advertiser_report_hourly_dw
|
|
WHERE stat_datetime >= DATE_FORMAT(DATE_ADD(#{startTime}, INTERVAL - ${days} DAY ), '%Y%m%d' )
|
|
WHERE stat_datetime >= DATE_FORMAT(DATE_ADD(#{startTime}, INTERVAL - ${days} DAY ), '%Y%m%d' )
|
|
AND stat_datetime <= DATE_FORMAT(DATE_ADD(#{endTime}, INTERVAL - ${days} DAY ), '%Y%m%d' )
|
|
AND stat_datetime <= DATE_FORMAT(DATE_ADD(#{endTime}, INTERVAL - ${days} DAY ), '%Y%m%d' )
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
and account_id IN
|
|
and account_id IN
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
@@ -562,6 +583,7 @@
|
|
left join(select id,realname from `jeecg-boot`.sys_user )t4 on t1.sale_id=t4.id
|
|
left join(select id,realname from `jeecg-boot`.sys_user )t4 on t1.sale_id=t4.id
|
|
WHERE t1.stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d' )
|
|
WHERE t1.stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d' )
|
|
AND t1.stat_datetime <= DATE_FORMAT(#{endTime}, '%Y%m%d' )
|
|
AND t1.stat_datetime <= DATE_FORMAT(#{endTime}, '%Y%m%d' )
|
|
|
|
+ and company_id = #{companyId}
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
<if test="accountIds !=null and accountIds.size()>0">
|
|
and account_id IN
|
|
and account_id IN
|
|
<foreach collection="accountIds" item="id" separator=","
|
|
<foreach collection="accountIds" item="id" separator=","
|