您的位置:首页 > 其它

第五章 mybatis批量更新update

2016-09-12 13:35 393 查看
一、所有的指定id的模型类的同一个字段进行批量更新

实际上:

update t set fileld='xx' where id in (id1,id2,...,idn)


代码:

<update id="updateBatch" parameterType="Map">
update t_name
set name = #{name,jdbcType=VARCHAR}
where autoid in
(
<foreach collection="list" item="item" separator=",">
#{item.id,jdbcType=BIGINT}
</foreach>
)
</update>


void updateBatch(@Param("list") List<User> list, @Param("name") String name);


二、指定id的模型类的不同字段进行批量更新

参考:http://blog.csdn.net/tolcf/article/details/39213217
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: