<update id="batchUpdateRestaurantExt" parameterType="com.gingersoft.common.entity.RestaurantExt">
update t_restaurant
<set>
<trim prefix="restaurant_id = case" suffix="end,">
<foreach collection="list" item="i">
<if test="i.restaurantId != null">
when ID = #{i.id} then #{i.restaurantId}
</if>
</foreach>
</trim>
<trim prefix="settingName = case" suffix="end,">
<foreach collection="list" item="i">
<if test="i.settingName != null">
when ID = #{i.id} then #{i.settingName}
</if>
</foreach>
</trim>
</set>
WHERE ID in
<foreach collection="list" separator="," item="i" open="(" close=")">
#{i.id}
</foreach>
</update>
update 批量修改(根據不同id,修改不同的值)
最新推荐文章于 2023-07-22 07:59:20 发布