//sql
UPDATE init set value ='300'WHERE id ='1'//InitMapper@Update({"<script>"+"<foreach collection='initList' item='item' separator=';'>"+"UPDATE init set value = #{item.value} WHERE id = #{item.id}"+"</foreach>"+"</script>"})
2.方式二:
//sql
UPDATE init
SET value = CASE id
WHEN 1 THEN 700
WHEN 2 THEN 800
END,
key = CASE id
WHEN 1 THEN '呵呵'
WHEN 2 THEN '哈哈'
END
WHERE id IN (1,2)//InitMapper@Update({"<script>"+"UPDATE init "+"set value = CASE id"+"<foreach collection='initList' item='item' index='index'>"+"WHEN #{item.id} THEN #{item.value}"+"</foreach>"+"END,"+"update_time = CASE id"+"<foreach collection='initList' item='item' index='index'>"+"WHEN #{item.id} THEN now()"+"</foreach>"+"END "+"WHERE id IN"+"<foreach collection='initList' item='item' index='index' open='(' separator=',' close=')'>"+"#{item.id}"+"</foreach>"+"</script>"})
springboot批量修改的方式---sql修改语句1.方式一:2.方式二:1.方式一://sqlUPDATE init set value = '300' WHERE id = '1'//InitMapper@Update({"<script>" + "<foreach collection='initList' item='item' separator=';'>" + "UPDATE init set value =