<?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.rj.mapper.LbGoodsMapper">

    <insert id="upsertBatch">
        INSERT INTO lb_goods (
            id, tenant_id, old_id, user_id, title, image, price, total_money,
            quantity, seller_id, is_show, status, current_page, created_at, updated_at
        ) VALUES
        <foreach collection="list" item="item" separator=",">
            (
                #{item.id}, #{item.tenantId}, #{item.oldId}, #{item.userId}, #{item.title},
                #{item.image}, #{item.price}, #{item.totalMoney}, #{item.quantity},
                #{item.sellerId}, #{item.isShow}, #{item.status}, #{item.currentPage},
                #{item.createdAt}, #{item.updatedAt}
            )
        </foreach>
        ON DUPLICATE KEY UPDATE
            tenant_id = VALUES(tenant_id),
            old_id = VALUES(old_id),
            user_id = VALUES(user_id),
            title = VALUES(title),
            image = VALUES(image),
            price = VALUES(price),
            total_money = VALUES(total_money),
            quantity = VALUES(quantity),
            seller_id = VALUES(seller_id),
            is_show = VALUES(is_show),
            status = VALUES(status),
            current_page = VALUES(current_page),
            created_at = VALUES(created_at),
            updated_at = VALUES(updated_at)
    </insert>

</mapper>
