update 批量更新

update
tb_order
<trim prefix="set" suffixOverrides=",">
<trim prefix="logistics_name =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.logistics_name!=null">
when order_id=#{i.order_id} then #{i.logistics_name}
</if>
</foreach>
</trim>
<trim prefix=" logistics_code =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.logistics_code!=null">
when order_id=#{i.order_id} then #{i.logistics_code}
</if>
</foreach>
</trim>

<trim prefix="order_status =case" suffix="end," >
<foreach collection="list" item="i" index="index">
<if test="i.order_status!=null">
when order_id=#{i.order_id} then #{i.order_status}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
order_id=#{i.order_id}
</foreach>

猜你喜欢

转载自www.cnblogs.com/g-yang/p/10330776.html