赵计刚
每天进步一点点

一、所有的指定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

 

posted on   赵计刚  阅读(5420)  评论(0编辑  收藏  举报
努力加载评论中...

点击右上角即可分享
微信分享提示