<?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.meterbasemattermap.mapper.MeterBaseMatterMapMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.baseinfo.meterbasemattermap.model.MeterBaseMatterMap">
    <id column="MAP_NO" jdbcType="VARCHAR" property="mapNo" />
    <result column="MAATER_NO1" jdbcType="VARCHAR" property="maaterNo1" />
    <result column="MAATER_NO2" jdbcType="VARCHAR" property="maaterNo2" />
    <result column="VALUE_FLAG" jdbcType="VARCHAR" property="valueFlag" />
  </resultMap>
  <sql id="columns">
    MAP_NO, MAATER_NO1, MAATER_NO2, VALUE_FLAG
  </sql>
  <sql id="columns_alias">
    t.MAP_NO, t.MAATER_NO1, t.MAATER_NO2, t.VALUE_FLAG
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM METER_BASE_MATTER_MAP
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM METER_BASE_MATTER_MAP t
  </sql>
  <sql id="where">
    <where> 
      <if test="mapNo != null and mapNo != ''">
        and MAP_NO = #{mapNo}
      </if>
      <if test="maaterNo1 != null and maaterNo1 != ''">
        and MAATER_NO1 = #{maaterNo1}
      </if>
      <if test="maaterNo2 != null and maaterNo2 != ''">
        and MAATER_NO2 = #{maaterNo2}
      </if>
      <if test="valueFlag != null and valueFlag != ''">
        and VALUE_FLAG = #{valueFlag}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="mapNo != null and mapNo != ''">
        and MAP_NO LIKE '%${mapNo}%'
      </if>
      <if test="maaterNo1 != null and maaterNo1 != ''">
        and MAATER_NO1 LIKE '%${maaterNo1}%'
      </if>
      <if test="maaterNo2 != null and maaterNo2 != ''">
        and MAATER_NO2 LIKE '%${maaterNo2}%'
      </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_BASE_MATTER_MAP
    where MAP_NO = #{mapNo,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from METER_BASE_MATTER_MAP
    where 1!=1 
      <if test="maaterNo1 != null and maaterNo1 != ''">
        or MAATER_NO1 = #{maaterNo1}
      </if>
      <if test="maaterNo2 != null and maaterNo2 != ''">
        or MAATER_NO2 = #{maaterNo2}
      </if>
      <if test="valueFlag != null and valueFlag != ''">
        or VALUE_FLAG = #{valueFlag}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.baseinfo.meterbasemattermap.model.MeterBaseMatterMap">
    insert into METER_BASE_MATTER_MAP (MAP_NO, MAATER_NO1, MAATER_NO2, 
      VALUE_FLAG)
    values (#{mapNo,jdbcType=VARCHAR}, #{maaterNo1,jdbcType=VARCHAR}, #{maaterNo2,jdbcType=VARCHAR}, 
      #{valueFlag,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.baseinfo.meterbasemattermap.model.MeterBaseMatterMap">
    insert into METER_BASE_MATTER_MAP
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="mapNo != null">
        MAP_NO,
      </if>
      <if test="maaterNo1 != null">
        MAATER_NO1,
      </if>
      <if test="maaterNo2 != null">
        MAATER_NO2,
      </if>
      <if test="valueFlag != null">
        VALUE_FLAG,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="mapNo != null">
        #{mapNo,jdbcType=VARCHAR},
      </if>
      <if test="maaterNo1 != null">
        #{maaterNo1,jdbcType=VARCHAR},
      </if>
      <if test="maaterNo2 != null">
        #{maaterNo2,jdbcType=VARCHAR},
      </if>
      <if test="valueFlag != null">
        #{valueFlag,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.baseinfo.meterbasemattermap.model.MeterBaseMatterMap">
    update METER_BASE_MATTER_MAP
    set MAATER_NO1 = #{maaterNo1,jdbcType=VARCHAR},
      MAATER_NO2 = #{maaterNo2,jdbcType=VARCHAR},
      VALUE_FLAG = #{valueFlag,jdbcType=VARCHAR}
    where MAP_NO = #{mapNo,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.baseinfo.meterbasemattermap.model.MeterBaseMatterMap">
    update METER_BASE_MATTER_MAP
    <set>
      <if test="maaterNo1 != null">
        MAATER_NO1 = #{maaterNo1,jdbcType=VARCHAR},
      </if>
      <if test="maaterNo2 != null">
        MAATER_NO2 = #{maaterNo2,jdbcType=VARCHAR},
      </if>
      <if test="valueFlag != null">
        VALUE_FLAG = #{valueFlag,jdbcType=VARCHAR},
      </if>
    </set>
    where MAP_NO = #{mapNo,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where MAP_NO = #{mapNo,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_BASE_MATTER_MAP 
      (MAP_NO, 
      MAATER_NO1, MAATER_NO2, VALUE_FLAG
      )
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.mapNo,jdbcType=VARCHAR}, 
      #{item.maaterNo1,jdbcType=VARCHAR}, #{item.maaterNo2,jdbcType=VARCHAR}, #{item.valueFlag,jdbcType=VARCHAR}
       from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update METER_BASE_MATTER_MAP
     set
       MAP_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case MAP_NO" close="end">
          when #{item.mapNo,jdbcType=VARCHAR} then #{item.mapNo,jdbcType=VARCHAR}
       </foreach>
       ,MAATER_NO1=
       <foreach collection="list" item="item" index="index" separator=" " open="case MAP_NO" close="end">
          when #{item.mapNo,jdbcType=VARCHAR} then #{item.maaterNo1,jdbcType=VARCHAR}
       </foreach>
       ,MAATER_NO2=
       <foreach collection="list" item="item" index="index" separator=" " open="case MAP_NO" close="end">
          when #{item.mapNo,jdbcType=VARCHAR} then #{item.maaterNo2,jdbcType=VARCHAR}
       </foreach>
       ,VALUE_FLAG=
       <foreach collection="list" item="item" index="index" separator=" " open="case MAP_NO" close="end">
          when #{item.mapNo,jdbcType=VARCHAR} then #{item.valueFlag,jdbcType=VARCHAR}
       </foreach>
     where MAP_NO in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.mapNo,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from METER_BASE_MATTER_MAP
    where MAP_NO in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  
</mapper>