mybatis 批量添加对象

  <!-- 【添加  批量】 insertBatch -->
   <insert id="insertBatch" parameterType="list">
   insert e_Kpnr(id,ghdw_id,hwhyslwmc, ggxh, dw, sl, dj, je, shlv, se)
   values
   <foreach collection="list" item="obj" index="index" separator="," >
      (#{obj.id},#{obj.ghdwId},#{obj.hwhyslwmc},#{obj.ggxh},#{obj.dw},#{obj.sl},#{obj.dj},#{obj.je},
      #{obj.shlv},#{obj.se})
   </foreach>
   </insert>

(更多的批量操作见:http://topmanopensource.iteye.com/blog/1833001)

时间: 2024-08-11 07:47:13

mybatis 批量添加对象的相关文章

Mybatis批量添加对象List

1.对应的xml文件: <!--批量添加--><insert id="insertStandardItemInfo" parameterType="hashmap"> insert into t_standard_item(standard_id,item_id) values <foreach collection="itemIdList" index="index" item="it

myBatis批量添加,修改和删除

摘自: http://blog.csdn.net/myjlvzlp/article/details/8434376 1.批量添加元素session.insert(String string,Object o) public void batchInsertStudent(){ List<Student> ls = new ArrayList<Student>(); for(int i = 5;i < 8;i++){ Student student = new Student(

mybatis批量添加、批量删除

<!-- 批量添加 --> <insert id="insertNameListSynHisBatch" parameterType="java.util.List" useGeneratedKeys="false"> insert into tb_namelist_syn_his (SERIAL, RECORDNUMBER, HASHTBNAME, CTLTYPE, SOURCE, CREATETIME, CKEY, C

MyBatis批量添加和删除

p.MsoNormal,li.MsoNormal,div.MsoNormal { margin: 0cm; margin-bottom: .0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线 } h1 { margin-right: 0cm; margin-left: 0cm; font-size: 24.0pt; font-family: 宋体; font-weight: bold } p { margin-right

Mybatis批量添加,删除与修改

1.批量添加元素session.insert(String string,object O) public void batchInsertStudent(){ List<Student> ls = new ArrayList<Student>(); for(int i = 5;i < 8;i++){ Student student = new Student(); student.setId(i); student.setName("maoyuanjun"

Mybatis -- 批量添加 -- insertBatch

啦啦啦 ---------------InsertBatch Class : Dao /** * 批量插入perfEnvirons * * @author Liang * * 2017年4月25日 */ void insertBatch(List<PerfEnviron> perfEnvirons); XML : <insert id="insertBatch"> INSERT INTO perf_environ(node_id,`type`,perf_time

mybatis批量添加数据的三种方式

原文地址:https://www.cnblogs.com/gxyandwmm/p/9565002.html 原文地址:https://www.cnblogs.com/liu1275271818/p/12117925.html

【mybatis】之批量添加

mybatis批量添加xml <insert id="batchCreate"> INSERT INTO `roomer` (`order`,name,idCard,mobile,timePreCheckin,timePreCheckout,hotel) values <foreach collection="collection" item="item" index="index" separator=&q

mybatis批量导入 ,出现异常全部不添加(回滚)

public int importModel(MultipartFile file) throws Exception{ String fileName = file.getOriginalFilename(); String suffxName = fileName.substring(fileName.lastIndexOf(".",fileName.length()) ); //System.out.println(fileName+",后缀名:"+suffx