<?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.KuaiShouGroupMapper">
    <insert id="replaceBatch">
        replace into ctop_kuaishou_group(
        id,
        account_id,
        campaign_id,
        unit_id,
        unit_name,
        status,
        put_status,
        create_channel,
        review_detail,
        bid_type,
        bid,
        cpa_bid,
        ocpx_action_type,
        deep_conversion_type,
        deep_conversion_bid,
        day_budget,
        speed,
        begin_time,
        end_time,
        schedule_time,
        scene_id,
        show_mode,
        unit_type,
        url_type,
        url,
        app_id,
        app_icon_url,
        convert_id,
        use_app_market,
        group_create_time,
        group_update_time,
        create_time,
        update_time)
        values
        <foreach collection="groups" item="getGroup" separator=",">
            (
            #{getGroup.id},
            #{getGroup.accountId},
            #{getGroup.campaignId},
            #{getGroup.unitId},
            #{getGroup.unitName},
            #{getGroup.status},
            #{getGroup.putStatus},
            #{getGroup.createChannel},
            #{getGroup.reviewDetail},
            #{getGroup.bidType},
            #{getGroup.bid},
            #{getGroup.cpaBid},
            #{getGroup.ocpxActionType},
            #{getGroup.deepConversionType},
            #{getGroup.deepConversionBid},
            #{getGroup.dayBudget},
            #{getGroup.speed},
            #{getGroup.beginTime},
            #{getGroup.endTime},
            #{getGroup.scheduleTime},
            #{getGroup.sceneId},
            #{getGroup.showMode},
            #{getGroup.unitType},
            #{getGroup.urlType},
            #{getGroup.url},
            #{getGroup.appId},
            #{getGroup.appIconUrl},
            #{getGroup.convertId},
            #{getGroup.useAppMarket},
            #{getGroup.groupCreateTime},
            #{getGroup.groupUpdateTime},
            #{getGroup.createTime},
            #{getGroup.updateTime})
        </foreach>
    </insert>


    <select id="selectWarningGroup" resultType="java.lang.String">
   SELECT
   unit_name
   FROM ctop_kuaishou_group
   WHERE account_id = #{accountId}
   and (cpa_bid &gt; #{maxBid} or bid &gt; #{maxBid})
   and status = 20
   group by unit_id
    </select>


    <select id="selectWarningCpaBid" resultType="java.lang.String">
   SELECT
   unit_name
   FROM ctop_kuaishou_group
   WHERE account_id = #{accountId}
   and deep_conversion_bid &gt; #{maxBid}
   group by unit_id
    </select>


</mapper>
