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块

相关推荐
半夏知半秋18 分钟前
redis-哨兵模式配置整理
数据库·redis·笔记·后端·学习·lua·安全架构
一只小bit34 分钟前
Git 远程操作:克隆、推送、拉取与冲突解决
数据库·git·github
DarkAthena1 小时前
【YashanDB】单机版数据库升级测试
数据库·oracle·yashan
best_virtuoso1 小时前
PostgreSQL PostGIS中的元数据表
数据库·postgresql
程序新视界1 小时前
一张图解析MySQL中InnoDB的逻辑存储结构
数据库·后端·mysql
XXX-X-XXJ2 小时前
Django 用户认证流程详解:从原理到实现
数据库·后端·python·django·sqlite
my一阁6 小时前
2025-web集群-问题总结
前端·arm开发·数据库·nginx·负载均衡·web
JIngJaneIL8 小时前
篮球论坛|基于SprinBoot+vue的篮球论坛系统(源码+数据库+文档)
java·前端·数据库·vue.js·论文·毕设·篮球论坛系统
一只叫煤球的猫10 小时前
MySQL 索引的 “最左前缀原则”,用查字典的例子讲透
数据库·mysql·性能优化
一只小bit11 小时前
MySQL常用内置函数整理:提高你的查询效率
数据库·mysql·数据完整性·表约束