mysql 之 mybatis批量插入数据,批量修改
来源:互联网 发布:linux配置监控 编辑:程序博客网 时间:2024/06/08 15:07
1,//批量插入数据,传入参数list <insert id="insertInfo"> insert into tableName(id.... ) values <foreach collection="list" item="entity" index="index" separator=","> ( #{entity.id,jdbcType=VARCHAR}.... ) </foreach> </insert>
2,//批量修改数据
update table set column='...' where id in (1,2,3) //这样的sql就可以了。
//Mybatis中这样写就行 (针对修改相同的数据)<update id="update" parameterType="java.util.Map" > UPDATE tableNamw SET name = #{name}
WHERE id IN <foreach collection="list" item="entity" index="index" open="(" separator="," close=")"> #{entity.xxx} </foreach></update>
//(针对修改不同的数据)<update id="batchUpdate" parameterType="java.util.List"> <foreach close="" collection="list" index="index" item="item" open="" separator=";"> update tableNameset name=#{item.name,jdbcType=VARCHAR},age=#{item.age,jdbcType=INTEGER} where id=#{item.id,jdbcType=INTEGER} </foreach> </update>
阅读全文
2 0
- mysql 之 mybatis批量插入数据,批量修改
- MyBatis批量插入数据(MySql)
- MyBatis批量插入数据(MySql)
- 使用Mybatis向MySQL批量插入数据
- mybatis中批量插入数据(MYSQL)
- mybatis数据批量插入
- mybatis数据批量插入
- mybatis批量插入数据
- mybatis 批量插入数据
- MyBatis批量插入数据
- mybatis数据批量插入
- mybatis批量插入数据
- mybatis数据批量插入
- MyBatis批量插入数据
- MyBatis批量插入数据
- MyBatis批量插入数据
- MyBatis批量插入数据
- mybatis 批量插入数据
- js假分页(tabel)
- LeetCode 65. Valid Number
- NI/NDK开发指南(开山篇)
- JavaSE学习--正则表达式
- 查看hadoop版本信息和位数
- mysql 之 mybatis批量插入数据,批量修改
- STL源码剖析笔记1
- 【剑指offer】题1: 赋值运算符函数
- The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available...
- nginx启动失败Failed to reload nginx.service: Unit not found.
- Static详解
- PAT--1041. Be Unique
- jQuery基础(四)—动画篇
- 微信小程序例子——控制导航条加载动画