<insert id="batchInsertOracle" parameterType="java.util.List"> BEGIN <foreach 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} ) </foreach> ;END ; </insert> <update id="updateCat003" parameterType="java.util.List" flushCache="false"> update cat003 <trim prefix="set" suffixOverrides=","> <trim prefix="TRACK_ID =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.trackId !=null "> when SSR_CODE=#{item.ssrCode} then #{item.trackId} </if> </foreach> </trim> <trim prefix="TRACK_NO =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.trackId !=null "> when SSR_CODE=#{item.ssrCode} then #{item.trackNo} </if> </foreach> </trim> <trim prefix="SSR_CODE =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.trackId !=null "> when SSR_CODE=#{item.ssrCode} then #{item.ssrCode} </if> </foreach> </trim> <trim prefix="SPEED =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.speed !=null "> when SSR_CODE=#{item.ssrCode} then #{item.speed} </if> </foreach> </trim> <trim prefix="FLY_HEIGHT =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.flyHeight !=null "> when SSR_CODE=#{item.ssrCode} then #{item.flyHeight} </if> </foreach> </trim> <trim prefix="LATITUDE =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.latitude !=null "> when SSR_CODE=#{item.ssrCode} then #{item.latitude} </if> </foreach> </trim> <trim prefix="LONGITUDE =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.longitude !=null "> when SSR_CODE=#{item.ssrCode} then #{item.longitude} </if> </foreach> </trim> <trim prefix="FLY_WAY =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.flyWay !=null "> when SSR_CODE=#{item.ssrCode} then #{item.flyWay} </if> </foreach> </trim> <trim prefix="COORDINATE_X =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.coordinateX !=null "> when SSR_CODE=#{item.ssrCode} then #{item.coordinateX} </if> </foreach> </trim> <trim prefix="COORDINATE_Y =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.coordinateY !=null "> when SSR_CODE=#{item.ssrCode} then #{item.coordinateY} </if> </foreach> </trim> <trim prefix="FIX =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.fix !=null "> when SSR_CODE=#{item.ssrCode} then #{item.fix} </if> </foreach> </trim> <trim prefix="IS_RELATE =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.isRelate !=null "> when SSR_CODE=#{item.ssrCode} then #{item.isRelate} </if> </foreach> </trim> <trim prefix="RELATE_TIME =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.relateTime !=null "> when SSR_CODE=#{item.ssrCode} then #{item.relateTime} </if> </foreach> </trim> <trim prefix="CREATED_TIME =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.createdTime !=null "> when SSR_CODE=#{item.ssrCode} then #{item.createdTime} </if> </foreach> </trim> <trim prefix="FLIGHT_NUMBER =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.flightNumber !=null "> when SSR_CODE=#{item.ssrCode} then #{item.flightNumber} </if> </foreach> </trim> <trim prefix="TRACK_STATUS =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.trackStatus !=null "> when SSR_CODE=#{item.ssrCode} then #{item.trackStatus} </if> </foreach> </trim> <trim prefix="ENABLE_FLAG =case" suffix="end,"> <foreach collection="list" item="item" index="index"> <if test="item.enableFlag !=null "> when SSR_CODE=#{item.ssrCode} then #{item.enableFlag} </if> </foreach> </trim> </trim> where SSR_CODE in <foreach collection="list" index="index" item="item" separator="," open="(" close=")"> #{item.ssrCode} </foreach> </update>
Mybatis+Oracle批量插入与更新的配置文件
最新推荐文章于 2023-09-17 02:40:56 发布