Mybatis根据List批量更新
<!--批量更新-->
<update id="updateList">
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
update user
<trim prefix="SET" suffixOverrides=",">
<if test="item.age!= null ">age= #{item.age},</if>
<if test="item.name!= null and item.name!= ''">name= #{item.name},</if>
</trim>
where id= #{item.id}
</foreach>
</update>
还没有评论,来说两句吧...