Mybatis 批量操作
2018-04-10 16:38
260 查看
1. TestMapper
// 批量修改 int updateBatch(@Param("id") int[] id, String test);
2. TestMapper.xml
<update id="updateBatch"> UPDATE table_name SET test = #{1} WHERE id IN <foreach collection="id" item="item" open="(" separator="," close=")"> #{item} </foreach> </update>
3. 调用
int[] id = new int[]{1, 2, 3}; updateBatch(id, "test"); // 相当于执行如下 sql 语句 : // UPDATE table_name SET test = 'test' WHERE id IN (1,2,3)
相关文章推荐
- mybatis批量操作oracle
- MyBatis学习总结(10)——批量操作
- mybatis之mysql&oracle 批量操作
- MyBatis的几种批量操作
- MyBatis批量操作报错:Parameter 'xxxList' not found. Available parameters are [list]
- mybatis以map的方式批量插入list集合数据操作步骤
- Mybatis 批量操作
- SpringMVC + Mybatis +JSON + mysql 进行批量插入的实例操作
- MYBATIS+MYSQL 批量操作数据库
- mybatis针对Oracle数据库进行(单个或多个条件)批量操作(新增、修改、删除)的sql写法--mysql
- MyBatis魔法堂:Insert操作详解(返回主键、批量插入)
- mybatis 中之批量删除操作
- MyBatis:Insert操作详解(返回主键、批量插入)
- MyBatis 批量操作、集合遍历-foreach
- Mybatis Oracle批量操作
- mybatis 批量 操作数据
- MyBatis批量操作报错:Parameter 'xxxList' not found. Available parameters are [list]
- MyBatis中的批量删除操作
- MyBatis批量操作报错:Parameter 'xxxList' not found. Avail
- MyBatis的几种批量操作