<insert id="batchAddFood">
insert into wx_food (className,`tagName`,createdAt,updatedAt)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.tagName}, #{item.className},now(),now())
</foreach>
ON DUPLICATE KEY UPDATE
`className` = values(`className`),
`tagName` = values(`tagName`),
updatedAt = now();
</insert>
更新或者插入数据
最新推荐文章于 2024-01-12 16:29:05 发布