批量mergeinto

<insert id="insertStockQuotaionByBatch" parameterType="java.util.List" useGeneratedKeys="false">                
        BEGIN                
         <foreach collection="list" item="item" index="index" separator=";">                
             merge into STOCK_QUOTATION a            
             using dual            
             on (a.stockno=#{item.stockno,jdbcType=VARCHAR} and a.TRADING_DAY = #{tradingDay,jdbcType=DATE})            
             when not matched then                   
                 insert into stock_quotation
                <trim prefix="(" suffix=")" suffixOverrides="," >
                  <if test="stockno != null" >
                    STOCKNO,
                  </if>
                  <if test="tradingDay != null" >
                    TRADING_DAY,
                  </if>
                  <if test="stockName != null" >
                    STOCK_NAME,
                  </if>
                  <if test="openPrice != null" >
                    OPEN_PRICE,
                  </if>
                  <if test="closePrice != null" >
                    CLOSE_PRICE,
                  </if>
                  <if test="highestPrice != null" >
                    HIGHEST_PRICE,
                  </if>
                  <if test="lowestPrice != null" >
                    LOWEST_PRICE,
                  </if>
                  <if test="volume != null" >
                    VOLUME,
                  </if>
                  <if test="obv != null" >
                    OBV,
                  </if>
                  <if test="turnoverRate != null" >
                    turnover_rate,
                  </if>
                  <if test="amo != null" >
                    amo,
                  </if>
                  <if test="totalValue != null" >
                    total_value,
                  </if>
                  <if test="circulationMarketValue != null" >
                    circulation_market_value,
                  </if>
                  <if test="createdBy != null" >
                    CREATED_BY,
                  </if>
                  <if test="createdDate != null" >
                    CREATED_DATE,
                  </if>
                  <if test="updatedBy != null" >
                    UPDATED_BY,
                  </if>
                  <if test="updatedDate != null" >
                    UPDATED_DATE,
                  </if>
                </trim>
                <trim prefix="values (" suffix=")" suffixOverrides="," >
                  <if test="stockno != null" >
                    #{stockno,jdbcType=VARCHAR},
                  </if>
                  <if test="tradingDay != null" >
                    #{tradingDay,jdbcType=DATE},
                  </if>
                  <if test="stockName != null" >
                    #{stockName,jdbcType=VARCHAR},
                  </if>
                  <if test="openPrice != null" >
                    #{openPrice,jdbcType=DOUBLE},
                  </if>
                  <if test="closePrice != null" >
                    #{closePrice,jdbcType=DOUBLE},
                  </if>
                  <if test="highestPrice != null" >
                    #{highestPrice,jdbcType=DOUBLE},
                  </if>
                  <if test="lowestPrice != null" >
                    #{lowestPrice,jdbcType=DOUBLE},
                  </if>
                  <if test="volume != null" >
                    #{volume,jdbcType=INTEGER},
                  </if>
                  <if test="obv != null" >
                    #{obv,jdbcType=DOUBLE},
                  </if>
                   <if test="turnoverRate != null" >
                    #{turnoverRate,jdbcType=DOUBLE},
                  </if>
                   <if test="amo != null" >
                    #{amo,jdbcType=DOUBLE},
                  </if>
                   <if test="obv != null" >
                    #{totalValue,jdbcType=DOUBLE},
                  </if>
                   <if test="obv != null" >
                    #{circulationMarketValue,jdbcType=DOUBLE},
                  </if>
                  <if test="createdBy != null" >
                    #{createdBy,jdbcType=VARCHAR},
                  </if>
                  <if test="createdDate != null" >
                    #{createdDate,jdbcType=DATE},
                  </if>
                  <if test="updatedBy != null" >
                    #{updatedBy,jdbcType=VARCHAR},
                  </if>
                  <if test="updatedDate != null" >
                    #{updatedDate,jdbcType=DATE},
                  </if>
                </trim>        
         </foreach>                
        ;END;                
   </insert>

转载于:https://my.oschina.net/hfq/blog/1475501

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值