Mybatis+Oracle批量插入与更新的配置文件

id="batchInsertOracle" parameterType="java.util.List">
              BEGIN
              collection="list" item="data" index="index" separator=";" >
                  INSERT INTO cat003(
                  ID,TRACK_ID, TRACK_NO,
                  SSR_CODE, SPEED,FLY_HEIGHT,
                  LATITUDE,LONGITUDE,FLY_WAY,
                  COORDINATE_X,COORDINATE_Y,FIX,
                  IS_RELATE,RELATE_TIME,CREATED_TIME,
                  FLIGHT_NUMBER,TRACK_STATUS,ENABLE_FLAG)
                  VALUES
                    ( SEQ_BASERESULTMAP.NEXTVAL,#{data.trackId ,jdbcType=VARCHAR},#{data.trackNo,jdbcType=VARCHAR},#{data.ssrCode,jdbcType=VARCHAR},
                  #{data.speed,jdbcType=VARCHAR},#{data.flyHeight,jdbcType=VARCHAR},#{data.latitude,jdbcType=VARCHAR},
                  #{data.longitude,jdbcType=VARCHAR},#{data.flyWay,jdbcType=VARCHAR},#{data.coordinateX,jdbcType=DECIMAL},
                  #{data.coordinateY,jdbcType=DECIMAL},#{data.fix,jdbcType=VARCHAR},#{data.isRelate,jdbcType=DECIMAL},
                  #{data.relateTime,jdbcType=TIMESTAMP},#{data.createdTime,jdbcType=TIMESTAMP},#{data.flightNumber,jdbcType=VARCHAR},
                  #{data.trackStatus,jdbcType=VARCHAR},#{data.enableFlag,jdbcType=VARCHAR} )
                
                ;END ;
            
id="updateCat003" parameterType="java.util.List" flushCache="false">
    update cat003
    prefix="set" suffixOverrides=",">
        prefix="TRACK_ID =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.trackId !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.trackId}
                
            
        
        prefix="TRACK_NO =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.trackId !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.trackNo}
                
            
        
        prefix="SSR_CODE =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.trackId !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.ssrCode}
                
            
        
        prefix="SPEED =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.speed !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.speed}
                
            
        
        prefix="FLY_HEIGHT =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.flyHeight !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.flyHeight}
                
            
        
        prefix="LATITUDE =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.latitude !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.latitude}
                
            
        
        prefix="LONGITUDE =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.longitude !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.longitude}
                
            
        
        prefix="FLY_WAY =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.flyWay !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.flyWay}
                
            
        
        prefix="COORDINATE_X =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.coordinateX !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.coordinateX}
                
            
        
        prefix="COORDINATE_Y =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.coordinateY !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.coordinateY}
                
            
        
        prefix="FIX =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.fix !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.fix}
                
            
        
        prefix="IS_RELATE =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.isRelate !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.isRelate}
                
            
        
        prefix="RELATE_TIME =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.relateTime !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.relateTime}
                
            
        
        prefix="CREATED_TIME =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.createdTime !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.createdTime}
                
            
        
        prefix="FLIGHT_NUMBER =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.flightNumber !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.flightNumber}
                
            
        
        prefix="TRACK_STATUS =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.trackStatus !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.trackStatus}
                
            
        
        prefix="ENABLE_FLAG =case" suffix="end,">
            collection="list" item="item" index="index">
                test="item.enableFlag !=null ">
                    when SSR_CODE=#{item.ssrCode} then #{item.enableFlag}
                
            
        
    
    where SSR_CODE in
    collection="list" index="index" item="item" separator="," open="(" close=")">
        #{item.ssrCode}
    

你可能感兴趣的:(mybatis+oracle)