<?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.KuaiShouCampaignMapper">
    <insert id="replaceBatch">
        replace into ctop_kuaishou_campaign(
        id,
        account_id,
        campaign_id,
        campaign_name,
        status,
        day_budget,
        campaign_type,
        put_status,
        create_channel,
        put_create_time,
        put_update_time,
        create_time,
        update_time)
        values
        <foreach collection="campaigns" item="campaign" separator=",">
            (#{campaign.id},
            #{campaign.accountId},
            #{campaign.campaignId},
            #{campaign.campaignName},
            #{campaign.status},
            #{campaign.dayBudget},
            #{campaign.campaignType},
            #{campaign.putStatus},
            #{campaign.createChannel},
            #{campaign.putCreateTime},
            #{campaign.putUpdateTime},
            #{campaign.createTime},
            #{campaign.updateTime})
        </foreach>
    </insert>

    <select id="queryIdsByPutStatus" resultType="java.lang.Long">
        SELECT campaign_id
        FROM
        ctop_kuaishou_campaign
        WHERE account_id = #{accountId}
        AND put_status = #{putStatus}
    </select>
</mapper>
