赵计刚
每天进步一点点

一、所有的指定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 2016-09-12 13:35  赵计刚  阅读(5429)  评论(0)    收藏  举报