<?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.hosting.mapper.KuaishouHostingTaskMapper">

    <insert id="addBatch">
        insert into ctop_kuaishou_hosting_task(
        template_id,
        project_id,
        account_id,
        `name`,
        hosting_scene,
        campaign_type,
        app_id,
        web_uri,
        use_app_market,
        app_store,
        sticker_styles,
        cover_slogans,
        action_bar,
        captions,
        click_url,
        actionbar_click_url,
        auto_create_photo,
        schedule,
        day_budget,
        ocpx_action_type,
        cpa_bid,
        deep_conversion_type,
        deep_conversion_bid,
        site_id,
        smart_cover,
        roi_ratio,
        consult_id,
        merchandise_id,
        merchandise_type,
        asset_mining,
        fiction_id,
        web_uri_type,
        min_age,
        max_age,
        ages_range,
        population,
        exclude_population,
        paid_audience,
        gender,
        region_ids,
        user_type,
        is_open,
        no_age_break,
        no_gender_break,
        no_area_break,
        platform_os,
        platform_ov,
        filter_converted_level,
        rule_enable,
        campaign_name_rule,
        unit_name_rule,
        creative_name_rule,
        photo_infos,
        task_status,
        remarks,
        scene_ids
        )
        values
        <foreach collection="addList" item="add" separator=",">
            (
            #{add.templateId},
            #{add.projectId},
            #{add.accountId},
            #{add.name},
            #{add.hostingScene},
            #{add.campaignType},
            #{add.appId},
            #{add.webUri},
            #{add.useAppMarket},
            #{add.appStore},
            #{add.stickerStyles},
            #{add.coverSlogans},
            #{add.actionBar},
            #{add.captions},
            #{add.clickUrl},
            #{add.actionbarClickUrl},
            #{add.autoCreatePhoto},
            #{add.schedule},
            #{add.dayBudget},
            #{add.ocpxActionType},
            #{add.cpaBid},
            #{add.deepConversionType},
            #{add.deepConversionBid},
            #{add.siteId},
            #{add.smartCover},
            #{add.roiRatio},
            #{add.consultId},
            #{add.merchandiseId},
            #{add.merchandiseType},
            #{add.assetMining},
            #{add.fictionId},
            #{add.webUriType},
            #{add.minAge},
            #{add.maxAge},
            #{add.agesRange},
            #{add.population},
            #{add.excludePopulation},
            #{add.paidAudience},
            #{add.gender},
            #{add.regionIds},
            #{add.userType},
            #{add.isOpen},
            #{add.noAgeBreak},
            #{add.noGenderBreak},
            #{add.noAreaBreak},
            #{add.platformOs},
            #{add.platformOv},
            #{add.filterConvertedLevel},
            #{add.ruleEnable},
            #{add.campaignNameRule},
            #{add.unitNameRule},
            #{add.creativeNameRule},
            #{add.photoInfos},
            #{add.taskStatus},
            #{add.remarks},
            #{add.sceneIds}
            )
        </foreach>

    </insert>
    <update id="updateStatusById">
        update ctop_kuaishou_hosting_task
        set task_status = #{taskStatus},
        remarks = #{remarks}
        where id = #{id}
    </update>
    <update id="updateInfoById">
        update ctop_kuaishou_hosting_task
        set
        project_id = #{projectId},
        campaign_id = #{campaignId},
        task_status = #{taskStatus},
        remarks = #{remarks}
        where id = #{id}
    </update>
    <select id="getMaterialType" resultType="java.lang.Integer">
        select  material_type from ctop_kuaishou_video_get
        where photo_id = #{photoId}
        limit 1

    </select>
</mapper>