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块

相关推荐
cookqq23 分钟前
mongodb源码分析session异步接受asyncSourceMessage()客户端流变Message对象
数据库·sql·mongodb·nosql
呼拉拉呼拉35 分钟前
Redis故障转移
数据库·redis·缓存·高可用架构
什么都想学的阿超38 分钟前
【Redis系列 04】Redis高可用架构实战:主从复制与哨兵模式从零到生产
数据库·redis·架构
pp-周子晗(努力赶上课程进度版)1 小时前
【MySQL】视图、用户管理、MySQL使用C\C++连接
数据库·mysql
斯特凡今天也很帅1 小时前
clickhouse常用语句汇总——持续更新中
数据库·sql·clickhouse
超级小忍2 小时前
如何配置 MySQL 允许远程连接
数据库·mysql·adb
吹牛不交税3 小时前
sqlsugar WhereIF条件的大于等于和等于查出来的坑
数据库·mysql
小袁搬码3 小时前
PL/SQLDeveloper中数值类型字段查询后显示为科学计数法的处理方式
oracle·oracle数据库·pl.sqldeveloper
hshpy3 小时前
setting up Activiti BPMN Workflow Engine with Spring Boot
数据库·spring boot·后端
李少兄4 小时前
解决MyBatis参数绑定中参数名不一致导致的错误问题
mybatis