<update id="batchUpdate" parameterType="java.util.List">
update table
<trim prefix="set" suffixOverrides=",">
<trim prefix=" `name` = case " suffix=" end, ">
<foreach collection="list" item="item">
when id = #{item.id} then #{item.name}
</foreach>
</trim>
</trim>
where
id in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item.id}
</foreach>
</update>
Mybatis不同id不同值批量更新拼接
于 2024-05-13 23:35:50 首次发布