|
@@ -471,7 +471,6 @@
|
|
ORDER BY stat_date
|
|
ORDER BY stat_date
|
|
</select>
|
|
</select>
|
|
|
|
|
|
-
|
|
|
|
<select id="projectPageList" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="projectPageList" resultType="com.alibaba.fastjson.JSONObject">
|
|
SELECT
|
|
SELECT
|
|
${filed},
|
|
${filed},
|
|
@@ -499,11 +498,6 @@
|
|
LEFT JOIN ctop_user_allocation i2 ON i1.account_id = i2.account_id
|
|
LEFT JOIN ctop_user_allocation i2 ON i1.account_id = i2.account_id
|
|
where i1.stat_date >= DATE_SUB(#{startTime},INTERVAL 7 DAY)
|
|
where i1.stat_date >= DATE_SUB(#{startTime},INTERVAL 7 DAY)
|
|
AND i1.stat_date <= DATE_SUB(#{endTime},INTERVAL 7 DAY)
|
|
AND i1.stat_date <= DATE_SUB(#{endTime},INTERVAL 7 DAY)
|
|
- AND i2.user_id IN
|
|
|
|
- <foreach item="id" index="index" collection="userIds"
|
|
|
|
- open="(" separator="," close=")">
|
|
|
|
- #{id}
|
|
|
|
- </foreach>
|
|
|
|
GROUP BY i1.account_id
|
|
GROUP BY i1.account_id
|
|
) t6 ON t2.account_id = t6.account_id
|
|
) t6 ON t2.account_id = t6.account_id
|
|
LEFT JOIN (
|
|
LEFT JOIN (
|
|
@@ -516,44 +510,184 @@
|
|
) t7 on t2.project_id = t7.project_id
|
|
) t7 on t2.project_id = t7.project_id
|
|
where t1.stat_date >= #{startTime}
|
|
where t1.stat_date >= #{startTime}
|
|
AND t1.stat_date <= #{endTime}
|
|
AND t1.stat_date <= #{endTime}
|
|
- AND t2.user_id in
|
|
|
|
- <foreach item="id" index="index" collection="userIds"
|
|
|
|
- open="(" separator="," close=")">
|
|
|
|
- #{id}
|
|
|
|
- </foreach>
|
|
|
|
GROUP BY t3.id
|
|
GROUP BY t3.id
|
|
|
|
+ HAVING SUM(charge)>0
|
|
<if test="sortCode != '' and sortCode != null ">
|
|
<if test="sortCode != '' and sortCode != null ">
|
|
ORDER BY ${sortCode}
|
|
ORDER BY ${sortCode}
|
|
|
|
+ ${sortType}
|
|
</if>
|
|
</if>
|
|
- ${sortType}
|
|
|
|
- </select>
|
|
|
|
|
|
|
|
|
|
+ </select>
|
|
|
|
|
|
<select id="projectPageListTotal" resultType="java.lang.Integer">
|
|
<select id="projectPageListTotal" resultType="java.lang.Integer">
|
|
SELECT IFNULL(SUM(1),0) from
|
|
SELECT IFNULL(SUM(1),0) from
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- t3.id
|
|
|
|
|
|
+ (
|
|
|
|
+ SELECT
|
|
|
|
+ t3.id
|
|
|
|
+ FROM ctop_etl_kuaishou_report_account_daily t1
|
|
|
|
+ LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
|
|
|
|
+ LEFT JOIN ctop_project t3 ON t2.project_id = t3.id
|
|
|
|
+ where t1.stat_date >= #{startTime}
|
|
|
|
+ AND t1.stat_date <= #{endTime}
|
|
|
|
+ GROUP BY t3.id
|
|
|
|
+ HAVING SUM(charge)>0
|
|
|
|
+ ) t
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="selectList" resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly">
|
|
|
|
+ SELECT * from ctop_etl_kuaishou_report_account_daily
|
|
|
|
+ WHERE stat_date >= #{startDate}
|
|
|
|
+ and stat_date <= #{endDate}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="operatingStaffDataListTotal" resultType="java.lang.Integer">
|
|
|
|
+ SELECT IFNULL(SUM(1),0)
|
|
|
|
+ FROM (
|
|
|
|
+ SELECT 1
|
|
FROM ctop_etl_kuaishou_report_account_daily t1
|
|
FROM ctop_etl_kuaishou_report_account_daily t1
|
|
LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
|
|
LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
|
|
- LEFT JOIN ctop_project t3 ON t2.project_id = t3.id
|
|
|
|
- where t1.stat_date >= #{startTime}
|
|
|
|
- AND t1.stat_date <= #{endTime}
|
|
|
|
- AND t2.user_id in
|
|
|
|
|
|
+ WHERE stat_date >= #{startTime}
|
|
|
|
+ and stat_date <= #{endTime}
|
|
|
|
+ AND t2.user_id IN
|
|
<foreach item="id" index="index" collection="userIds"
|
|
<foreach item="id" index="index" collection="userIds"
|
|
open="(" separator="," close=")">
|
|
open="(" separator="," close=")">
|
|
#{id}
|
|
#{id}
|
|
</foreach>
|
|
</foreach>
|
|
- GROUP BY t3.id
|
|
|
|
|
|
+ GROUP BY t2.user_id
|
|
) t
|
|
) t
|
|
</select>
|
|
</select>
|
|
|
|
|
|
-
|
|
|
|
- <select id="selectList" resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly">
|
|
|
|
- SELECT * from ctop_etl_kuaishou_report_account_daily
|
|
|
|
- WHERE stat_date >= #{startDate}
|
|
|
|
- and stat_date <= #{endDate}
|
|
|
|
|
|
+ <select id="operatingStaffDataList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
+ SELECT
|
|
|
|
+ IFNULL(t2.user_id,'') 'userId',
|
|
|
|
+ IFNULL(t9.realname,'') 'realName',
|
|
|
|
+ IFNULL(t3.accountCount,0) 'accountCount',
|
|
|
|
+ IFNULL(SUM(t1.charge),0) 'charge',
|
|
|
|
+ IFNULL(t4.weekCharge,0) 'weekCharge',
|
|
|
|
+ concat(CAST(IFNULL(ROUND((t4.weekCharge-t5.lweekCharge)/t5.lweekCharge*100,2), 0)as char),'%')as 'grew',
|
|
|
|
+ IFNULL(t6.effectiveCount,0) 'effectiveCount',
|
|
|
|
+ IFNULL(t7.campaignCount,0) 'campaignCount',
|
|
|
|
+ IFNULL(t8.unitCount,0) 'unitCount'
|
|
|
|
+ FROM
|
|
|
|
+ ctop_etl_kuaishou_report_account_daily t1
|
|
|
|
+ LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
|
|
|
|
+ LEFT JOIN(
|
|
|
|
+ SELECT user_id,COUNT(1) 'accountCount' FROM ctop_user_allocation i1
|
|
|
|
+ INNER JOIN ctop_etl_kuaishou_report_account_daily i2 ON i1.account_id = i2.account_id
|
|
|
|
+ AND i2.stat_date >= #{startTime}
|
|
|
|
+ and i2.stat_date <= #{endTime}
|
|
|
|
+ WHERE user_id IN
|
|
|
|
+ <foreach item="id" index="index" collection="userIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ GROUP BY user_id
|
|
|
|
+ ) t3 ON t2.user_id = t3.user_id
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT
|
|
|
|
+ SUM(charge) 'weekCharge',
|
|
|
|
+ tt2.user_id
|
|
|
|
+ FROM
|
|
|
|
+ ctop_etl_kuaishou_report_account_daily tt1
|
|
|
|
+ LEFT JOIN ctop_user_allocation tt2 ON tt1.account_id = tt2.account_id
|
|
|
|
+ WHERE tt1.stat_date <=#{today}
|
|
|
|
+ and tt1.stat_date >=#{weekStartTime}
|
|
|
|
+ AND tt2.user_id IN
|
|
|
|
+ <foreach item="id" index="index" collection="userIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ GROUP BY tt2.user_id
|
|
|
|
+ ) t4 ON t2.user_id = t4.user_id
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT
|
|
|
|
+ SUM(charge) 'lweekCharge',
|
|
|
|
+ tt2.user_id
|
|
|
|
+ FROM
|
|
|
|
+ ctop_etl_kuaishou_report_account_daily tt1
|
|
|
|
+ LEFT JOIN ctop_user_allocation tt2 ON tt1.account_id = tt2.account_id
|
|
|
|
+ WHERE tt1.stat_date <=#{lweekEndTime}
|
|
|
|
+ and tt1.stat_date >=#{lweekStartTime}
|
|
|
|
+ AND tt2.user_id IN
|
|
|
|
+ <foreach item="id" index="index" collection="userIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ GROUP BY tt2.user_id
|
|
|
|
+ ) t5 ON t2.user_id = t5.user_id
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT
|
|
|
|
+ SUM(effective_count) 'effectiveCount',
|
|
|
|
+ tt2.user_id
|
|
|
|
+ FROM
|
|
|
|
+ ctop_etl_kuaishou_account_material_overview tt1
|
|
|
|
+ LEFT JOIN ctop_user_allocation tt2 ON tt1.account_id = tt2.account_id
|
|
|
|
+ WHERE tt1.state_date >= #{startTime}
|
|
|
|
+ and tt1.state_date <= #{endTime}
|
|
|
|
+ AND tt2.user_id IN
|
|
|
|
+ <foreach item="id" index="index" collection="userIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ GROUP BY tt2.user_id
|
|
|
|
+ ) t6 ON t2.user_id = t6.user_id
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT
|
|
|
|
+ SUM(new_count) 'campaignCount',
|
|
|
|
+ tt2.user_id
|
|
|
|
+ FROM
|
|
|
|
+ ctop_etl_kuaishou_newly tt1
|
|
|
|
+ LEFT JOIN ctop_user_allocation tt2 ON tt1.account_id = tt2.account_id
|
|
|
|
+ WHERE tt1.stat_date >= #{startTime}
|
|
|
|
+ and tt1.stat_date <= #{endTime}
|
|
|
|
+ AND tt1.new_type = 'campaign'
|
|
|
|
+ AND tt2.user_id IN
|
|
|
|
+ <foreach item="id" index="index" collection="userIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ GROUP BY tt2.user_id
|
|
|
|
+ ) t7 ON t2.user_id = t7.user_id
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT
|
|
|
|
+ SUM(new_count) 'unitCount',
|
|
|
|
+ tt2.user_id
|
|
|
|
+ FROM
|
|
|
|
+ ctop_etl_kuaishou_newly tt1
|
|
|
|
+ LEFT JOIN ctop_user_allocation tt2 ON tt1.account_id = tt2.account_id
|
|
|
|
+ WHERE tt1.stat_date >= #{startTime}
|
|
|
|
+ and tt1.stat_date <= #{endTime}
|
|
|
|
+ AND tt1.new_type = 'unit'
|
|
|
|
+ AND tt2.user_id IN
|
|
|
|
+ <foreach item="id" index="index" collection="userIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ GROUP BY tt2.user_id
|
|
|
|
+ ) t8 ON t2.user_id = t8.user_id
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT
|
|
|
|
+ id,realname
|
|
|
|
+ FROM
|
|
|
|
+ sys_user
|
|
|
|
+ WHERE id IN
|
|
|
|
+ <foreach item="id" index="index" collection="userIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ ) t9 ON t2.user_id = t9.id
|
|
|
|
+ WHERE t1.stat_date >= #{startTime}
|
|
|
|
+ and t1.stat_date <= #{endTime}
|
|
|
|
+ AND t2.user_id IN
|
|
|
|
+ <foreach item="id" index="index" collection="userIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ GROUP BY t2.user_id
|
|
|
|
+ <if test="sortCode != '' and sortCode != null ">
|
|
|
|
+ ORDER BY ${sortCode}
|
|
|
|
+ </if>
|
|
|
|
+ ${sortType}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
-
|
|
|
|
</mapper>
|
|
</mapper>
|