<?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.EtlKuaishouReportVideoDailyMapper">

    <insert id="etlKuaishouVideoReportDailyByDate">
        replace into ctop_etl_kuaishou_report_video_daily (
    stat_date,
    video_code,
    charge,
    photo_show,
    aclick,
    photo_share,
    photo_comment,
    photo_like,
    follow,
    cancel_follow,
    report,
    block,
    negative,
    download_started,
    download_completed,
    activation,
    submit,
    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_cost ,
    event_order_paid_cost ,
    event_next_day_stay,
    form_cost ,
    form_count,
    play_3s_count
) select  stat_date,
        signature as video_code,
        sum(charge) as charge,
        sum(photo_show) as photo_show,
        sum(aclick)as aclick,
        sum(photo_share)as photo_share,
        sum(photo_comment)as photo_comment,
        sum(photo_like)as photo_like,
        sum(follow)as follow,
        sum(cancel_follow) as cancel_follow,
        sum(report)as report,
        sum(block)as block,
        sum(negative)as negative ,
        sum(download_started)as download_started ,
        sum(download_completed)as download_completed,
        sum(activation)as activation ,
        sum(submit)as submit ,
        sum(photo_click)as photo_click ,
        sum(event_pay_first_day)as event_pay_first_day ,
        sum(event_pay_purchase_amount_first_day)as event_pay_purchase_amount_first_day ,
        sum(event_pay)as event_pay ,
        sum(event_pay_purchase_amount)as event_pay_purchase_amount ,
        sum(event_register)as event_register ,
        sum(event_jin_jian_app)as event_jin_jian_app ,
        sum(event_credit_grant_app)as event_credit_grant_app ,
        sum(event_order_paid)as event_order_paid ,
        sum(event_order_paid_purchase_amount)as event_order_paid_purchase_amount ,
        sum(event_jin_jian_landing_page)as event_jin_jian_landing_page ,
        sum(event_credit_grant_landing_page)as event_credit_grant_landing_page ,
        sum(event_next_day_stay_cost)as event_next_day_stay_cost ,
        sum(event_order_paid_cost)as event_order_paid_cost ,
        sum(event_next_day_stay )as event_next_day_stay,
        sum(form_cost)as form_cost ,
        sum(form_count )as form_count,
        sum(play_3s_ratio*photo_show)as play_3s_count
from ctop_kuaishou_report_daily_material
where stat_date = #{date}
  and signature is not null
group by signature;
    </insert>
</mapper>
