<?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.baseinfo.meterfilerecord.mapper.MeterFileRecordMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.baseinfo.meterfilerecord.model.MeterFileRecord">
    <id column="FILE_RECORD_ID" jdbcType="VARCHAR" property="fileRecordId" />
    <result column="FILE_NAME" jdbcType="VARCHAR" property="fileName" />
    <result column="OPERATION_NAME" jdbcType="VARCHAR" property="operationName" />
    <result column="OPERATION_MAN_NAME" jdbcType="VARCHAR" property="operationManName" />
    <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" />
    <result column="MEMO" jdbcType="VARCHAR" property="memo" />
    <result column="FILE_ID" jdbcType="VARCHAR" property="fileId" />
  </resultMap>
  <sql id="columns">
    FILE_RECORD_ID, FILE_NAME, OPERATION_NAME, OPERATION_MAN_NAME, CREATE_TIME, MEMO, 
    FILE_ID
  </sql>
  <sql id="columns_alias">
    t.FILE_RECORD_ID, t.FILE_NAME, t.OPERATION_NAME, t.OPERATION_MAN_NAME, t.CREATE_TIME, 
    t.MEMO, t.FILE_ID
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM METER_FILE_RECORD
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM METER_FILE_RECORD t
  </sql>
  <sql id="where">
    <where> 
      <if test="fileRecordId != null and fileRecordId != ''">
        and FILE_RECORD_ID = #{fileRecordId}
      </if>
      <if test="fileName != null and fileName != ''">
        and FILE_NAME = #{fileName}
      </if>
      <if test="operationName != null and operationName != ''">
        and OPERATION_NAME = #{operationName}
      </if>
      <if test="operationManName != null and operationManName != ''">
        and OPERATION_MAN_NAME = #{operationManName}
      </if>
      <if test="createTime != null">
        and TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = #{createTime}
      </if>
      <if test="memo != null and memo != ''">
        and MEMO = #{memo}
      </if>
      <if test="fileId != null and fileId != ''">
        and FILE_ID = #{fileId}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="fileRecordId != null and fileRecordId != ''">
        and FILE_RECORD_ID LIKE '%${fileRecordId}%'
      </if>
      <if test="fileName != null and fileName != ''">
        and FILE_NAME LIKE '%${fileName}%'
      </if>
      <if test="operationName != null and operationName != ''">
        and OPERATION_NAME LIKE '%${operationName}%'
      </if>
      <if test="operationManName != null and operationManName != ''">
        and OPERATION_MAN_NAME LIKE '%${operationManName}%'
      </if>
      <if test="createTime != null">
        and TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = #{createTime}
      </if>
      <if test="memo != null and memo != ''">
        and MEMO LIKE '%${memo}%'
      </if>
      <if test="fileId != null and fileId != ''">
        and FILE_ID LIKE '%${fileId}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from METER_FILE_RECORD
    where FILE_RECORD_ID = #{fileRecordId,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from METER_FILE_RECORD
    where 1!=1 
      <if test="fileName != null and fileName != ''">
        or FILE_NAME = #{fileName}
      </if>
      <if test="operationName != null and operationName != ''">
        or OPERATION_NAME = #{operationName}
      </if>
      <if test="operationManName != null and operationManName != ''">
        or OPERATION_MAN_NAME = #{operationManName}
      </if>
      <if test="createTime != null">
        or TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = '#{createTime}'
      </if>
      <if test="memo != null and memo != ''">
        or MEMO = #{memo}
      </if>
      <if test="fileId != null and fileId != ''">
        or FILE_ID = #{fileId}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.baseinfo.meterfilerecord.model.MeterFileRecord">
    insert into METER_FILE_RECORD (FILE_RECORD_ID, FILE_NAME, OPERATION_NAME, 
      OPERATION_MAN_NAME, CREATE_TIME, MEMO, 
      FILE_ID)
    values (#{fileRecordId,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR}, #{operationName,jdbcType=VARCHAR}, 
      #{operationManName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{memo,jdbcType=VARCHAR}, 
      #{fileId,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.baseinfo.meterfilerecord.model.MeterFileRecord">
    insert into METER_FILE_RECORD
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="fileRecordId != null">
        FILE_RECORD_ID,
      </if>
      <if test="fileName != null">
        FILE_NAME,
      </if>
      <if test="operationName != null">
        OPERATION_NAME,
      </if>
      <if test="operationManName != null">
        OPERATION_MAN_NAME,
      </if>
      <if test="createTime != null">
        CREATE_TIME,
      </if>
      <if test="memo != null">
        MEMO,
      </if>
      <if test="fileId != null">
        FILE_ID,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="fileRecordId != null">
        #{fileRecordId,jdbcType=VARCHAR},
      </if>
      <if test="fileName != null">
        #{fileName,jdbcType=VARCHAR},
      </if>
      <if test="operationName != null">
        #{operationName,jdbcType=VARCHAR},
      </if>
      <if test="operationManName != null">
        #{operationManName,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="memo != null">
        #{memo,jdbcType=VARCHAR},
      </if>
      <if test="fileId != null">
        #{fileId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.baseinfo.meterfilerecord.model.MeterFileRecord">
    update METER_FILE_RECORD
    set FILE_NAME = #{fileName,jdbcType=VARCHAR},
      OPERATION_NAME = #{operationName,jdbcType=VARCHAR},
      OPERATION_MAN_NAME = #{operationManName,jdbcType=VARCHAR},
      CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
      MEMO = #{memo,jdbcType=VARCHAR},
      FILE_ID = #{fileId,jdbcType=VARCHAR}
    where FILE_RECORD_ID = #{fileRecordId,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.baseinfo.meterfilerecord.model.MeterFileRecord">
    update METER_FILE_RECORD
    <set>
      <if test="fileName != null">
        FILE_NAME = #{fileName,jdbcType=VARCHAR},
      </if>
      <if test="operationName != null">
        OPERATION_NAME = #{operationName,jdbcType=VARCHAR},
      </if>
      <if test="operationManName != null">
        OPERATION_MAN_NAME = #{operationManName,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="memo != null">
        MEMO = #{memo,jdbcType=VARCHAR},
      </if>
      <if test="fileId != null">
        FILE_ID = #{fileId,jdbcType=VARCHAR},
      </if>
    </set>
    where FILE_RECORD_ID = #{fileRecordId,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where FILE_RECORD_ID = #{fileRecordId,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_FILE_RECORD 
      (FILE_RECORD_ID, 
      FILE_NAME, OPERATION_NAME, OPERATION_MAN_NAME, 
      CREATE_TIME, MEMO, FILE_ID
      )
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.fileRecordId,jdbcType=VARCHAR}, 
      #{item.fileName,jdbcType=VARCHAR}, #{item.operationName,jdbcType=VARCHAR}, #{item.operationManName,jdbcType=VARCHAR}, 
      #{item.createTime,jdbcType=TIMESTAMP}, #{item.memo,jdbcType=VARCHAR}, #{item.fileId,jdbcType=VARCHAR}
       from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update METER_FILE_RECORD
     set
       FILE_RECORD_ID=
       <foreach collection="list" item="item" index="index" separator=" " open="case FILE_RECORD_ID" close="end">
          when #{item.fileRecordId,jdbcType=VARCHAR} then #{item.fileRecordId,jdbcType=VARCHAR}
       </foreach>
       ,FILE_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case FILE_RECORD_ID" close="end">
          when #{item.fileRecordId,jdbcType=VARCHAR} then #{item.fileName,jdbcType=VARCHAR}
       </foreach>
       ,OPERATION_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case FILE_RECORD_ID" close="end">
          when #{item.fileRecordId,jdbcType=VARCHAR} then #{item.operationName,jdbcType=VARCHAR}
       </foreach>
       ,OPERATION_MAN_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case FILE_RECORD_ID" close="end">
          when #{item.fileRecordId,jdbcType=VARCHAR} then #{item.operationManName,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case FILE_RECORD_ID" close="end">
          when #{item.fileRecordId,jdbcType=VARCHAR} then #{item.createTime,jdbcType=TIMESTAMP}
       </foreach>
       ,MEMO=
       <foreach collection="list" item="item" index="index" separator=" " open="case FILE_RECORD_ID" close="end">
          when #{item.fileRecordId,jdbcType=VARCHAR} then #{item.memo,jdbcType=VARCHAR}
       </foreach>
       ,FILE_ID=
       <foreach collection="list" item="item" index="index" separator=" " open="case FILE_RECORD_ID" close="end">
          when #{item.fileRecordId,jdbcType=VARCHAR} then #{item.fileId,jdbcType=VARCHAR}
       </foreach>
     where FILE_RECORD_ID in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.fileRecordId,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from METER_FILE_RECORD
    where FILE_RECORD_ID in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  
</mapper>