<?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="com.moka.gdtauto.mapper.TencentAccountMapper">

    <!-- 批量插入或更新账户信息 -->
    <insert id="batchInsertOrUpdate" parameterType="java.util.List">
        INSERT INTO tencent_account (
            org_account_id,
            job_number,
            account_id,
            corporation_name,
            is_bid,
            is_mp,
            is_adx,
            comment_list,
            comment_user_id,
            comment,
            create_time,
            update_time
        ) VALUES
        <foreach collection="accounts" item="account" separator=",">
            (
                #{account.orgAccountId},
                #{account.jobNumber},
                #{account.accountId},
                #{account.corporationName},
                #{account.isBid},
                #{account.isMp},
                #{account.isAdx},
                #{account.commentList},
                #{account.commentUserId},
                #{account.comment},
                NOW(),
                NOW()
            )
        </foreach>
        ON DUPLICATE KEY UPDATE
            corporation_name = VALUES(corporation_name),
            is_bid = VALUES(is_bid),
            is_mp = VALUES(is_mp),
            is_adx = VALUES(is_adx),
            comment_list = VALUES(comment_list),
            comment_user_id = VALUES(comment_user_id),
            comment = VALUES(comment),
            update_time = NOW()
    </insert>

</mapper>
