<?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.meterworkimage.mapper.MeterWorkImageMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.meterwork.meterworkimage.model.MeterWorkImage">
    <id column="ACTUAL_FIRST_NO" jdbcType="VARCHAR" property="actualFirstNo" />
    <result column="IMAGE_TIME" jdbcType="TIMESTAMP" property="imageTime" />
    <result column="IMAGE_FILE_1" jdbcType="VARCHAR" property="imageFile1" />
    <result column="IMAGE_FILE_2" jdbcType="VARCHAR" property="imageFile2" />
    <result column="IMAGE_FILE_3" jdbcType="VARCHAR" property="imageFile3" />
    <result column="IMAGE_FILE_4" jdbcType="VARCHAR" property="imageFile4" />
    <result column="IMAGE_FILE_5" jdbcType="VARCHAR" property="imageFile5" />
    <result column="IMAGE_FILE_6" jdbcType="VARCHAR" property="imageFile6" />
    <result column="IMAGE_FILE_7" jdbcType="VARCHAR" property="imageFile7" />
    <result column="IMAGE_FILE_8" jdbcType="VARCHAR" property="imageFile8" />
    <result column="IMAGE_NUM" jdbcType="DECIMAL" property="imageNum" />
  </resultMap>
  <sql id="columns">
    ACTUAL_FIRST_NO, IMAGE_TIME, IMAGE_FILE_1, IMAGE_FILE_2, IMAGE_FILE_3, IMAGE_FILE_4, 
    IMAGE_FILE_5, IMAGE_FILE_6, IMAGE_FILE_7, IMAGE_FILE_8, IMAGE_NUM
  </sql>
  <sql id="columns_alias">
    t.ACTUAL_FIRST_NO, t.IMAGE_TIME, t.IMAGE_FILE_1, t.IMAGE_FILE_2, t.IMAGE_FILE_3, 
    t.IMAGE_FILE_4, t.IMAGE_FILE_5, t.IMAGE_FILE_6, t.IMAGE_FILE_7, t.IMAGE_FILE_8, t.IMAGE_NUM
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM METER_WORK_IMAGE
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM METER_WORK_IMAGE t
  </sql>
  <sql id="where">
    <where> 
      <if test="imageTime != null">
        and TO_CHAR(IMAGE_TIME,'yyyy-MM-dd') = #{imageTime}
      </if>
      <if test="imageFile1 != null and imageFile1 != ''">
        and IMAGE_FILE_1 = #{imageFile1}
      </if>
      <if test="imageFile2 != null and imageFile2 != ''">
        and IMAGE_FILE_2 = #{imageFile2}
      </if>
      <if test="imageFile3 != null and imageFile3 != ''">
        and IMAGE_FILE_3 = #{imageFile3}
      </if>
      <if test="imageFile4 != null and imageFile4 != ''">
        and IMAGE_FILE_4 = #{imageFile4}
      </if>
      <if test="imageFile5 != null and imageFile5 != ''">
        and IMAGE_FILE_5 = #{imageFile5}
      </if>
      <if test="imageFile6 != null and imageFile6 != ''">
        and IMAGE_FILE_6 = #{imageFile6}
      </if>
      <if test="imageFile7 != null and imageFile7 != ''">
        and IMAGE_FILE_7 = #{imageFile7}
      </if>
      <if test="imageFile8 != null and imageFile8 != ''">
        and IMAGE_FILE_8 = #{imageFile8}
      </if>
      <if test="imageNum != null">
        and IMAGE_NUM = #{imageNum}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="imageTime != null">
        and TO_CHAR(IMAGE_TIME,'yyyy-MM-dd') = #{imageTime}
      </if>
      <if test="imageFile1 != null and imageFile1 != ''">
        and IMAGE_FILE_1 LIKE '%${imageFile1}%'
      </if>
      <if test="imageFile2 != null and imageFile2 != ''">
        and IMAGE_FILE_2 LIKE '%${imageFile2}%'
      </if>
      <if test="imageFile3 != null and imageFile3 != ''">
        and IMAGE_FILE_3 LIKE '%${imageFile3}%'
      </if>
      <if test="imageFile4 != null and imageFile4 != ''">
        and IMAGE_FILE_4 LIKE '%${imageFile4}%'
      </if>
      <if test="imageFile5 != null and imageFile5 != ''">
        and IMAGE_FILE_5 LIKE '%${imageFile5}%'
      </if>
      <if test="imageFile6 != null and imageFile6 != ''">
        and IMAGE_FILE_6 LIKE '%${imageFile6}%'
      </if>
      <if test="imageFile7 != null and imageFile7 != ''">
        and IMAGE_FILE_7 LIKE '%${imageFile7}%'
      </if>
      <if test="imageFile8 != null and imageFile8 != ''">
        and IMAGE_FILE_8 LIKE '%${imageFile8}%'
      </if>
      <if test="imageNum != null">
        and IMAGE_NUM = #{imageNum}
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from METER_WORK_IMAGE
    where ACTUAL_FIRST_NO = #{actualFirstNo,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from METER_WORK_IMAGE
    where 1!=1 
      <if test="imageTime != null">
        or TO_CHAR(IMAGE_TIME,'yyyy-MM-dd') = '#{imageTime}'
      </if>
      <if test="imageFile1 != null and imageFile1 != ''">
        or IMAGE_FILE_1 = #{imageFile1}
      </if>
      <if test="imageFile2 != null and imageFile2 != ''">
        or IMAGE_FILE_2 = #{imageFile2}
      </if>
      <if test="imageFile3 != null and imageFile3 != ''">
        or IMAGE_FILE_3 = #{imageFile3}
      </if>
      <if test="imageFile4 != null and imageFile4 != ''">
        or IMAGE_FILE_4 = #{imageFile4}
      </if>
      <if test="imageFile5 != null and imageFile5 != ''">
        or IMAGE_FILE_5 = #{imageFile5}
      </if>
      <if test="imageFile6 != null and imageFile6 != ''">
        or IMAGE_FILE_6 = #{imageFile6}
      </if>
      <if test="imageFile7 != null and imageFile7 != ''">
        or IMAGE_FILE_7 = #{imageFile7}
      </if>
      <if test="imageFile8 != null and imageFile8 != ''">
        or IMAGE_FILE_8 = #{imageFile8}
      </if>
      <if test="imageNum != null">
        or IMAGE_NUM = #{imageNum}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.meterwork.meterworkimage.model.MeterWorkImage">
    insert into METER_WORK_IMAGE (ACTUAL_FIRST_NO, IMAGE_TIME, IMAGE_FILE_1, 
      IMAGE_FILE_2, IMAGE_FILE_3, IMAGE_FILE_4, 
      IMAGE_FILE_5, IMAGE_FILE_6, IMAGE_FILE_7, 
      IMAGE_FILE_8, IMAGE_NUM)
    values (#{actualFirstNo,jdbcType=VARCHAR}, #{imageTime,jdbcType=TIMESTAMP}, #{imageFile1,jdbcType=VARCHAR}, 
      #{imageFile2,jdbcType=VARCHAR}, #{imageFile3,jdbcType=VARCHAR}, #{imageFile4,jdbcType=VARCHAR}, 
      #{imageFile5,jdbcType=VARCHAR}, #{imageFile6,jdbcType=VARCHAR}, #{imageFile7,jdbcType=VARCHAR}, 
      #{imageFile8,jdbcType=VARCHAR}, #{imageNum,jdbcType=DECIMAL})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.meterwork.meterworkimage.model.MeterWorkImage">
    insert into METER_WORK_IMAGE
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="actualFirstNo != null">
        ACTUAL_FIRST_NO,
      </if>
      <if test="imageTime != null">
        IMAGE_TIME,
      </if>
      <if test="imageFile1 != null">
        IMAGE_FILE_1,
      </if>
      <if test="imageFile2 != null">
        IMAGE_FILE_2,
      </if>
      <if test="imageFile3 != null">
        IMAGE_FILE_3,
      </if>
      <if test="imageFile4 != null">
        IMAGE_FILE_4,
      </if>
      <if test="imageFile5 != null">
        IMAGE_FILE_5,
      </if>
      <if test="imageFile6 != null">
        IMAGE_FILE_6,
      </if>
      <if test="imageFile7 != null">
        IMAGE_FILE_7,
      </if>
      <if test="imageFile8 != null">
        IMAGE_FILE_8,
      </if>
      <if test="imageNum != null">
        IMAGE_NUM,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="actualFirstNo != null">
        #{actualFirstNo,jdbcType=VARCHAR},
      </if>
      <if test="imageTime != null">
        #{imageTime,jdbcType=TIMESTAMP},
      </if>
      <if test="imageFile1 != null">
        #{imageFile1,jdbcType=VARCHAR},
      </if>
      <if test="imageFile2 != null">
        #{imageFile2,jdbcType=VARCHAR},
      </if>
      <if test="imageFile3 != null">
        #{imageFile3,jdbcType=VARCHAR},
      </if>
      <if test="imageFile4 != null">
        #{imageFile4,jdbcType=VARCHAR},
      </if>
      <if test="imageFile5 != null">
        #{imageFile5,jdbcType=VARCHAR},
      </if>
      <if test="imageFile6 != null">
        #{imageFile6,jdbcType=VARCHAR},
      </if>
      <if test="imageFile7 != null">
        #{imageFile7,jdbcType=VARCHAR},
      </if>
      <if test="imageFile8 != null">
        #{imageFile8,jdbcType=VARCHAR},
      </if>
      <if test="imageNum != null">
        #{imageNum,jdbcType=DECIMAL},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.meterwork.meterworkimage.model.MeterWorkImage">
    update METER_WORK_IMAGE
    set IMAGE_TIME = #{imageTime,jdbcType=TIMESTAMP},
      IMAGE_FILE_1 = #{imageFile1,jdbcType=VARCHAR},
      IMAGE_FILE_2 = #{imageFile2,jdbcType=VARCHAR},
      IMAGE_FILE_3 = #{imageFile3,jdbcType=VARCHAR},
      IMAGE_FILE_4 = #{imageFile4,jdbcType=VARCHAR},
      IMAGE_FILE_5 = #{imageFile5,jdbcType=VARCHAR},
      IMAGE_FILE_6 = #{imageFile6,jdbcType=VARCHAR},
      IMAGE_FILE_7 = #{imageFile7,jdbcType=VARCHAR},
      IMAGE_FILE_8 = #{imageFile8,jdbcType=VARCHAR},
      IMAGE_NUM = #{imageNum,jdbcType=DECIMAL}
    where ACTUAL_FIRST_NO = #{actualFirstNo,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.meterwork.meterworkimage.model.MeterWorkImage">
    update METER_WORK_IMAGE
    <set>
      <if test="imageTime != null">
        IMAGE_TIME = #{imageTime,jdbcType=TIMESTAMP},
      </if>
      <if test="imageFile1 != null">
        IMAGE_FILE_1 = #{imageFile1,jdbcType=VARCHAR},
      </if>
      <if test="imageFile2 != null">
        IMAGE_FILE_2 = #{imageFile2,jdbcType=VARCHAR},
      </if>
      <if test="imageFile3 != null">
        IMAGE_FILE_3 = #{imageFile3,jdbcType=VARCHAR},
      </if>
      <if test="imageFile4 != null">
        IMAGE_FILE_4 = #{imageFile4,jdbcType=VARCHAR},
      </if>
      <if test="imageFile5 != null">
        IMAGE_FILE_5 = #{imageFile5,jdbcType=VARCHAR},
      </if>
      <if test="imageFile6 != null">
        IMAGE_FILE_6 = #{imageFile6,jdbcType=VARCHAR},
      </if>
      <if test="imageFile7 != null">
        IMAGE_FILE_7 = #{imageFile7,jdbcType=VARCHAR},
      </if>
      <if test="imageFile8 != null">
        IMAGE_FILE_8 = #{imageFile8,jdbcType=VARCHAR},
      </if>
      <if test="imageNum != null">
        IMAGE_NUM = #{imageNum,jdbcType=DECIMAL},
      </if>
    </set>
    where ACTUAL_FIRST_NO = #{actualFirstNo,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where ACTUAL_FIRST_NO = #{actualFirstNo,jdbcType=VARCHAR}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="where"/>
    order by  IMAGE_TIME desc
  </select>
  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="whereLike"/>
    order by  IMAGE_TIME desc
  </select>
  <insert id="batchInsert" parameterType="java.util.List">
    insert into METER_WORK_IMAGE 
      (ACTUAL_FIRST_NO, 
      IMAGE_TIME, IMAGE_FILE_1, IMAGE_FILE_2, 
      IMAGE_FILE_3, IMAGE_FILE_4, IMAGE_FILE_5, 
      IMAGE_FILE_6, IMAGE_FILE_7, IMAGE_FILE_8, 
      IMAGE_NUM)
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.actualFirstNo,jdbcType=VARCHAR}, 
      #{item.imageTime,jdbcType=TIMESTAMP}, #{item.imageFile1,jdbcType=VARCHAR}, #{item.imageFile2,jdbcType=VARCHAR}, 
      #{item.imageFile3,jdbcType=VARCHAR}, #{item.imageFile4,jdbcType=VARCHAR}, #{item.imageFile5,jdbcType=VARCHAR}, 
      #{item.imageFile6,jdbcType=VARCHAR}, #{item.imageFile7,jdbcType=VARCHAR}, #{item.imageFile8,jdbcType=VARCHAR}, 
      #{item.imageNum,jdbcType=DECIMAL} from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update METER_WORK_IMAGE
     set
       ACTUAL_FIRST_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_FIRST_NO" close="end">
          when #{item.actualFirstNo,jdbcType=VARCHAR} then #{item.actualFirstNo,jdbcType=VARCHAR}
       </foreach>
       ,IMAGE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_FIRST_NO" close="end">
          when #{item.actualFirstNo,jdbcType=VARCHAR} then #{item.imageTime,jdbcType=TIMESTAMP}
       </foreach>
       ,IMAGE_FILE_1=
       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_FIRST_NO" close="end">
          when #{item.actualFirstNo,jdbcType=VARCHAR} then #{item.imageFile1,jdbcType=VARCHAR}
       </foreach>
       ,IMAGE_FILE_2=
       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_FIRST_NO" close="end">
          when #{item.actualFirstNo,jdbcType=VARCHAR} then #{item.imageFile2,jdbcType=VARCHAR}
       </foreach>
       ,IMAGE_FILE_3=
       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_FIRST_NO" close="end">
          when #{item.actualFirstNo,jdbcType=VARCHAR} then #{item.imageFile3,jdbcType=VARCHAR}
       </foreach>
       ,IMAGE_FILE_4=
       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_FIRST_NO" close="end">
          when #{item.actualFirstNo,jdbcType=VARCHAR} then #{item.imageFile4,jdbcType=VARCHAR}
       </foreach>
       ,IMAGE_FILE_5=
       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_FIRST_NO" close="end">
          when #{item.actualFirstNo,jdbcType=VARCHAR} then #{item.imageFile5,jdbcType=VARCHAR}
       </foreach>
       ,IMAGE_FILE_6=
       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_FIRST_NO" close="end">
          when #{item.actualFirstNo,jdbcType=VARCHAR} then #{item.imageFile6,jdbcType=VARCHAR}
       </foreach>
       ,IMAGE_FILE_7=
       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_FIRST_NO" close="end">
          when #{item.actualFirstNo,jdbcType=VARCHAR} then #{item.imageFile7,jdbcType=VARCHAR}
       </foreach>
       ,IMAGE_FILE_8=
       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_FIRST_NO" close="end">
          when #{item.actualFirstNo,jdbcType=VARCHAR} then #{item.imageFile8,jdbcType=VARCHAR}
       </foreach>
       ,IMAGE_NUM=
       <foreach collection="list" item="item" index="index" separator=" " open="case ACTUAL_FIRST_NO" close="end">
          when #{item.actualFirstNo,jdbcType=VARCHAR} then #{item.imageNum,jdbcType=DECIMAL}
       </foreach>
     where ACTUAL_FIRST_NO in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.actualFirstNo,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from METER_WORK_IMAGE
    where ACTUAL_FIRST_NO in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  
</mapper>