<?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="ctop.bytedance.ad.advertise.mapper.AiBytedanceAdvertiserStrategyMapper">

    <!-- 账户 修改 头条 配置信息 状态 -->
    <update id="updStaByAccountId">
        UPDATE ctop_ai_bytedance_advertiser_strategy
            SET status = #{state}
        WHERE 1 = 1
        <if test="accountId !=null and accountId != ''">
            AND account_id = #{accountId}
        </if>
        <if test="creativeImageMode !=null and creativeImageMode != ''">
            AND creative_image_mode = #{creativeImageMode}
        </if>
        <if test="id !=null and id != ''">
            AND id != #{id}
        </if>
    </update>

    <!--修改 头条 配置信息 状态 -->
    <update id="updStaById">
        UPDATE ctop_ai_bytedance_advertiser_strategy
            SET status = #{state}
        WHERE
            id = #{id}
    </update>

    <!--修改 头条 配置信息 出价  -->
    <update id="updCpaById">
        UPDATE ctop_ai_bytedance_advertiser_strategy
        <set>
            <if test="adCpaBid != null">
                ad_cpa_bid = #{adCpaBid},
            </if>
            <if test="adMaxBid != null">
                ad_max_bid = #{adMaxBid},
            </if>
            <if test="adMinBid != null">
                ad_min_bid = #{adMinBid},
            </if>
            <if test="adStepBid != null">
                ad_step_bid = #{adStepBid},
            </if>
        </set>
        WHERE
            id = #{id}
    </update>

    <!--修改 头条 配置信息 预算 -->
    <update id="updBudgetById">
        UPDATE ctop_ai_bytedance_advertiser_strategy
        <set>
            <if test="budget != null">
                account_budget = #{budget},
            </if>
            <if test="budgetType != null">
                account_budget_mode = #{budgetType},
            </if>
        </set>
        WHERE
            id = #{id}
    </update>

</mapper>