<insert id="batchInsert">
        insert into cp_coupon_code
        (coupon_code,coupon_id,bind_id)
        select a.*
        from
        (
        <foreach collection="list" item="item" separator="UNION ALL">
            select
            #{item.couponCode, jdbcType=VARCHAR} coupon_code,
            #{item.couponId, jdbcType=NUMERIC} coupon_id,
            #{item.bindId, jdbcType=NUMERIC} bind_id
            from dual
        </foreach>
        ) a
    </insert>
    -- 上面的报错,就用下面的
    <insert id="addSkuIdBatch">
        insert into sup_jd_goods_sku_temp(
        sku_id
        ,page_num
        ,supplier_id
        )
        <foreach collection="list" item="item" separator="UNION ALL">
            select
            #{item.skuId}
            ,#{item.pageNum}
            ,#{item.supplierId}
            from dual
        </foreach>
    </insert>
posted on 2022-03-30 18:36  被杜撰的风  阅读(353)  评论(0)    收藏  举报