<?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.batch.mapper.KuaishouOperationRecordMapper">

    <delete id="deleteOperationRecordInfoAccount">
        delete
        from
        ctop_kuaishou_operation_record_account
        where
        account_id = #{record.accountId}
        and
        stat_date = #{record.statDate}
        <!--
        and
        object_id = #{record.objectId}
        and
        operation_type = #{record.operationType}
        and
        operation_target = #{record.operationTarget}
        and
        role_type = #{record.roleType}
        and
        operation_time = #{record.operationTime}
        -->
    </delete>

    <insert id="insertOperationRecordInfoAccount">
        replace into
        ctop_kuaishou_operation_record_account
        (
        account_id,
        stat_date,
        operation_time,
        operation_type,
        role_type,
        object_name,
        operation_target,
        object_id,
        log
        )
        values
        <foreach item="record" index="index" collection="records"  separator="," >
            (
            #{record.accountId},
            #{record.statDate},
            #{record.operationTime},
            #{record.operationType},
            #{record.roleType},
            #{record.objectName},
            #{record.operationTarget},
            #{record.objectId},
            #{record.log}
            )
        </foreach>

    </insert>





    <delete id="deleteOperationRecordInfoCampaign">
        delete
        from
        ctop_kuaishou_operation_record_campaign
        where
        account_id = #{record.accountId}
        and
        stat_date = #{record.statDate}
        <!--
           and
           object_id = #{record.objectId}
           and
           operation_type = #{record.operationType}
           and
           operation_target = #{record.operationTarget}
           and
           role_type = #{record.roleType}
           and
           operation_time = #{record.operationTime}
           -->
    </delete>

    <insert id="insertOperationRecordInfoCampaign">
        replace into
        ctop_kuaishou_operation_record_campaign
        (
        account_id,
        stat_date,
        operation_time,
        operation_type,
        role_type,
        object_name,
        operation_target,
        object_id,
        log
        )
        values
        <foreach item="record" index="index" collection="records"  separator="," >
            (
            #{record.accountId},
            #{record.statDate},
            #{record.operationTime},
            #{record.operationType},
            #{record.roleType},
            #{record.objectName},
            #{record.operationTarget},
            #{record.objectId},
            #{record.log}
            )
        </foreach>

    </insert>


    <delete id="deleteOperationRecordInfoUnit">
        delete
        from
        ctop_kuaishou_operation_record_unit
        where
        account_id = #{record.accountId}
        and
        stat_date = #{record.statDate}
        <!--
         and
         object_id = #{record.objectId}
         and
         operation_type = #{record.operationType}
         and
         operation_target = #{record.operationTarget}
         and
         role_type = #{record.roleType}
         and
         operation_time = #{record.operationTime}
         -->
    </delete>

    <insert id="insertOperationRecordInfoUnit">
        replace into
        ctop_kuaishou_operation_record_unit
        (
        account_id,
        stat_date,
        operation_time,
        operation_type,
        role_type,
        object_name,
        operation_target,
        object_id,
        log
        )
        values
        <foreach item="record" index="index" collection="records"  separator="," >
            (
            #{record.accountId},
            #{record.statDate},
            #{record.operationTime},
            #{record.operationType},
            #{record.roleType},
            #{record.objectName},
            #{record.operationTarget},
            #{record.objectId},
            #{record.log}
            )
        </foreach>

    </insert>




    <delete id="deleteOperationRecordInfoCreative">
        delete
        from
        ctop_kuaishou_operation_record_creative
        where
        account_id = #{record.accountId}
        and
        stat_date = #{record.statDate}
        <!--
        and
        object_id = #{record.objectId}
        and
        operation_type = #{record.operationType}
        and
        operation_target = #{record.operationTarget}
        and
        role_type = #{record.roleType}
        and
        operation_time = #{record.operationTime}
        -->
    </delete>

    <insert id="insertOperationRecordInfoCreative">
        replace into
        ctop_kuaishou_operation_record_creative
        (
        account_id,
        stat_date,
        operation_time,
        operation_type,
        role_type,
        object_name,
        operation_target,
        object_id,
        log
        )
        values
        <foreach item="record" index="index" collection="records"  separator="," >
            (
            #{record.accountId},
            #{record.statDate},
            #{record.operationTime},
            #{record.operationType},
            #{record.roleType},
            #{record.objectName},
            #{record.operationTarget},
            #{record.objectId},
            #{record.log}
            )
        </foreach>

    </insert>



    <delete id="deleteOperationRecordInfoVideo">
        delete
        from
        ctop_kuaishou_operation_record_video
        where
        account_id = #{record.accountId}
        and
        stat_date = #{record.statDate}
        <!--
        and
        object_id = #{record.objectId}
        and
        operation_type = #{record.operationType}
        and
        operation_target = #{record.operationTarget}
        and
        role_type = #{record.roleType}
        and
        operation_time = #{record.operationTime}
        -->
    </delete>

    <insert id="insertOperationRecordInfoVideo">
        replace into
        ctop_kuaishou_operation_record_video
        (
        account_id,
        stat_date,
        operation_time,
        operation_type,
        role_type,
        object_name,
        operation_target,
        object_id,
        log
        )
        values
        <foreach item="record" index="index" collection="records"  separator="," >
            (
            #{record.accountId},
            #{record.statDate},
            #{record.operationTime},
            #{record.operationType},
            #{record.roleType},
            #{record.objectName},
            #{record.operationTarget},
            #{record.objectId},
            #{record.log}
            )
        </foreach>

    </insert>




    <delete id="deleteOperationRecordInfoApp">
        delete
        from
        ctop_kuaishou_operation_record_app
        where
        account_id = #{record.accountId}
        and
        stat_date = #{record.statDate}
        <!--
        and
        object_id = #{record.objectId}
        and
        operation_type = #{record.operationType}
        and
        operation_target = #{record.operationTarget}
        and
        role_type = #{record.roleType}
        and
        operation_time = #{record.operationTime}
        -->
    </delete>

    <insert id="insertOperationRecordInfoApp">
        replace into
        ctop_kuaishou_operation_record_app
        (
        account_id,
        stat_date,
        operation_time,
        operation_type,
        role_type,
        object_name,
        operation_target,
        object_id,
        log
        )
        values
        <foreach item="record" index="index" collection="records"  separator="," >
            (
            #{record.accountId},
            #{record.statDate},
            #{record.operationTime},
            #{record.operationType},
            #{record.roleType},
            #{record.objectName},
            #{record.operationTarget},
            #{record.objectId},
            #{record.log}
            )
        </foreach>

    </insert>



    <delete id="deleteOperationRecordInfoPackage">
        delete
        from
        ctop_kuaishou_operation_record_package
        where
        account_id = #{record.accountId}
        and
        stat_date = #{record.statDate}
        <!--
        and
        object_id = #{record.objectId}
        and
        operation_type = #{record.operationType}
        and
        operation_target = #{record.operationTarget}
        and
        role_type = #{record.roleType}
        and
        operation_time = #{record.operationTime}
        -->
    </delete>

    <insert id="insertOperationRecordInfoPackage">
        replace into
        ctop_kuaishou_operation_record_package
        (
        account_id,
        stat_date,
        operation_time,
        operation_type,
        role_type,
        object_name,
        operation_target,
        object_id,
        log
        )
        values
        <foreach item="record" index="index" collection="records"  separator="," >
            (
            #{record.accountId},
            #{record.statDate},
            #{record.operationTime},
            #{record.operationType},
            #{record.roleType},
            #{record.objectName},
            #{record.operationTarget},
            #{record.objectId},
            #{record.log}
            )
        </foreach>

    </insert>


</mapper>
