<?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.dimension.mapper.KuaiShouDimensionCreativeMapper">

    <insert id="addBatch">
        insert into ctop_kuaishou_dimension_creative(
        account_id,
        strategy_id,
        campaign_id,
        unit_table_id,
        creative_name,
        photo_id,
        creative_material_type,
        action_bar_text,
        description,
        click_track_url,
        actionbar_click_url,
        creative_category,
        creative_tag
        )
        values
        <foreach collection="addList" item="ad" separator=",">
            (
            #{ad.accountId},
            #{ad.strategyId},
            #{ad.campaignId},
            #{ad.unitTableId},
            #{ad.creativeName},
            #{ad.photoId},
            #{ad.creativeMaterialType},
            #{ad.actionBarText},
            #{ad.description},
            #{ad.clickTrackUrl},
            #{ad.actionbarClickUrl},
            #{ad.creativeCategory},
            #{ad.creativeTag}
            )
        </foreach>
    </insert>
    <update id="updateBy">
        UPDATE ctop_kuaishou_dimension_creative
        SET create_status = 4,
        create_describe = '当日创意创建超限'
        where unit_table_id = #{unitTableId}
        and create_status = 0

    </update>
    <delete id="removeByUnitTableIds">
        delete from ctop_kuaishou_dimension_creative
        where unit_table_id in
        <foreach collection="ids" item="item" separator=","
                 open="(" close=")">
            #{item}
        </foreach>
    </delete>
    <select id="getAccountList" resultType="java.lang.Long">
        select DISTINCT account_id  from ctop_kuaishou_dimension_creative WHERE create_status = 4
    </select>
</mapper>