<?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.meterbasetare.mapper.MeterBaseTareMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.baseinfo.meterbasetare.model.MeterBaseTare">
    <id column="TARE_NO" jdbcType="VARCHAR" property="tareNo" />
    <result column="MATTER_NO" jdbcType="VARCHAR" property="matterNo" />
    <result column="MATTER_NAME" jdbcType="VARCHAR" property="matterName" />
    <result column="METER_TYPE_NO" jdbcType="VARCHAR" property="meterTypeNo" />
    <result column="METER_TYPE_NAME" jdbcType="VARCHAR" property="meterTypeName" />
    <result column="TARE_TYPE_NO" jdbcType="VARCHAR" property="tareTypeNo" />
    <result column="TARE_TYPE_NAME" jdbcType="VARCHAR" property="tareTypeName" />
    <result column="TARE_TIME" jdbcType="VARCHAR" property="tareTime" />
    <result column="TARE_SPACE_TIME" jdbcType="DECIMAL" property="tareSpaceTime" />
    <result column="MEMO" jdbcType="VARCHAR" property="memo" />
    <result column="CREATE_MAN_NO" jdbcType="VARCHAR" property="createManNo" />
    <result column="CREATE_MAN_NAME" jdbcType="VARCHAR" property="createManName" />
    <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" />
    <result column="UPDATE_MAN_NO" jdbcType="VARCHAR" property="updateManNo" />
    <result column="UPDATE_MAN_NAME" jdbcType="VARCHAR" property="updateManName" />
    <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>
  <sql id="columns">
    TARE_NO, MATTER_NO, MATTER_NAME, METER_TYPE_NO, METER_TYPE_NAME, TARE_TYPE_NO, TARE_TYPE_NAME, 
    TARE_TIME, TARE_SPACE_TIME, MEMO, CREATE_MAN_NO, CREATE_MAN_NAME, CREATE_TIME, UPDATE_MAN_NO, 
    UPDATE_MAN_NAME, UPDATE_TIME
  </sql>
  <sql id="columns_alias">
    t.TARE_NO, t.MATTER_NO, t.MATTER_NAME, t.METER_TYPE_NO, t.METER_TYPE_NAME, t.TARE_TYPE_NO, 
    t.TARE_TYPE_NAME, t.TARE_TIME, t.TARE_SPACE_TIME, t.MEMO, t.CREATE_MAN_NO, t.CREATE_MAN_NAME, 
    t.CREATE_TIME, t.UPDATE_MAN_NO, t.UPDATE_MAN_NAME, t.UPDATE_TIME
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM METER_BASE_TARE
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM METER_BASE_TARE t
  </sql>
  <sql id="where">
    <where>
      <if test="tareNo != null and tareNo != ''">
        and TARE_NO = #{tareNo}
      </if>
      <if test="matterNo != null and matterNo != ''">
        and MATTER_NO = #{matterNo}
      </if>
      <if test="matterName != null and matterName != ''">
        and MATTER_NAME = #{matterName}
      </if>
      <if test="meterTypeNo != null and meterTypeNo != ''">
        and METER_TYPE_NO = #{meterTypeNo}
      </if>
      <if test="meterTypeName != null and meterTypeName != ''">
        and METER_TYPE_NAME = #{meterTypeName}
      </if>
      <if test="tareTypeNo != null and tareTypeNo != ''">
        and TARE_TYPE_NO = #{tareTypeNo}
      </if>
      <if test="tareTypeName != null and tareTypeName != ''">
        and TARE_TYPE_NAME = #{tareTypeName}
      </if>
      <if test="tareTime != null and tareTime != ''">
        and TARE_TIME = #{tareTime}
      </if>
      <if test="tareSpaceTime != null">
        and TARE_SPACE_TIME = #{tareSpaceTime}
      </if>
      <if test="memo != null and memo != ''">
        and MEMO = #{memo}
      </if>
      <if test="createManNo != null and createManNo != ''">
        and CREATE_MAN_NO = #{createManNo}
      </if>
      <if test="createManName != null and createManName != ''">
        and CREATE_MAN_NAME = #{createManName}
      </if>
      <if test="createTime != null">
        and TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = #{createTime}
      </if>
      <if test="updateManNo != null and updateManNo != ''">
        and UPDATE_MAN_NO = #{updateManNo}
      </if>
      <if test="updateManName != null and updateManName != ''">
        and UPDATE_MAN_NAME = #{updateManName}
      </if>
      <if test="updateTime != null">
        and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where>
      <if test="tareNo != null and tareNo != ''">
        and TARE_NO LIKE '%${tareNo}%'
      </if>
      <if test="matterNo != null and matterNo != ''">
        and MATTER_NO LIKE '%${matterNo}%'
      </if>
      <if test="matterName != null and matterName != ''">
        and MATTER_NAME LIKE '%${matterName}%'
      </if>
      <if test="meterTypeNo != null and meterTypeNo != ''">
        and METER_TYPE_NO LIKE '%${meterTypeNo}%'
      </if>
      <if test="meterTypeName != null and meterTypeName != ''">
        and METER_TYPE_NAME LIKE '%${meterTypeName}%'
      </if>
      <if test="tareTypeNo != null and tareTypeNo != ''">
        and TARE_TYPE_NO LIKE '%${tareTypeNo}%'
      </if>
      <if test="tareTypeName != null and tareTypeName != ''">
        and TARE_TYPE_NAME LIKE '%${tareTypeName}%'
      </if>
      <if test="tareTime != null and tareTime != ''">
        and TARE_TIME LIKE '%${tareTime}%'
      </if>
      <if test="tareSpaceTime != null">
        and TARE_SPACE_TIME = #{tareSpaceTime}
      </if>
      <if test="memo != null and memo != ''">
        and MEMO LIKE '%${memo}%'
      </if>
      <if test="createManNo != null and createManNo != ''">
        and CREATE_MAN_NO LIKE '%${createManNo}%'
      </if>
      <if test="createManName != null and createManName != ''">
        and CREATE_MAN_NAME LIKE '%${createManName}%'
      </if>
      <if test="createTime != null">
        and TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = #{createTime}
      </if>
      <if test="updateManNo != null and updateManNo != ''">
        and UPDATE_MAN_NO LIKE '%${updateManNo}%'
      </if>
      <if test="updateManName != null and updateManName != ''">
        and UPDATE_MAN_NAME LIKE '%${updateManName}%'
      </if>
      <if test="updateTime != null">
        and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from METER_BASE_TARE
    where TARE_NO = #{tareNo,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from METER_BASE_TARE
    where 1!=1 
      <if test="matterNo != null and matterNo != ''">
        or MATTER_NO = #{matterNo}
      </if>
      <if test="matterName != null and matterName != ''">
        or MATTER_NAME = #{matterName}
      </if>
      <if test="meterTypeNo != null and meterTypeNo != ''">
        or METER_TYPE_NO = #{meterTypeNo}
      </if>
      <if test="meterTypeName != null and meterTypeName != ''">
        or METER_TYPE_NAME = #{meterTypeName}
      </if>
      <if test="tareTypeNo != null and tareTypeNo != ''">
        or TARE_TYPE_NO = #{tareTypeNo}
      </if>
      <if test="tareTypeName != null and tareTypeName != ''">
        or TARE_TYPE_NAME = #{tareTypeName}
      </if>
      <if test="tareTime != null">
        or TARE_TIME = #{tareTime}
      </if>
      <if test="tareSpaceTime != null">
        or TARE_SPACE_TIME = #{tareSpaceTime}
      </if>
      <if test="memo != null and memo != ''">
        or MEMO = #{memo}
      </if>
      <if test="createManNo != null and createManNo != ''">
        or CREATE_MAN_NO = #{createManNo}
      </if>
      <if test="createManName != null and createManName != ''">
        or CREATE_MAN_NAME = #{createManName}
      </if>
      <if test="createTime != null">
        or TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = '#{createTime}'
      </if>
      <if test="updateManNo != null and updateManNo != ''">
        or UPDATE_MAN_NO = #{updateManNo}
      </if>
      <if test="updateManName != null and updateManName != ''">
        or UPDATE_MAN_NAME = #{updateManName}
      </if>
      <if test="updateTime != null">
        or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.baseinfo.meterbasetare.model.MeterBaseTare">
    insert into METER_BASE_TARE (TARE_NO, MATTER_NO, MATTER_NAME, 
      METER_TYPE_NO, METER_TYPE_NAME, TARE_TYPE_NO, 
      TARE_TYPE_NAME, TARE_TIME, TARE_SPACE_TIME, 
      MEMO, CREATE_MAN_NO, CREATE_MAN_NAME, 
      CREATE_TIME, UPDATE_MAN_NO, UPDATE_MAN_NAME, 
      UPDATE_TIME)
    values (#{tareNo,jdbcType=VARCHAR}, #{matterNo,jdbcType=VARCHAR}, #{matterName,jdbcType=VARCHAR}, 
      #{meterTypeNo,jdbcType=VARCHAR}, #{meterTypeName,jdbcType=VARCHAR}, #{tareTypeNo,jdbcType=VARCHAR}, 
      #{tareTypeName,jdbcType=VARCHAR}, #{tareTime,jdbcType=VARCHAR}, #{tareSpaceTime,jdbcType=DECIMAL},
      #{memo,jdbcType=VARCHAR}, #{createManNo,jdbcType=VARCHAR}, #{createManName,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=TIMESTAMP}, #{updateManNo,jdbcType=VARCHAR}, #{updateManName,jdbcType=VARCHAR}, 
      #{updateTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.baseinfo.meterbasetare.model.MeterBaseTare">
    insert into METER_BASE_TARE
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="tareNo != null">
        TARE_NO,
      </if>
      <if test="matterNo != null">
        MATTER_NO,
      </if>
      <if test="matterName != null">
        MATTER_NAME,
      </if>
      <if test="meterTypeNo != null">
        METER_TYPE_NO,
      </if>
      <if test="meterTypeName != null">
        METER_TYPE_NAME,
      </if>
      <if test="tareTypeNo != null">
        TARE_TYPE_NO,
      </if>
      <if test="tareTypeName != null">
        TARE_TYPE_NAME,
      </if>
      <if test="tareTime != null">
        TARE_TIME,
      </if>
      <if test="tareSpaceTime != null">
        TARE_SPACE_TIME,
      </if>
      <if test="memo != null">
        MEMO,
      </if>
      <if test="createManNo != null">
        CREATE_MAN_NO,
      </if>
      <if test="createManName != null">
        CREATE_MAN_NAME,
      </if>
      <if test="createTime != null">
        CREATE_TIME,
      </if>
      <if test="updateManNo != null">
        UPDATE_MAN_NO,
      </if>
      <if test="updateManName != null">
        UPDATE_MAN_NAME,
      </if>
      <if test="updateTime != null">
        UPDATE_TIME,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="tareNo != null">
        #{tareNo,jdbcType=VARCHAR},
      </if>
      <if test="matterNo != null">
        #{matterNo,jdbcType=VARCHAR},
      </if>
      <if test="matterName != null">
        #{matterName,jdbcType=VARCHAR},
      </if>
      <if test="meterTypeNo != null">
        #{meterTypeNo,jdbcType=VARCHAR},
      </if>
      <if test="meterTypeName != null">
        #{meterTypeName,jdbcType=VARCHAR},
      </if>
      <if test="tareTypeNo != null">
        #{tareTypeNo,jdbcType=VARCHAR},
      </if>
      <if test="tareTypeName != null">
        #{tareTypeName,jdbcType=VARCHAR},
      </if>
      <if test="tareTime != null">
        #{tareTime,jdbcType=TIMESTAMP},
      </if>
      <if test="tareSpaceTime != null">
        #{tareSpaceTime,jdbcType=DECIMAL},
      </if>
      <if test="memo != null">
        #{memo,jdbcType=VARCHAR},
      </if>
      <if test="createManNo != null">
        #{createManNo,jdbcType=VARCHAR},
      </if>
      <if test="createManName != null">
        #{createManName,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateManNo != null">
        #{updateManNo,jdbcType=VARCHAR},
      </if>
      <if test="updateManName != null">
        #{updateManName,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.baseinfo.meterbasetare.model.MeterBaseTare">
    update METER_BASE_TARE
    set MATTER_NO = #{matterNo,jdbcType=VARCHAR},
      MATTER_NAME = #{matterName,jdbcType=VARCHAR},
      METER_TYPE_NO = #{meterTypeNo,jdbcType=VARCHAR},
      METER_TYPE_NAME = #{meterTypeName,jdbcType=VARCHAR},
      TARE_TYPE_NO = #{tareTypeNo,jdbcType=VARCHAR},
      TARE_TYPE_NAME = #{tareTypeName,jdbcType=VARCHAR},
      TARE_TIME = #{tareTime,jdbcType=VARCHAR},
      TARE_SPACE_TIME = #{tareSpaceTime,jdbcType=DECIMAL},
      MEMO = #{memo,jdbcType=VARCHAR},
      CREATE_MAN_NO = #{createManNo,jdbcType=VARCHAR},
      CREATE_MAN_NAME = #{createManName,jdbcType=VARCHAR},
      CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
      UPDATE_MAN_NO = #{updateManNo,jdbcType=VARCHAR},
      UPDATE_MAN_NAME = #{updateManName,jdbcType=VARCHAR},
      UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP}
    where TARE_NO = #{tareNo,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.baseinfo.meterbasetare.model.MeterBaseTare">
    update METER_BASE_TARE
    <set>
      <if test="matterNo != null">
        MATTER_NO = #{matterNo,jdbcType=VARCHAR},
      </if>
      <if test="matterName != null">
        MATTER_NAME = #{matterName,jdbcType=VARCHAR},
      </if>
      <if test="meterTypeNo != null">
        METER_TYPE_NO = #{meterTypeNo,jdbcType=VARCHAR},
      </if>
      <if test="meterTypeName != null">
        METER_TYPE_NAME = #{meterTypeName,jdbcType=VARCHAR},
      </if>
      <if test="tareTypeNo != null">
        TARE_TYPE_NO = #{tareTypeNo,jdbcType=VARCHAR},
      </if>
      <if test="tareTypeName != null">
        TARE_TYPE_NAME = #{tareTypeName,jdbcType=VARCHAR},
      </if>
      <if test="tareTime != null">
        TARE_TIME = #{tareTime,jdbcType=VARCHAR},
      </if>
      <if test="tareSpaceTime != null">
        TARE_SPACE_TIME = #{tareSpaceTime,jdbcType=DECIMAL},
      </if>
      <if test="memo != null">
        MEMO = #{memo,jdbcType=VARCHAR},
      </if>
      <if test="createManNo != null">
        CREATE_MAN_NO = #{createManNo,jdbcType=VARCHAR},
      </if>
      <if test="createManName != null">
        CREATE_MAN_NAME = #{createManName,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateManNo != null">
        UPDATE_MAN_NO = #{updateManNo,jdbcType=VARCHAR},
      </if>
      <if test="updateManName != null">
        UPDATE_MAN_NAME = #{updateManName,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where TARE_NO = #{tareNo,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where TARE_NO = #{tareNo,jdbcType=VARCHAR}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="where"/>
    order by CREATE_TIME  desc
  </select>
  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="whereLike"/>
    order by CREATE_TIME  desc
  </select>
  <insert id="batchInsert" parameterType="java.util.List">
    insert into METER_BASE_TARE 
      (TARE_NO, 
      MATTER_NO, MATTER_NAME, METER_TYPE_NO, 
      METER_TYPE_NAME, TARE_TYPE_NO, TARE_TYPE_NAME, 
      TARE_TIME, TARE_SPACE_TIME, MEMO, 
      CREATE_MAN_NO, CREATE_MAN_NAME, CREATE_TIME, 
      UPDATE_MAN_NO, UPDATE_MAN_NAME, UPDATE_TIME
      )
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.tareNo,jdbcType=VARCHAR}, 
      #{item.matterNo,jdbcType=VARCHAR}, #{item.matterName,jdbcType=VARCHAR}, #{item.meterTypeNo,jdbcType=VARCHAR}, 
      #{item.meterTypeName,jdbcType=VARCHAR}, #{item.tareTypeNo,jdbcType=VARCHAR}, #{item.tareTypeName,jdbcType=VARCHAR}, 
      #{item.tareTime,jdbcType=VARCHAR}, #{item.tareSpaceTime,jdbcType=DECIMAL}, #{item.memo,jdbcType=VARCHAR},
      #{item.createManNo,jdbcType=VARCHAR}, #{item.createManName,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, 
      #{item.updateManNo,jdbcType=VARCHAR}, #{item.updateManName,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}
       from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update METER_BASE_TARE
     set
       TARE_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.tareNo,jdbcType=VARCHAR}
       </foreach>
       ,MATTER_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.matterNo,jdbcType=VARCHAR}
       </foreach>
       ,MATTER_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.matterName,jdbcType=VARCHAR}
       </foreach>
       ,METER_TYPE_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.meterTypeNo,jdbcType=VARCHAR}
       </foreach>
       ,METER_TYPE_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.meterTypeName,jdbcType=VARCHAR}
       </foreach>
       ,TARE_TYPE_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.tareTypeNo,jdbcType=VARCHAR}
       </foreach>
       ,TARE_TYPE_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.tareTypeName,jdbcType=VARCHAR}
       </foreach>
       ,TARE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.tareTime,jdbcType=VARCHAR}
       </foreach>
       ,TARE_SPACE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.tareSpaceTime,jdbcType=DECIMAL}
       </foreach>
       ,MEMO=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.memo,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_MAN_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.createManNo,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_MAN_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.createManName,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.createTime,jdbcType=TIMESTAMP}
       </foreach>
       ,UPDATE_MAN_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.updateManNo,jdbcType=VARCHAR}
       </foreach>
       ,UPDATE_MAN_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.updateManName,jdbcType=VARCHAR}
       </foreach>
       ,UPDATE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case TARE_NO" close="end">
          when #{item.tareNo,jdbcType=VARCHAR} then #{item.updateTime,jdbcType=TIMESTAMP}
       </foreach>
     where TARE_NO in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.tareNo,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from METER_BASE_TARE
    where TARE_NO in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  <select id="GetNewID" parameterType="java.lang.String" resultType="java.lang.String">
    SELECT LPAD(NVL(MAX(TO_NUMBER(SUBSTR(TARE_NO, LENGTH(TARE_NO)-4 ))),0) + 1,5,'0') TARE_NO
    FROM METER_BASE_TARE
  </select>

  <select id="selectForUpdate" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <where>
      <if test="tareNo != null and tareNo != ''">
        and TARE_NO != #{tareNo}
      </if>
      <if test="matterNo != null and matterNo != ''">
        and MATTER_NO = #{matterNo}
      </if>
      <if test="matterName != null and matterName != ''">
        and MATTER_NAME = #{matterName}
      </if>
      <if test="meterTypeNo != null and meterTypeNo != ''">
        and METER_TYPE_NO = #{meterTypeNo}
      </if>
      <if test="meterTypeName != null and meterTypeName != ''">
        and METER_TYPE_NAME = #{meterTypeName}
      </if>
    </where>
  </select>
</mapper>