Oracle + MyBatis 批量更新 update

xml 复制代码
<update id="updateUserDO' parameterType="list"> 
<foreach collection="list" item="param" separator="" open="begin" close="end;">
        update user
        <set>
        <if test="null!=param.account and ''!=param.account">
         account =#{param.account},
        </if>
        <if test="null!=param.userName and ''!=param.userName">
        user_name =#{param.userName},
        </if>
    </set>
    where uuid = #{param.uuid};
</foreach>
</update>

注意:where最后有个分号

其实最后SQL格式就是

begin

update xxx set xxx where xxx;

update xxx set xxx where xxx;

end;

是一个SQL块

相关推荐
zh_xuan13 分钟前
PC端操作SQLite数据库
数据库·c++·sqlite
摇滚侠15 分钟前
MyBatis 入门到项目实战 MyBatis 分页插件 65-66
java·开发语言·sql·mybatis
MXsoft61818 分钟前
**采集节点主备模:保障监控系统自身高可用**
数据库
yyuuuzz1 小时前
独立站运营的几个技术层面常见问题
大数据·运维·服务器·网络·数据库·aws
IT策士1 小时前
Redis 从入门到精通:Redis Stream —— 可靠消息队列
数据库·redis·缓存
北风toto1 小时前
深度拆解:本体与智能体协同生成SQL的底层逻辑与工程实践
数据库·sql·microsoft
倒流时光三十年1 小时前
PostgreSQL NULLIF 条件表达式函数详解
数据库·sql·postgresql
代码小库1 小时前
【2026前端转 AI 全栈指南】第 2 章(下):NestJS 项目创建 · MongoDB 配置 · 项目启动与调试
前端·数据库·mongodb
大熊猫侯佩1 小时前
SwiftData 迁移深度指南:从入门到“填坑”(下集)
数据库·swift·编程语言
大熊猫侯佩1 小时前
SwiftData 迁移深度指南:从入门到“填坑”(上集)
数据库·swift·编程语言