<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.steerinfo.meterwork.meterworkimagetemp.mapper.MeterWorkImageTempMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.meterwork.meterworkimagetemp.model.MeterWorkImageTemp">
    <id column="IMAGE_NO" jdbcType="VARCHAR" property="imageNo" />
    <result column="RAILWAY_NO" jdbcType="VARCHAR" property="railwayNo" />
    <result column="IMAGE_TIME" jdbcType="TIMESTAMP" property="imageTime" />
    <result column="IMAGE_URL_2" jdbcType="VARCHAR" property="imageUrl2" />
    <result column="IMAGE_URL_1" jdbcType="VARCHAR" property="imageUrl1" />
    <result column="BASE_SPOT_NO" jdbcType="VARCHAR" property="baseSpotNo" />
    <result column="VALUE_FLAG" jdbcType="VARCHAR" property="valueFlag" />
  </resultMap>
  <sql id="columns">
    IMAGE_NO, RAILWAY_NO, IMAGE_TIME, IMAGE_URL_2, IMAGE_URL_1, BASE_SPOT_NO, VALUE_FLAG
  </sql>
  <sql id="columns_alias">
    t.IMAGE_NO, t.RAILWAY_NO, t.IMAGE_TIME, t.IMAGE_URL_2, t.IMAGE_URL_1, t.BASE_SPOT_NO, 
    t.VALUE_FLAG
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM METER_WORK_IMAGE_TEMP
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM METER_WORK_IMAGE_TEMP t
  </sql>
  <sql id="where">
    <where> 
      <if test="imageNo != null and imageNo != ''">
        and IMAGE_NO = #{imageNo}
      </if>
      <if test="railwayNo != null and railwayNo != ''">
        and RAILWAY_NO = #{railwayNo}
      </if>
      <if test="imageTime != null">
        and TO_CHAR(IMAGE_TIME,'yyyy-MM-dd') = #{imageTime}
      </if>
      <if test="imageUrl2 != null and imageUrl2 != ''">
        and IMAGE_URL_2 = #{imageUrl2}
      </if>
      <if test="imageUrl1 != null and imageUrl1 != ''">
        and IMAGE_URL_1 = #{imageUrl1}
      </if>
      <if test="baseSpotNo != null and baseSpotNo != ''">
        and BASE_SPOT_NO = #{baseSpotNo}
      </if>
      <if test="valueFlag != null and valueFlag != ''">
        and VALUE_FLAG = #{valueFlag}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="imageNo != null and imageNo != ''">
        and IMAGE_NO LIKE '%${imageNo}%'
      </if>
      <if test="railwayNo != null and railwayNo != ''">
        and RAILWAY_NO LIKE '%${railwayNo}%'
      </if>
      <if test="imageTime != null">
        and TO_CHAR(IMAGE_TIME,'yyyy-MM-dd') = #{imageTime}
      </if>
      <if test="imageUrl2 != null and imageUrl2 != ''">
        and IMAGE_URL_2 LIKE '%${imageUrl2}%'
      </if>
      <if test="imageUrl1 != null and imageUrl1 != ''">
        and IMAGE_URL_1 LIKE '%${imageUrl1}%'
      </if>
      <if test="baseSpotNo != null and baseSpotNo != ''">
        and BASE_SPOT_NO LIKE '%${baseSpotNo}%'
      </if>
      <if test="valueFlag != null and valueFlag != ''">
        and VALUE_FLAG LIKE '%${valueFlag}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from METER_WORK_IMAGE_TEMP
    where IMAGE_NO = #{imageNo,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from METER_WORK_IMAGE_TEMP
    where 1!=1 
      <if test="railwayNo != null and railwayNo != ''">
        or RAILWAY_NO = #{railwayNo}
      </if>
      <if test="imageTime != null">
        or TO_CHAR(IMAGE_TIME,'yyyy-MM-dd') = '#{imageTime}'
      </if>
      <if test="imageUrl2 != null and imageUrl2 != ''">
        or IMAGE_URL_2 = #{imageUrl2}
      </if>
      <if test="imageUrl1 != null and imageUrl1 != ''">
        or IMAGE_URL_1 = #{imageUrl1}
      </if>
      <if test="baseSpotNo != null and baseSpotNo != ''">
        or BASE_SPOT_NO = #{baseSpotNo}
      </if>
      <if test="valueFlag != null and valueFlag != ''">
        or VALUE_FLAG = #{valueFlag}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.meterwork.meterworkimagetemp.model.MeterWorkImageTemp">
    insert into METER_WORK_IMAGE_TEMP (IMAGE_NO, RAILWAY_NO, IMAGE_TIME, 
      IMAGE_URL_2, IMAGE_URL_1, BASE_SPOT_NO, 
      VALUE_FLAG)
    values (#{imageNo,jdbcType=VARCHAR}, #{railwayNo,jdbcType=VARCHAR}, #{imageTime,jdbcType=TIMESTAMP}, 
      #{imageUrl2,jdbcType=VARCHAR}, #{imageUrl1,jdbcType=VARCHAR}, #{baseSpotNo,jdbcType=VARCHAR}, 
      #{valueFlag,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.meterwork.meterworkimagetemp.model.MeterWorkImageTemp">
    insert into METER_WORK_IMAGE_TEMP
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="imageNo != null">
        IMAGE_NO,
      </if>
      <if test="railwayNo != null">
        RAILWAY_NO,
      </if>
      <if test="imageTime != null">
        IMAGE_TIME,
      </if>
      <if test="imageUrl2 != null">
        IMAGE_URL_2,
      </if>
      <if test="imageUrl1 != null">
        IMAGE_URL_1,
      </if>
      <if test="baseSpotNo != null">
        BASE_SPOT_NO,
      </if>
      <if test="valueFlag != null">
        VALUE_FLAG,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="imageNo != null">
        #{imageNo,jdbcType=VARCHAR},
      </if>
      <if test="railwayNo != null">
        #{railwayNo,jdbcType=VARCHAR},
      </if>
      <if test="imageTime != null">
        #{imageTime,jdbcType=TIMESTAMP},
      </if>
      <if test="imageUrl2 != null">
        #{imageUrl2,jdbcType=VARCHAR},
      </if>
      <if test="imageUrl1 != null">
        #{imageUrl1,jdbcType=VARCHAR},
      </if>
      <if test="baseSpotNo != null">
        #{baseSpotNo,jdbcType=VARCHAR},
      </if>
      <if test="valueFlag != null">
        #{valueFlag,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.meterwork.meterworkimagetemp.model.MeterWorkImageTemp">
    update METER_WORK_IMAGE_TEMP
    set RAILWAY_NO = #{railwayNo,jdbcType=VARCHAR},
      IMAGE_TIME = #{imageTime,jdbcType=TIMESTAMP},
      IMAGE_URL_2 = #{imageUrl2,jdbcType=VARCHAR},
      IMAGE_URL_1 = #{imageUrl1,jdbcType=VARCHAR},
      BASE_SPOT_NO = #{baseSpotNo,jdbcType=VARCHAR},
      VALUE_FLAG = #{valueFlag,jdbcType=VARCHAR}
    where IMAGE_NO = #{imageNo,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.meterwork.meterworkimagetemp.model.MeterWorkImageTemp">
    update METER_WORK_IMAGE_TEMP
    <set>
      <if test="railwayNo != null">
        RAILWAY_NO = #{railwayNo,jdbcType=VARCHAR},
      </if>
      <if test="imageTime != null">
        IMAGE_TIME = #{imageTime,jdbcType=TIMESTAMP},
      </if>
      <if test="imageUrl2 != null">
        IMAGE_URL_2 = #{imageUrl2,jdbcType=VARCHAR},
      </if>
      <if test="imageUrl1 != null">
        IMAGE_URL_1 = #{imageUrl1,jdbcType=VARCHAR},
      </if>
      <if test="baseSpotNo != null">
        BASE_SPOT_NO = #{baseSpotNo,jdbcType=VARCHAR},
      </if>
      <if test="valueFlag != null">
        VALUE_FLAG = #{valueFlag,jdbcType=VARCHAR},
      </if>
    </set>
    where IMAGE_NO = #{imageNo,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where IMAGE_NO = #{imageNo,jdbcType=VARCHAR}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="where"/>
  </select>
  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="whereLike"/>
  </select>
  <insert id="batchInsert" parameterType="java.util.List">
    insert into METER_WORK_IMAGE_TEMP 
      (IMAGE_NO, 
      RAILWAY_NO, IMAGE_TIME, IMAGE_URL_2, 
      IMAGE_URL_1, BASE_SPOT_NO, VALUE_FLAG
      )
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.imageNo,jdbcType=VARCHAR}, 
      #{item.railwayNo,jdbcType=VARCHAR}, #{item.imageTime,jdbcType=TIMESTAMP}, #{item.imageUrl2,jdbcType=VARCHAR}, 
      #{item.imageUrl1,jdbcType=VARCHAR}, #{item.baseSpotNo,jdbcType=VARCHAR}, #{item.valueFlag,jdbcType=VARCHAR}
       from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update METER_WORK_IMAGE_TEMP
     set
       IMAGE_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case IMAGE_NO" close="end">
          when #{item.imageNo,jdbcType=VARCHAR} then #{item.imageNo,jdbcType=VARCHAR}
       </foreach>
       ,RAILWAY_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case IMAGE_NO" close="end">
          when #{item.imageNo,jdbcType=VARCHAR} then #{item.railwayNo,jdbcType=VARCHAR}
       </foreach>
       ,IMAGE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case IMAGE_NO" close="end">
          when #{item.imageNo,jdbcType=VARCHAR} then #{item.imageTime,jdbcType=TIMESTAMP}
       </foreach>
       ,IMAGE_URL_2=
       <foreach collection="list" item="item" index="index" separator=" " open="case IMAGE_NO" close="end">
          when #{item.imageNo,jdbcType=VARCHAR} then #{item.imageUrl2,jdbcType=VARCHAR}
       </foreach>
       ,IMAGE_URL_1=
       <foreach collection="list" item="item" index="index" separator=" " open="case IMAGE_NO" close="end">
          when #{item.imageNo,jdbcType=VARCHAR} then #{item.imageUrl1,jdbcType=VARCHAR}
       </foreach>
       ,BASE_SPOT_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case IMAGE_NO" close="end">
          when #{item.imageNo,jdbcType=VARCHAR} then #{item.baseSpotNo,jdbcType=VARCHAR}
       </foreach>
       ,VALUE_FLAG=
       <foreach collection="list" item="item" index="index" separator=" " open="case IMAGE_NO" close="end">
          when #{item.imageNo,jdbcType=VARCHAR} then #{item.valueFlag,jdbcType=VARCHAR}
       </foreach>
     where IMAGE_NO in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.imageNo,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from METER_WORK_IMAGE_TEMP
    where IMAGE_NO in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->

</mapper>