Mybatis批量更新数据
来源:互联网 发布:数据库知识点总结 编辑:程序博客网 时间:2024/05/19 02:00
Mybatis批量更新数据
第一种方式
- <update id="updateBatch" parameterType="Map">
- update aa set
- a=#{fptm},
- b=#{csoftrain}
- where c in
- <foreach collection="cs" index="index" item="item" pen="("separator=","close=")">
- #{item}
- </foreach>
- </update>
但是这种方式修改的字段值都是一样的。
第二种方式
修改数据库连接配置:&allowMultiQueries=true
比如:jdbc:mysql://192.168.1.236:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
- <update id="batchUpdate" parameterType="java.util.List">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- update test
- <set>
- test=${item.test}+1
- </set>
- where id = ${item.id}
- </foreach>
- </update>
这种方式,可以一次执行多条SQL语句
摘录自:http://blog.csdn.net/tolcf/article/details/39213217
阅读全文
0 0
- Mybatis批量更新数据
- Mybatis批量更新数据
- Mybatis批量更新数据
- Mybatis批量更新数据
- Mybatis批量更新数据
- Mybatis批量更新数据
- mybatis批量更新数据
- Mybatis批量更新数据
- Mybatis批量更新数据
- Mybatis批量更新数据
- Mybatis批量插入更新数据
- Mybatis批量更新数据问题
- Mybatis批量更新和插入数据
- mybatis笔记-mysql批量更新数据
- Mybatis 批量增加,批量更新
- Mybatis 批量插入、批量更新
- Mybatis批量更新
- Mybatis批量更新
- 读书笔记之《代码大全2》
- ubuntu下鼠标右键没有新建文档?
- 总结: OC调用JS方法和给JS赋值
- Error:(1, 0) Plugin with id 'com.android.application' not found.
- Construct BinaryTree from Inorder and Postorder Traversal
- Mybatis批量更新数据
- VMware vSphere Client WIN10安装问题
- 混淆矩阵
- java中嵌入javascript
- Mysql 存储过程小例子
- 面试题之树中两个节点的最低公共祖先节点
- python中装饰器的简单用法
- 服务器搭建
- Lab_6