码迷,mamicode.com
首页 > 其他好文 > 详细

MyBatis批量插入

时间:2016-11-28 17:32:07      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:mybatis

List<LoanRepay>  = ;
loanRepayDAO.batchInsert(allLoanRepayList);

batchInsert(List<LoanRepay> loanRepayList){
    getSqlSession().insert(++,loanRepayList);
}

<insert id="batchInsert" parameterType="LoanRepay" useGeneratedKeys="true" keyProperty="id">
    insert into loan_repay(
    loano,
    mercno,
    mgrno,
    custno,
    idx,
    paydate,
    tc,
    pay,
    rptime,
    state,
    vn,
    crtime,
    uptime
    ) values
    <foreach collection="list" item="item" index="index" separator="," >
    (
    #{item.loano},
    #{item.mercno},
    #{item.mgrno},
    #{item.custno},
    #{item.idx},
    #{item.paydate},
    #{item.tc},
    #{item.pay},
    #{item.rptime},
    #{item.state},
    1,
    current_timestamp,
    current_timestamp
    )
    </foreach>
</insert>


本文出自 “熔 岩” 博客,请务必保留此出处http://lavasoft.blog.51cto.com/62575/1877413

MyBatis批量插入

标签:mybatis

原文地址:http://lavasoft.blog.51cto.com/62575/1877413

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!