mybatis 批量插入
来源:互联网 发布:pdf编辑mac版 编辑:程序博客网 时间:2024/05/16 06:12
List<Emp> emps = new ArrayList<Emp>();
Emp emp = new Emp();
emp.setEmpid(225);
emp.setEmpname("严俊!!!");
Dep dep = sqlSessionTemplate.selectOne("hwt.Mapper.DepMapper.selectPK", 1);
emp.setDep(dep);
emps.add(emp);
Emp emp2 = new Emp();
emp2.setEmpid(153);
emp2.setEmpname("严俊!!!@@@");
Dep dep2 = sqlSessionTemplate.selectOne("hwt.Mapper.DepMapper.selectPK", 1);
emp2.setDep(dep2);
emps.add(emp2);
sqlSessionTemplate.update("hwt.Mapper.EmpMapper.insertBatch", emps);
<!-- 批量插入 -->
<insert id="insertBatch" parameterType="arraylist">
insert into emp(empid,empname,depid)
<!-- collection可以是List对于list,数组对于array,Map对应ids -->
<foreach collection="list" item="emp" index="index" separator="union all">
select #{emp.empid,jdbcType=NUMERIC},#{emp.empname,jdbcType=VARCHAR},#{emp.dep.depid,jdbcType=NUMERIC} from dual
</foreach>
</insert>
- mybatis批量插入、批量删除
- Mybatis 批量插入、批量更新
- Mybatis-批量查询&&批量插入
- mybatis数据批量插入
- mybatis 批量插入
- mybatis批量插入
- mybatis数据批量插入
- mybatis 批量插入
- mybatis 批量插入
- mybatis批量插入数据
- mybatis 批量插入
- mybatis批量插入
- MyBatis中批量插入
- mybatis 批量插入数据
- MyBatis批量插入数据
- mybatis批量插入
- mybatis数据批量插入
- mybatis 批量插入
- 紫外线消毒器应用UV灯管技术优缺点对比
- SharedPreferences
- 【代码】DataTable转换成List<T>集合
- MVC传递数据的方式
- Linux下paste命令,按列合并文件,很实用
- mybatis 批量插入
- MYSQL学习笔记-mysql分区基本操作
- iframe自适高度
- MVC Html.AntiForgeryToken() 防止CSRF攻击
- 第一次总结报告——Vibe
- 自定义drawable(shape)
- Github Page 绑定域名
- Trac的安装与配置,整合LDAP与SVN
- mybatis整合spring的 泛型DAO接口