|
@@ -0,0 +1,184 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper">
|
|
|
+
|
|
|
+ <insert id="etlKuaishouAccountMaterialReportDailyData">
|
|
|
+ replace into ctop_etl_kuaishou_account_material_report_daily (
|
|
|
+ company_id ,
|
|
|
+ company_name ,
|
|
|
+ project_id ,
|
|
|
+ project_name,
|
|
|
+ account_id,
|
|
|
+ signature,
|
|
|
+ charge ,
|
|
|
+ photo_show ,
|
|
|
+ aclick ,
|
|
|
+ bclick ,
|
|
|
+ download_started ,
|
|
|
+ download_completed ,
|
|
|
+ activation ,
|
|
|
+ submit ,
|
|
|
+ stat_date ,
|
|
|
+ photo_click ,
|
|
|
+ event_pay_first_day ,
|
|
|
+ event_pay_purchase_amount_first_day ,
|
|
|
+ event_pay ,
|
|
|
+ event_pay_purchase_amount ,
|
|
|
+ event_register ,
|
|
|
+ event_jin_jian_app ,
|
|
|
+ event_credit_grant_app ,
|
|
|
+ event_order_paid ,
|
|
|
+ event_order_paid_purchase_amount ,
|
|
|
+ event_jin_jian_landing_page ,
|
|
|
+ event_credit_grant_landing_page ,
|
|
|
+ event_next_day_stay ,
|
|
|
+ form_count,
|
|
|
+ play_3s_count)
|
|
|
+ select
|
|
|
+ c.company_id ,
|
|
|
+ c.company_name ,
|
|
|
+ u.project_id ,
|
|
|
+ p.project_name,
|
|
|
+ m.account_id,
|
|
|
+ m.signature,
|
|
|
+ sum(m.charge)as charge ,
|
|
|
+ sum(m.photo_show)as photo_show ,
|
|
|
+ sum(m.aclick)as aclick ,
|
|
|
+ sum(m.bclick)as bclick ,
|
|
|
+ sum(m.download_started)as download_started ,
|
|
|
+ sum(m.download_completed)as download_completed,
|
|
|
+ sum(m.activation)as activation ,
|
|
|
+ sum(m.submit)as submit,
|
|
|
+ stat_date,
|
|
|
+ sum(m.photo_click)as photo_click,
|
|
|
+ sum(m.event_pay_first_day)as event_pay_first_day,
|
|
|
+ sum(m.event_pay_purchase_amount_first_day)as event_pay_purchase_amount_first_day,
|
|
|
+ sum(m.event_pay)as event_pay,
|
|
|
+ sum(m.event_pay_purchase_amount)as event_pay_purchase_amount,
|
|
|
+ sum(m.event_register)as event_register,
|
|
|
+ sum(m.event_jin_jian_app)as event_jin_jian_app,
|
|
|
+ sum(m.event_credit_grant_app)as event_credit_grant_app,
|
|
|
+ sum(m.event_order_paid)as event_order_paid,
|
|
|
+ sum(m.event_order_paid_purchase_amount)as event_order_paid_purchase_amount,
|
|
|
+ sum(m.event_jin_jian_landing_page)as event_jin_jian_landing_page,
|
|
|
+ sum(m.event_credit_grant_landing_page )as event_credit_grant_landing_page,
|
|
|
+ sum(m.event_next_day_stay)as event_next_day_stay,
|
|
|
+ sum(m.form_count)as form_count,
|
|
|
+ round(sum(m.play_3s_ratio*m.photo_show))as play_3s_count
|
|
|
+ from ctop_kuaishou_report_daily_material m left join ctop_user_allocation u on u.account_id = m.account_id
|
|
|
+left join ctop_project p on p.id = u.project_id
|
|
|
+left join user_company c on c.user_id = u.account_id
|
|
|
+where m.signature is not null
|
|
|
+and m.stat_date = #{date}
|
|
|
+group by m.account_id,m.signature
|
|
|
+ </insert>
|
|
|
+ <insert id="replaceBatch">
|
|
|
+ replace into ctop_etl_kuaishou_account_material_report_daily(
|
|
|
+ company_id ,
|
|
|
+ company_name ,
|
|
|
+ project_id ,
|
|
|
+ project_name,
|
|
|
+ account_id,
|
|
|
+ signature,
|
|
|
+ charge,
|
|
|
+ photo_show ,
|
|
|
+ aclick ,
|
|
|
+ bclick ,
|
|
|
+ download_started ,
|
|
|
+ download_completed ,
|
|
|
+ activation ,
|
|
|
+ submit ,
|
|
|
+ stat_date ,
|
|
|
+ photo_click ,
|
|
|
+ event_pay_first_day ,
|
|
|
+ event_pay_purchase_amount_first_day ,
|
|
|
+ event_pay ,
|
|
|
+ event_pay_purchase_amount ,
|
|
|
+ event_register ,
|
|
|
+ event_jin_jian_app ,
|
|
|
+ event_credit_grant_app ,
|
|
|
+ event_order_paid ,
|
|
|
+ event_order_paid_purchase_amount ,
|
|
|
+ event_jin_jian_landing_page ,
|
|
|
+ event_credit_grant_landing_page ,
|
|
|
+ event_next_day_stay ,
|
|
|
+ form_count,
|
|
|
+ play_3s_count)
|
|
|
+ values
|
|
|
+ <foreach collection="records" item="record" separator=",">
|
|
|
+ (
|
|
|
+ #{record.companyId} ,
|
|
|
+ #{record.companyName} ,
|
|
|
+ #{record.projectId} ,
|
|
|
+ #{record.projectName} ,
|
|
|
+ #{record.accountId} ,
|
|
|
+ #{record.signature} ,
|
|
|
+ #{record.charge} ,
|
|
|
+ #{record.photoShow} ,
|
|
|
+ #{record.aclick} ,
|
|
|
+ #{record.bclick} ,
|
|
|
+ #{record.downloadStarted} ,
|
|
|
+ #{record.downloadCompleted} ,
|
|
|
+ #{record.activation} ,
|
|
|
+ #{record.submit} ,
|
|
|
+ #{record.statDate} ,
|
|
|
+ #{record.photoClick} ,
|
|
|
+ #{record.eventPayFirstDay} ,
|
|
|
+ #{record.eventPayPurchaseAmountFirstDay} ,
|
|
|
+ #{record.eventPay} ,
|
|
|
+ #{record.eventPayPurchaseAmount} ,
|
|
|
+ #{record.eventRegister} ,
|
|
|
+ #{record.eventJinJianApp} ,
|
|
|
+ #{record.eventCreditGrantApp} ,
|
|
|
+ #{record.eventOrderPaid} ,
|
|
|
+ #{record.eventOrderPaidPurchaseAmount} ,
|
|
|
+ #{record.eventJinJianLandingPage} ,
|
|
|
+ #{record.eventCreditGrantLandingPage} ,
|
|
|
+ #{record.eventNextDayStay} ,
|
|
|
+ #{record.formCount} ,
|
|
|
+ #{record.play3sCount})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+ <select id="etlKuaishouAccountMaterialReportDailyList"
|
|
|
+ resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily">
|
|
|
+ select
|
|
|
+ c.company_id ,
|
|
|
+ c.company_name ,
|
|
|
+ u.project_id ,
|
|
|
+ p.project_name,
|
|
|
+ m.account_id,
|
|
|
+ m.signature,
|
|
|
+ sum(m.charge)as charge ,
|
|
|
+ sum(m.photo_show)as photo_show ,
|
|
|
+ sum(m.aclick)as aclick ,
|
|
|
+ sum(m.bclick)as bclick ,
|
|
|
+ sum(m.download_started)as download_started ,
|
|
|
+ sum(m.download_completed)as download_completed,
|
|
|
+ sum(m.activation)as activation ,
|
|
|
+ sum(m.submit)as submit,
|
|
|
+ stat_date,
|
|
|
+ sum(m.photo_click)as photo_click,
|
|
|
+ sum(m.event_pay_first_day)as event_pay_first_day,
|
|
|
+ sum(m.event_pay_purchase_amount_first_day)as event_pay_purchase_amount_first_day,
|
|
|
+ sum(m.event_pay)as event_pay,
|
|
|
+ sum(m.event_pay_purchase_amount)as event_pay_purchase_amount,
|
|
|
+ sum(m.event_register)as event_register,
|
|
|
+ sum(m.event_jin_jian_app)as event_jin_jian_app,
|
|
|
+ sum(m.event_credit_grant_app)as event_credit_grant_app,
|
|
|
+ sum(m.event_order_paid)as event_order_paid,
|
|
|
+ sum(m.event_order_paid_purchase_amount)as event_order_paid_purchase_amount,
|
|
|
+ sum(m.event_jin_jian_landing_page)as event_jin_jian_landing_page,
|
|
|
+ sum(m.event_credit_grant_landing_page )as event_credit_grant_landing_page,
|
|
|
+ sum(m.event_next_day_stay)as event_next_day_stay,
|
|
|
+ sum(m.form_count)as form_count,
|
|
|
+ round(sum(m.play_3s_ratio*m.photo_show))as play_3s_count
|
|
|
+ from ctop_kuaishou_report_daily_material m left join ctop_user_allocation u on u.account_id = m.account_id
|
|
|
+left join ctop_project p on p.id = u.project_id
|
|
|
+left join user_company c on c.user_id = u.account_id
|
|
|
+where m.signature is not null
|
|
|
+and m.stat_date = #{date} and m.account_id = #{accountId}
|
|
|
+group by m.account_id,m.signature
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+</mapper>
|