MyBatis oracle 批量 insert update 新增 更新

<insert id="addE2ERecordBatch" parameterType="java.util.List">

为生活加点乐子,TBDIAN:大欢乐情调


         insert into t_e2e (collect_year_month,one_level_name,one_level_code,two_level_name,two_level_code,account_no,account_name,account_order,computing_code,computing_mode,normal_goal,normal_predict,nature_goal,nature_predict,active,create_time,last_update_time,create_by,last_modify_by)       
         <foreach collection ="list" item ="e2e" index ="index" separator ="union all">
             <![CDATA[
            select #{e2e.collectYearMonth,jdbcType=DATE},#{e2e.oneLevel,jdbcType=VARCHAR},#{e2e.oneLevelCode,jdbcType=VARCHAR},
                #{e2e.twoLevel,jdbcType=VARCHAR},#{e2e.twoLevelCode,jdbcType=VARCHAR},#{e2e.accountNo,jdbcType=VARCHAR},
                #{e2e.accountName,jdbcType=VARCHAR},#{e2e.order,jdbcType=INTEGER},#{e2e.computingCode,jdbcType=VARCHAR},
                #{e2e.computingMode,jdbcType=VARCHAR},#{e2e.normalGoal,jdbcType=NUMERIC},#{e2e.normalPredict,jdbcType=NUMERIC},
                #{e2e.natureGoal,jdbcType=NUMERIC},#{e2e.naturePredict,jdbcType=NUMERIC},#{e2e.active,jdbcType=VARCHAR},
                #{e2e.gmtCreate,jdbcType=TIMESTAMP},#{e2e.gmtModified,jdbcType=TIMESTAMP},#{e2e.createBy,jdbcType=VARCHAR},
                #{e2e.lastModifiedBy,jdbcType=VARCHAR} from dual
             ]]>  
        </foreach>  

    </insert>

 

<update id="editE2ERecordsBatch" parameterType="java.util.List">
        begin
            <foreach collection="list" item="e2e" index="index" separator=";">
                    update t_e2e
                    <set>
                        <if test="e2e.computingCode!=null and e2e.computingCode!=''">
                            computing_code=#{e2e.computingCode},
                        </if>
                         <if test="e2e.computingMode!=null and e2e.computingMode!=''">
                            computing_mode=#{e2e.computingMode},
                        </if>
                         <if test="e2e.normalGoal!=null and e2e.normalGoal!=''">
                            normal_goal=#{e2e.normalGoal},
                        </if>
                         <if test="e2e.normalPredict!=null and e2e.normalPredict!=''">
                            normal_predict=#{e2e.normalPredict},
                        </if>
                         <if test="e2e.natureGoal!=null and e2e.natureGoal!=''">
                            nature_goal=#{e2e.natureGoal},
                        </if>
                         <if test="e2e.naturePredict!=null and e2e.naturePredict!=''">
                            nature_predict=#{e2e.naturePredict},
                        </if>
                         <if test="e2e.lastModifiedBy!=null and e2e.lastModifiedBy!=''">
                            last_modify_by=#{e2e.lastModifiedBy},
                        </if>
                         <if test="e2e.gmtModified!=null and e2e.gmtModified!=''">
                            last_update_time=#{e2e.gmtModified}
                        </if>
                    </set>
                    where collect_year_month=#{e2e.collectYearMonth}
                        and one_level_name=#{e2e.oneLevel}
                        and two_level_name=#{e2e.twoLevel}
                        and account_no=#{e2e.accountNo}
                        and active='1'
           </foreach>
         ;end;
    </update>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值