批量更新语句存在where和set一一对应的批量更新需求,
在mybatis xml文件中如下:
UPDATE my_table SET colum = ( CASE id <foreach collection="list" item="item" separator=" "> WHEN #{item.id} THEN #{item.colum} </foreach> END ) WHERE id IN <foreach collection="list" item="item" open="(" close=")" separator=","> #{item.id} </foreach>