|
@@ -105,20 +105,34 @@
|
|
|
set account_id = #{accountId}
|
|
|
</insert>
|
|
|
<select id="imageCost" resultType="cn.com.ctop.common.module.vo.KuaishouImageCostVO">
|
|
|
- select
|
|
|
- report.cover_url as 'image_url' ,
|
|
|
+ select * from (select
|
|
|
+ report.cover_url as 'imageUrl' ,
|
|
|
report.cover_id as 'signature',
|
|
|
- group_concat(distinct p.project_name) AS 'project_name',
|
|
|
- sum(report.charge) AS 'charge',
|
|
|
- sum(report.photo_click) AS 'photo_click',
|
|
|
- sum(report.photo_show) AS 'photo_show',
|
|
|
+ group_concat(distinct p.project_name) AS 'projectName',
|
|
|
+ sum(report.charge) AS 'cost',
|
|
|
+ sum(report.photo_click) AS 'photoClick',
|
|
|
+ (case when sum(report.photo_show)!=0 and sum(report.photo_click)!=0
|
|
|
+ then round(sum(photo_click)/sum(photo_show)*100,2)
|
|
|
+ else 0 end)as 'photoClickRate',
|
|
|
+ sum(report.photo_show) AS 'photoShow',
|
|
|
+ (case when sum(report.charge)!=0 and sum(report.photo_show)!=0
|
|
|
+ then round(sum(charge)/sum(photo_show)*1000,2)
|
|
|
+ else 0 end)as 'photoShowCost',
|
|
|
+ sum(report.aclick) as 'aclick',
|
|
|
+ sum(report.bclick) as 'bclick',
|
|
|
+ (case when sum(report.bclick)!=0 and sum(report.aclick)!=0
|
|
|
+ then round(sum(bclick)/sum(aclick)*100,2)
|
|
|
+ else 0 end)as 'bclickRate',
|
|
|
+ (case when sum(report.charge)!=0 and sum(report.aclick)!=0
|
|
|
+ then round(sum(charge)/sum(aclick)*1000,2)
|
|
|
+ else 0 end)as 'aclickCost',
|
|
|
sum(report.activation) AS 'activation',
|
|
|
- sum(report.event_register) AS 'event_register',
|
|
|
- sum(report.event_pay) AS 'event_pay',
|
|
|
- sum(report.form_count) AS 'form_count',
|
|
|
- sum(report.event_jin_jian_app) AS 'event_jin_jian_app',
|
|
|
- sum(report.event_credit_grant_app) AS 'event_credit_grant_app',
|
|
|
- report.realname as 'user_name'
|
|
|
+ sum(report.event_register) AS 'eventRegister',
|
|
|
+ sum(report.event_pay) AS 'eventPay',
|
|
|
+ sum(report.form_count) AS 'formCount',
|
|
|
+ sum(report.event_jin_jian_app) AS 'eventJinJianApp',
|
|
|
+ sum(report.event_credit_grant_app) AS 'eventCreditGrantApp',
|
|
|
+ report.realname as 'userName'
|
|
|
from ctop_kuaishou_report_daily_image report
|
|
|
left join ctop_user_allocation allocation on allocation.account_id = report.account_id
|
|
|
left join ctop_project p on p.id = allocation.project_id
|
|
@@ -141,31 +155,45 @@
|
|
|
<if test="code!=null">
|
|
|
and report.cover_id = #{code}
|
|
|
</if>
|
|
|
- group by report.cover_id
|
|
|
- order by sum(report.charge) desc
|
|
|
+ group by report.cover_id)a
|
|
|
+ order by a.${target} ${order}
|
|
|
</select>
|
|
|
<select id="imageCostEntity" resultType="cn.com.ctop.common.module.vo.KuaishouImageCostVOEntity">
|
|
|
- select
|
|
|
- report.cover_url as 'image_url' ,
|
|
|
- report.code as 'signature',
|
|
|
- group_concat(distinct p.project_name) AS 'project_name',
|
|
|
- sum(report.charge) AS 'charge',
|
|
|
- sum(report.photo_click) AS 'photo_click',
|
|
|
- sum(report.photo_show) AS 'photo_show',
|
|
|
+ select * from (select
|
|
|
+ report.cover_url as 'imageUrl' ,
|
|
|
+ report.cover_id as 'signature',
|
|
|
+ group_concat(distinct p.project_name) AS 'projectName',
|
|
|
+ sum(report.charge) AS 'cost',
|
|
|
+ sum(report.photo_click) AS 'photoClick',
|
|
|
+ (case when sum(report.photo_show)!=0 and sum(report.photo_click)!=0
|
|
|
+ then round(sum(photo_click)/sum(photo_show)*100,2)
|
|
|
+ else 0 end)as 'photoClickRate',
|
|
|
+ sum(report.photo_show) AS 'photoShow',
|
|
|
+ (case when sum(report.charge)!=0 and sum(report.photo_show)!=0
|
|
|
+ then round(sum(charge)/sum(photo_show)*1000,2)
|
|
|
+ else 0 end)as 'photoShowCost',
|
|
|
+ sum(report.aclick) as 'aclick',
|
|
|
+ sum(report.bclick) as 'bclick',
|
|
|
+ (case when sum(report.bclick)!=0 and sum(report.aclick)!=0
|
|
|
+ then round(sum(bclick)/sum(aclick)*100,2)
|
|
|
+ else 0 end)as 'bclickRate',
|
|
|
+ (case when sum(report.charge)!=0 and sum(report.aclick)!=0
|
|
|
+ then round(sum(charge)/sum(aclick)*1000,2)
|
|
|
+ else 0 end)as 'aclickCost',
|
|
|
sum(report.activation) AS 'activation',
|
|
|
- sum(report.event_register) AS 'event_register',
|
|
|
- sum(report.event_pay) AS 'event_pay',
|
|
|
- sum(report.form_count) AS 'form_count',
|
|
|
- sum(report.event_jin_jian_app) AS 'event_jin_jian_app',
|
|
|
- sum(report.event_credit_grant_app) AS 'event_credit_grant_app',
|
|
|
- report.realname as 'user_name'
|
|
|
+ sum(report.event_register) AS 'eventRegister',
|
|
|
+ sum(report.event_pay) AS 'eventPay',
|
|
|
+ sum(report.form_count) AS 'formCount',
|
|
|
+ sum(report.event_jin_jian_app) AS 'eventJinJianApp',
|
|
|
+ sum(report.event_credit_grant_app) AS 'eventCreditGrantApp',
|
|
|
+ report.realname as 'userName'
|
|
|
from ctop_kuaishou_report_daily_image report
|
|
|
left join ctop_user_allocation allocation on allocation.account_id = report.account_id
|
|
|
left join ctop_project p on p.id = allocation.project_id
|
|
|
where
|
|
|
1=1
|
|
|
and
|
|
|
- report.code is not null
|
|
|
+ report.cover_id is not null
|
|
|
<if test="startDate!=null">
|
|
|
and report.stat_date >= #{startDate}
|
|
|
</if>
|
|
@@ -179,10 +207,10 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="code!=null">
|
|
|
- and report.code = #{code}
|
|
|
+ and report.cover_id = #{code}
|
|
|
</if>
|
|
|
- group by report.code
|
|
|
- order by sum(report.charge) desc
|
|
|
+ group by report.cover_id)a
|
|
|
+ order by a.${target} ${order}
|
|
|
</select>
|
|
|
|
|
|
<update id="updateImageReportCode">
|