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块

相关推荐
未来龙皇小蓝20 分钟前
【MySQL-索引调优】11:Group by相关概念
数据库·mysql·性能优化
2401_8318249633 分钟前
使用Fabric自动化你的部署流程
jvm·数据库·python
njidf1 小时前
Python日志记录(Logging)最佳实践
jvm·数据库·python
twc8291 小时前
大模型生成 QA Pairs 提升 RAG 应用测试效率的实践
服务器·数据库·人工智能·windows·rag·大模型测试
@我漫长的孤独流浪1 小时前
Python编程核心知识点速览
开发语言·数据库·python
2401_851272991 小时前
实战:用Python分析某电商销售数据
jvm·数据库·python
枕布响丸辣1 小时前
MySQL 从入门到精通:完整操作手册与实战指南
数据库·mysql
电商API&Tina1 小时前
【电商API接口】开发者一站式电商API接入说明
大数据·数据库·人工智能·云计算·json
2401_857918291 小时前
用Python和Twilio构建短信通知系统
jvm·数据库·python
樹JUMP1 小时前
使用Docker容器化你的Python应用
jvm·数据库·python