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块

相关推荐
伤不起bb2 小时前
MySQL 高可用
linux·运维·数据库·mysql·安全·高可用
Yushan Bai7 小时前
ORACLE RAC环境REDO日志量突然增加的分析
数据库·oracle
躺着听Jay7 小时前
Oracle-相关笔记
数据库·笔记·oracle
瀚高PG实验室7 小时前
连接指定数据库时提示not currently accepting connections
运维·数据库
运维成长记8 小时前
mysql数据库-中间件MyCat
数据库·mysql·中间件
尘客.8 小时前
DataX从Mysql导数据到Hive分区表案例
数据库·hive·mysql
TiDB 社区干货传送门9 小时前
从开发者角度看数据库架构进化史:JDBC - 中间件 - TiDB
数据库·oracle·中间件·tidb·数据库架构
虾球xz9 小时前
游戏引擎学习第280天:精简化的流式实体sim
数据库·c++·学习·游戏引擎
uwvwko10 小时前
BUUCTF——web刷题第一页题解
android·前端·数据库·php·web·ctf