mybatis 批量添加(oracle)

<insert id="insert" parameterType="java.util.List">        
        insert into ad_warn_detail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            id,content,cr_time,
            cr_date,
            rule_type,merch_no,merchant_name,newest_time,ip,
        </trim>
        
         select S_AD_WARN_DETAIL.NEXTVAL,cd.* from(  
        <foreach collection="list" item="detail"
                    index="index" separator="union all">              
            <if test="detail != null">
                select
                    <trim suffixOverrides=",">
                        #{detail.content,jdbcType=VARCHAR},
                        #{detail.crTime,jdbcType=VARCHAR},#{detail.crDate,jdbcType=VARCHAR},
                        #{detail.ruleType,jdbcType=VARCHAR},
                        #{detail.merchNo,jdbcType=VARCHAR},#{detail.merchantName,jdbcType=VARCHAR},
                        #{detail.newestTime,jdbcType=VARCHAR},#{detail.ip,jdbcType=VARCHAR},
                    </trim>
                from dual
            </if>
        </foreach>
        )cd
    </insert>

猜你喜欢

转载自blog.csdn.net/u010313441/article/details/74523685