首页 > 其他分享 >【转】MyBatis 通过Map更新

【转】MyBatis 通过Map更新

时间:2022-10-24 15:23:41浏览次数:85  
标签:Map set update value 更新 key MyBatis TD

 

原文:mybatis使用map批量更新(Oracle)

有个需求,MyBatis 通过Map的key作为条件,value作为更新后的值来更新数据。

 

<update id="batchUpdateLogistics" parameterType="map">
    <foreach collection="callMap.entrySet()" item="value" index="key"
            open="begin" close=";end;" separator=";">
        update TD_LOGISTICS t set t.record=#{value} where t.sessionId=#{key}
    </foreach>
</update>
 
<update id="batchUpdateLogistics" parameterType="map">
    <foreach collection="callMap.entrySet()" item="value" index="key"
            open="begin" close="end;" separator="">
        update TD_LOGISTICS t set t.record=#{value} where t.sessionId=#{key};
    </foreach>
</update>
 
<update id="batchUpdateLogistics" parameterType="map">
    begin
    <foreach collection="callMap.entrySet()" item="value" index="key" separator="">
        update TD_LOGISTICS t set t.record=#{value} where t.sessionId=#{key};
    </foreach>
    end;
</update>

 

标签:Map,set,update,value,更新,key,MyBatis,TD
From: https://www.cnblogs.com/Guhongying/p/16821550.html

相关文章

  • mybatis 四大组件
     一、Mybatis四大组件二、SqlSession四大对象这里阐述一下上图的流程Exeutor发起sql执行任务1、先调用statementHandler中的prepare()进行SQL的编译2、然后调用st......
  • 浅谈响应式更新在输入输出处理中的应用
    简介前端的一大重点是处理输入和输出,而vue的响应式系统给输入与输出的维护带来极大便利。将命令式操作转为响应式更新,我们不再需要为代码中充斥着大量手动的数据更新过......
  • 在线程中更新UI
    为了更新UI线程,在新线程中用this.Invoke来更新UI上控件的值。其实这背后是有异常的(有可能会在vs中报出来),因为当你关闭窗体时,this已经不存在了,但访问this.Invoke在新的线程......
  • MyBatisSystemException 【exception】
    org.mybatis.spring.MyBatisSystemException:nestedexceptionisorg.apache.ibatis.type.TypeException:Couldnotsetparametersformapping:ParameterMapping{prop......
  • vue笔记 11 createElement、Vue3、Vue.config.productionTip = false/true打包时日记
                  面试了解            ......
  • 新功能发布 | TSMaster重大更新,一文了解信号映射操作流程
    前言今天介绍TSMaster新功能—信号映射。这个功能在旧版本里,只能实现从CAN信号到系统变量的映射,软件更新以后可以支持系统变量反向映射到信号,甚至可以实现通过表达方式进行......
  • cmap 自定义颜色卡
    #渐变色cmap=LinearSegmentedColormap.from_list('white_to_red',['#00FF00','#0000FF','#FFFF00','#FF0000'])#间隔色块cmap=mpl.colors.ListedColormap([......
  • IBatisNet 开发指南系列文章更新
              两周前完成 ​​​IBATISNETNET1.3开发指南系列文章​​​   ,只是作了最基本的介绍。最近工作忙,没什么时间写,今天放假了,花了大半天时间才写......
  • 更新npm的版本命令(npm WARN config global ‘–global’, ‘–local’ are deprecated
    查看npm版本在cmd窗口,输入npm-v查看npm的版本号,目前最新的式8.17.0或者在安装vue脚手架的时候出现这种情况npmWARNconfigglobal‘–global’,‘–local’aredepr......
  • 聊聊 MyBatis 缓存
    聊聊MyBatis缓存首发公众号-悟空聊架构:图解|聊聊MyBatis缓存你好,我是悟空。本文主要内容如下:一、MyBatis缓存中的常用概念MyBatis缓存:它用来优化SQL数据......