2 qttzyz qttzyz 于 2015.07.07 17:56 提问

参数list对象结果如何使用mybatis批量插入数据

使用mybatis oracle,当传来的参数是list对象结果集,如何批量插入数据

3个回答

strutce
strutce   Ds   Rxr 2015.07.07 18:10
已采纳

图片说明

strutce
strutce   Ds   Rxr 2015.07.07 18:08


<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->

<!--
表的序列查询
-->
select TABLE_SEQ.NEXTVAL from DUAL

</selectKey>
insert into TABLE
 ( ID,
    NAME,
    PASSWORD,
    AGE,
    CREATETIME)
    select tableseq.NEXTVAL,a.* from (
    <foreach collection="list" item="item" index="index"
        separator="union all">
        select
        #{item.name,jdbcType=VARCHAR} as name,
        #{item.password,jdbcType=VARCHAR} as password,#{item.age,jdbcType=BECIMAL} as age,#{item.createTime,jdbcType=TIMESTAMP} as createTime
        from dual
    </foreach>
    ) a

Evankaka
Evankaka   Ds   Rxr 2015.07.07 19:42


INSERT ALL

into TRX_BILL_DETAIL_INFO


ID,


CUST_NO,


TRANS_CODE,


TRANS_REFNO,


TRANS_SEQNO,


ORDER_NO,


TRANS_AMT,


BILL_DATE,


BILL_FLAG,


TRANS_DESC,




#{item.id,jdbcType=DECIMAL},


#{item.custNo,jdbcType=CHAR},


#{item.transCode,jdbcType=CHAR},


#{item.transRefno,jdbcType=CHAR},


#{item.transSeqno,jdbcType=VARCHAR},


#{item.orderNo,jdbcType=CHAR},


#{item.transAmt,jdbcType=DECIMAL},


#{item.billDate,jdbcType=DECIMAL},


#{item.billFlag,jdbcType=CHAR},


#{item.transDesc,jdbcType=VARCHAR},



select 1 from dual


Csdn user default icon
上传中...
上传图片
插入图片