zoukankan      html  css  js  c++  java
  • mybatis+Oracle 批量插入数据,有数据做更新操作

    <!-- 批量添加 -->
        <insert id="batchAdd" parameterType="java.util.List">
           merge into t_tabe_temp  fail
                using
                (
                    <foreach collection="list" item="item" separator="union all">  <!-- 传入的集合参数 -->
                      select 
                         #{item.id, jdbcType=VARCHAR} id,
                           #{item.time, jdbcType=VARCHAR} time,
                     from dual         
                   </foreach>
                ) t1
                on (fail.id= t1.id)  <!-- 关联的主键编号-->
                when matched then <!-- 如果存在就更新 -->
                update set  <!-- 注意,这里不要写set  id ==  xx  -->
                fail.time = t1.time,
                when not matched then  <!-- 不存在就插入数据 -->
                  insert 
                  (fail.id, fail.time)
                  values
                  (t1.id, t1.time)
        </insert>

  • 相关阅读:
    每次任务 创建 一个 Scheduler,运行完直接shutdown ,同时运行不相互影响.
    get 和 post 的区别
    jq ajax
    h5
    reset
    ajax
    手机端
    IE浏览器下LI的默认高度
    IE FF 支持li:hover,但是ie6不支持,a:hover ul 这种写法是要搭配顶部针对IE6声明用的
    ie7/8卸载工具 降级到IE6
  • 原文地址:https://www.cnblogs.com/superming/p/10944021.html
Copyright © 2011-2022 走看看