<?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.meterbasescalerange.mapper.MeterBaseScaleRangeMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.baseinfo.meterbasescalerange.model.MeterBaseScaleRange">
    <id column="SCALE_RANGE_NO" jdbcType="VARCHAR" property="scaleRangeNo" />
    <result column="BASE_SPOT_NO" jdbcType="VARCHAR" property="baseSpotNo" />
    <result column="BASE_SPOT_NAME" jdbcType="VARCHAR" property="baseSpotName" />
    <result column="SCALE_POINT_NO" jdbcType="VARCHAR" property="scalePointNo" />
    <result column="SCALE_POINT_NAME" jdbcType="VARCHAR" property="scalePointName" />
    <result column="COUNTER_WEIGHT" jdbcType="DECIMAL" property="counterWeight" />
    <result column="COUNTER_WEIGHT_DIFF" jdbcType="DECIMAL" property="counterWeightDiff" />
    <result column="UPPER_RANGE" jdbcType="DECIMAL" property="upperRange" />
    <result column="INDEX_VALUE" jdbcType="DECIMAL" property="indexValue" />
    <result column="STABLE_RATE" jdbcType="DECIMAL" property="stableRate" />
    <result column="STABLE_DIFF" jdbcType="DECIMAL" property="stableDiff" />
    <result column="UPPER_LIMIT_CLEAR_ZERO" jdbcType="DECIMAL" property="upperLimitClearZero" />
    <result column="LOWER_LIMIT_CLEAR_ZERO" jdbcType="DECIMAL" property="lowerLimitClearZero" />
    <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" />
    <result column="SELF_WEIGHT_DIFF" jdbcType="DECIMAL" property="selfWeightDiff" />
  </resultMap>
  <sql id="columns">
    SCALE_RANGE_NO, BASE_SPOT_NO, BASE_SPOT_NAME, SCALE_POINT_NO, SCALE_POINT_NAME, COUNTER_WEIGHT,
    COUNTER_WEIGHT_DIFF, UPPER_RANGE, INDEX_VALUE, STABLE_RATE, STABLE_DIFF, UPPER_LIMIT_CLEAR_ZERO,
    LOWER_LIMIT_CLEAR_ZERO, CREATE_MAN_NO, CREATE_MAN_NAME, CREATE_TIME, UPDATE_MAN_NO,
    UPDATE_MAN_NAME, UPDATE_TIME, SELF_WEIGHT_DIFF
  </sql>
  <sql id="columns_alias">
    t.SCALE_RANGE_NO, t.BASE_SPOT_NO, t.BASE_SPOT_NAME, t.SCALE_POINT_NO, t.SCALE_POINT_NAME,
    t.COUNTER_WEIGHT, t.COUNTER_WEIGHT_DIFF, t.UPPER_RANGE, t.INDEX_VALUE, t.STABLE_RATE,
    t.STABLE_DIFF, t.UPPER_LIMIT_CLEAR_ZERO, t.LOWER_LIMIT_CLEAR_ZERO, t.CREATE_MAN_NO,
    t.CREATE_MAN_NAME, t.CREATE_TIME, t.UPDATE_MAN_NO, t.UPDATE_MAN_NAME, t.UPDATE_TIME,
    t.SELF_WEIGHT_DIFF
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM METER_BASE_SCALE_RANGE
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM METER_BASE_SCALE_RANGE t
  </sql>
  <sql id="where">
    <where>
      <if test="scaleRangeNo != null and scaleRangeNo != ''">
        and SCALE_RANGE_NO = #{scaleRangeNo}
      </if>
      <if test="baseSpotNo != null and baseSpotNo != ''">
        and BASE_SPOT_NO = #{baseSpotNo}
      </if>
      <if test="baseSpotName != null and baseSpotName != ''">
        and BASE_SPOT_NAME = #{baseSpotName}
      </if>
      <if test="scalePointNo != null and scalePointNo != ''">
        and SCALE_POINT_NO = #{scalePointNo}
      </if>
      <if test="scalePointName != null and scalePointName != ''">
        and SCALE_POINT_NAME = #{scalePointName}
      </if>
      <if test="counterWeight != null">
        and COUNTER_WEIGHT = #{counterWeight}
      </if>
      <if test="counterWeightDiff != null">
        and COUNTER_WEIGHT_DIFF = #{counterWeightDiff}
      </if>
      <if test="upperRange != null">
        and UPPER_RANGE = #{upperRange}
      </if>
      <if test="indexValue != null">
        and INDEX_VALUE = #{indexValue}
      </if>
      <if test="stableRate != null">
        and STABLE_RATE = #{stableRate}
      </if>
      <if test="stableDiff != null">
        and STABLE_DIFF = #{stableDiff}
      </if>
      <if test="upperLimitClearZero != null">
        and UPPER_LIMIT_CLEAR_ZERO = #{upperLimitClearZero}
      </if>
      <if test="lowerLimitClearZero != null">
        and LOWER_LIMIT_CLEAR_ZERO = #{lowerLimitClearZero}
      </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>
      <if test="selfWeightDiff != null">
        and SELF_WEIGHT_DIFF = #{selfWeightDiff}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where>
      <if test="scaleRangeNo != null and scaleRangeNo != ''">
        and SCALE_RANGE_NO LIKE '%${scaleRangeNo}%'
      </if>
      <if test="baseSpotNo != null and baseSpotNo != ''">
        and BASE_SPOT_NO LIKE '%${baseSpotNo}%'
      </if>
      <if test="baseSpotName != null and baseSpotName != ''">
        and BASE_SPOT_NAME LIKE '%${baseSpotName}%'
      </if>
      <if test="scalePointNo != null and scalePointNo != ''">
        and SCALE_POINT_NO LIKE '%${scalePointNo}%'
      </if>
      <if test="scalePointName != null and scalePointName != ''">
        and SCALE_POINT_NAME LIKE '%${scalePointName}%'
      </if>
      <if test="counterWeight != null">
        and COUNTER_WEIGHT = #{counterWeight}
      </if>
      <if test="counterWeightDiff != null">
        and COUNTER_WEIGHT_DIFF = #{counterWeightDiff}
      </if>
      <if test="upperRange != null">
        and UPPER_RANGE = #{upperRange}
      </if>
      <if test="indexValue != null">
        and INDEX_VALUE = #{indexValue}
      </if>
      <if test="stableRate != null">
        and STABLE_RATE = #{stableRate}
      </if>
      <if test="stableDiff != null">
        and STABLE_DIFF = #{stableDiff}
      </if>
      <if test="upperLimitClearZero != null">
        and UPPER_LIMIT_CLEAR_ZERO = #{upperLimitClearZero}
      </if>
      <if test="lowerLimitClearZero != null">
        and LOWER_LIMIT_CLEAR_ZERO = #{lowerLimitClearZero}
      </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>
      <if test="selfWeightDiff != null">
        and SELF_WEIGHT_DIFF = #{selfWeightDiff}
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from METER_BASE_SCALE_RANGE
    where SCALE_RANGE_NO = #{scaleRangeNo,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from METER_BASE_SCALE_RANGE
    where 1!=1
    <if test="baseSpotNo != null and baseSpotNo != ''">
      or BASE_SPOT_NO = #{baseSpotNo}
    </if>
    <if test="baseSpotName != null and baseSpotName != ''">
      or BASE_SPOT_NAME = #{baseSpotName}
    </if>
    <if test="scalePointNo != null and scalePointNo != ''">
      or SCALE_POINT_NO = #{scalePointNo}
    </if>
    <if test="scalePointName != null and scalePointName != ''">
      or SCALE_POINT_NAME = #{scalePointName}
    </if>
    <if test="counterWeight != null">
      or COUNTER_WEIGHT = #{counterWeight}
    </if>
    <if test="counterWeightDiff != null">
      or COUNTER_WEIGHT_DIFF = #{counterWeightDiff}
    </if>
    <if test="upperRange != null">
      or UPPER_RANGE = #{upperRange}
    </if>
    <if test="indexValue != null">
      or INDEX_VALUE = #{indexValue}
    </if>
    <if test="stableRate != null">
      or STABLE_RATE = #{stableRate}
    </if>
    <if test="stableDiff != null">
      or STABLE_DIFF = #{stableDiff}
    </if>
    <if test="upperLimitClearZero != null">
      or UPPER_LIMIT_CLEAR_ZERO = #{upperLimitClearZero}
    </if>
    <if test="lowerLimitClearZero != null">
      or LOWER_LIMIT_CLEAR_ZERO = #{lowerLimitClearZero}
    </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>
    <if test="selfWeightDiff != null">
      or SELF_WEIGHT_DIFF = #{selfWeightDiff}
    </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.baseinfo.meterbasescalerange.model.MeterBaseScaleRange">
    insert into METER_BASE_SCALE_RANGE (SCALE_RANGE_NO, BASE_SPOT_NO, BASE_SPOT_NAME,
      SCALE_POINT_NO, SCALE_POINT_NAME, COUNTER_WEIGHT,
      COUNTER_WEIGHT_DIFF, UPPER_RANGE, INDEX_VALUE,
      STABLE_RATE, STABLE_DIFF, UPPER_LIMIT_CLEAR_ZERO,
      LOWER_LIMIT_CLEAR_ZERO, CREATE_MAN_NO, CREATE_MAN_NAME,
      CREATE_TIME, UPDATE_MAN_NO, UPDATE_MAN_NAME,
      UPDATE_TIME, SELF_WEIGHT_DIFF)
    values (#{scaleRangeNo,jdbcType=VARCHAR}, #{baseSpotNo,jdbcType=VARCHAR}, #{baseSpotName,jdbcType=VARCHAR},
      #{scalePointNo,jdbcType=VARCHAR}, #{scalePointName,jdbcType=VARCHAR}, #{counterWeight,jdbcType=DECIMAL},
      #{counterWeightDiff,jdbcType=DECIMAL}, #{upperRange,jdbcType=DECIMAL}, #{indexValue,jdbcType=DECIMAL},
      #{stableRate,jdbcType=DECIMAL}, #{stableDiff,jdbcType=DECIMAL}, #{upperLimitClearZero,jdbcType=DECIMAL},
      #{lowerLimitClearZero,jdbcType=DECIMAL}, #{createManNo,jdbcType=VARCHAR}, #{createManName,jdbcType=VARCHAR},
      #{createTime,jdbcType=TIMESTAMP}, #{updateManNo,jdbcType=VARCHAR}, #{updateManName,jdbcType=VARCHAR},
      #{updateTime,jdbcType=TIMESTAMP}, #{selfWeightDiff,jdbcType=DECIMAL})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.baseinfo.meterbasescalerange.model.MeterBaseScaleRange">
    insert into METER_BASE_SCALE_RANGE
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="scaleRangeNo != null">
        SCALE_RANGE_NO,
      </if>
      <if test="baseSpotNo != null">
        BASE_SPOT_NO,
      </if>
      <if test="baseSpotName != null">
        BASE_SPOT_NAME,
      </if>
      <if test="scalePointNo != null">
        SCALE_POINT_NO,
      </if>
      <if test="scalePointName != null">
        SCALE_POINT_NAME,
      </if>
      <if test="counterWeight != null">
        COUNTER_WEIGHT,
      </if>
      <if test="counterWeightDiff != null">
        COUNTER_WEIGHT_DIFF,
      </if>
      <if test="upperRange != null">
        UPPER_RANGE,
      </if>
      <if test="indexValue != null">
        INDEX_VALUE,
      </if>
      <if test="stableRate != null">
        STABLE_RATE,
      </if>
      <if test="stableDiff != null">
        STABLE_DIFF,
      </if>
      <if test="upperLimitClearZero != null">
        UPPER_LIMIT_CLEAR_ZERO,
      </if>
      <if test="lowerLimitClearZero != null">
        LOWER_LIMIT_CLEAR_ZERO,
      </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>
      <if test="selfWeightDiff != null">
        SELF_WEIGHT_DIFF,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="scaleRangeNo != null">
        #{scaleRangeNo,jdbcType=VARCHAR},
      </if>
      <if test="baseSpotNo != null">
        #{baseSpotNo,jdbcType=VARCHAR},
      </if>
      <if test="baseSpotName != null">
        #{baseSpotName,jdbcType=VARCHAR},
      </if>
      <if test="scalePointNo != null">
        #{scalePointNo,jdbcType=VARCHAR},
      </if>
      <if test="scalePointName != null">
        #{scalePointName,jdbcType=VARCHAR},
      </if>
      <if test="counterWeight != null">
        #{counterWeight,jdbcType=DECIMAL},
      </if>
      <if test="counterWeightDiff != null">
        #{counterWeightDiff,jdbcType=DECIMAL},
      </if>
      <if test="upperRange != null">
        #{upperRange,jdbcType=DECIMAL},
      </if>
      <if test="indexValue != null">
        #{indexValue,jdbcType=DECIMAL},
      </if>
      <if test="stableRate != null">
        #{stableRate,jdbcType=DECIMAL},
      </if>
      <if test="stableDiff != null">
        #{stableDiff,jdbcType=DECIMAL},
      </if>
      <if test="upperLimitClearZero != null">
        #{upperLimitClearZero,jdbcType=DECIMAL},
      </if>
      <if test="lowerLimitClearZero != null">
        #{lowerLimitClearZero,jdbcType=DECIMAL},
      </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>
      <if test="selfWeightDiff != null">
        #{selfWeightDiff,jdbcType=DECIMAL},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.baseinfo.meterbasescalerange.model.MeterBaseScaleRange">
    update METER_BASE_SCALE_RANGE
    set BASE_SPOT_NO = #{baseSpotNo,jdbcType=VARCHAR},
      BASE_SPOT_NAME = #{baseSpotName,jdbcType=VARCHAR},
      SCALE_POINT_NO = #{scalePointNo,jdbcType=VARCHAR},
      SCALE_POINT_NAME = #{scalePointName,jdbcType=VARCHAR},
      COUNTER_WEIGHT = #{counterWeight,jdbcType=DECIMAL},
      COUNTER_WEIGHT_DIFF = #{counterWeightDiff,jdbcType=DECIMAL},
      UPPER_RANGE = #{upperRange,jdbcType=DECIMAL},
      INDEX_VALUE = #{indexValue,jdbcType=DECIMAL},
      STABLE_RATE = #{stableRate,jdbcType=DECIMAL},
      STABLE_DIFF = #{stableDiff,jdbcType=DECIMAL},
      UPPER_LIMIT_CLEAR_ZERO = #{upperLimitClearZero,jdbcType=DECIMAL},
      LOWER_LIMIT_CLEAR_ZERO = #{lowerLimitClearZero,jdbcType=DECIMAL},
      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},
      SELF_WEIGHT_DIFF = #{selfWeightDiff,jdbcType=DECIMAL}
    where SCALE_RANGE_NO = #{scaleRangeNo,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.baseinfo.meterbasescalerange.model.MeterBaseScaleRange">
    update METER_BASE_SCALE_RANGE
    <set>
      <if test="baseSpotNo != null">
        BASE_SPOT_NO = #{baseSpotNo,jdbcType=VARCHAR},
      </if>
      <if test="baseSpotName != null">
        BASE_SPOT_NAME = #{baseSpotName,jdbcType=VARCHAR},
      </if>
      <if test="scalePointNo != null">
        SCALE_POINT_NO = #{scalePointNo,jdbcType=VARCHAR},
      </if>
      <if test="scalePointName != null">
        SCALE_POINT_NAME = #{scalePointName,jdbcType=VARCHAR},
      </if>
      <if test="counterWeight != null">
        COUNTER_WEIGHT = #{counterWeight,jdbcType=DECIMAL},
      </if>
      <if test="counterWeightDiff != null">
        COUNTER_WEIGHT_DIFF = #{counterWeightDiff,jdbcType=DECIMAL},
      </if>
      <if test="upperRange != null">
        UPPER_RANGE = #{upperRange,jdbcType=DECIMAL},
      </if>
      <if test="indexValue != null">
        INDEX_VALUE = #{indexValue,jdbcType=DECIMAL},
      </if>
      <if test="stableRate != null">
        STABLE_RATE = #{stableRate,jdbcType=DECIMAL},
      </if>
      <if test="stableDiff != null">
        STABLE_DIFF = #{stableDiff,jdbcType=DECIMAL},
      </if>
      <if test="upperLimitClearZero != null">
        UPPER_LIMIT_CLEAR_ZERO = #{upperLimitClearZero,jdbcType=DECIMAL},
      </if>
      <if test="lowerLimitClearZero != null">
        LOWER_LIMIT_CLEAR_ZERO = #{lowerLimitClearZero,jdbcType=DECIMAL},
      </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>
      <if test="selfWeightDiff != null">
        SELF_WEIGHT_DIFF = #{selfWeightDiff,jdbcType=DECIMAL},
      </if>
    </set>
    where SCALE_RANGE_NO = #{scaleRangeNo,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where SCALE_RANGE_NO = #{scaleRangeNo,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_SCALE_RANGE
    (SCALE_RANGE_NO,
    BASE_SPOT_NO, BASE_SPOT_NAME, SCALE_POINT_NO,
    SCALE_POINT_NAME, COUNTER_WEIGHT,
    COUNTER_WEIGHT_DIFF, UPPER_RANGE,
    INDEX_VALUE, STABLE_RATE, STABLE_DIFF,
    UPPER_LIMIT_CLEAR_ZERO, LOWER_LIMIT_CLEAR_ZERO,
    CREATE_MAN_NO, CREATE_MAN_NAME, CREATE_TIME,
    UPDATE_MAN_NO, UPDATE_MAN_NAME, UPDATE_TIME,
    SELF_WEIGHT_DIFF)
    ( <foreach collection="list" item="item" separator="union all">
    select
    #{item.scaleRangeNo,jdbcType=VARCHAR},
    #{item.baseSpotNo,jdbcType=VARCHAR}, #{item.baseSpotName,jdbcType=VARCHAR}, #{item.scalePointNo,jdbcType=VARCHAR},
    #{item.scalePointName,jdbcType=VARCHAR}, #{item.counterWeight,jdbcType=DECIMAL},
    #{item.counterWeightDiff,jdbcType=DECIMAL}, #{item.upperRange,jdbcType=DECIMAL},
    #{item.indexValue,jdbcType=DECIMAL}, #{item.stableRate,jdbcType=DECIMAL}, #{item.stableDiff,jdbcType=DECIMAL},
    #{item.upperLimitClearZero,jdbcType=DECIMAL}, #{item.lowerLimitClearZero,jdbcType=DECIMAL},
    #{item.createManNo,jdbcType=VARCHAR}, #{item.createManName,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
    #{item.updateManNo,jdbcType=VARCHAR}, #{item.updateManName,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
    #{item.selfWeightDiff,jdbcType=DECIMAL} from dual
  </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
    update METER_BASE_SCALE_RANGE
    set
    SCALE_RANGE_NO=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.scaleRangeNo,jdbcType=VARCHAR}
    </foreach>
    ,BASE_SPOT_NO=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.baseSpotNo,jdbcType=VARCHAR}
    </foreach>
    ,BASE_SPOT_NAME=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.baseSpotName,jdbcType=VARCHAR}
    </foreach>
    ,SCALE_POINT_NO=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.scalePointNo,jdbcType=VARCHAR}
    </foreach>
    ,SCALE_POINT_NAME=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.scalePointName,jdbcType=VARCHAR}
    </foreach>
    ,COUNTER_WEIGHT=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.counterWeight,jdbcType=DECIMAL}
    </foreach>
    ,COUNTER_WEIGHT_DIFF=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.counterWeightDiff,jdbcType=DECIMAL}
    </foreach>
    ,UPPER_RANGE=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.upperRange,jdbcType=DECIMAL}
    </foreach>
    ,INDEX_VALUE=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.indexValue,jdbcType=DECIMAL}
    </foreach>
    ,STABLE_RATE=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.stableRate,jdbcType=DECIMAL}
    </foreach>
    ,STABLE_DIFF=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.stableDiff,jdbcType=DECIMAL}
    </foreach>
    ,UPPER_LIMIT_CLEAR_ZERO=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.upperLimitClearZero,jdbcType=DECIMAL}
    </foreach>
    ,LOWER_LIMIT_CLEAR_ZERO=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.lowerLimitClearZero,jdbcType=DECIMAL}
    </foreach>
    ,CREATE_MAN_NO=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.createManNo,jdbcType=VARCHAR}
    </foreach>
    ,CREATE_MAN_NAME=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.createManName,jdbcType=VARCHAR}
    </foreach>
    ,CREATE_TIME=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.createTime,jdbcType=TIMESTAMP}
    </foreach>
    ,UPDATE_MAN_NO=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.updateManNo,jdbcType=VARCHAR}
    </foreach>
    ,UPDATE_MAN_NAME=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.updateManName,jdbcType=VARCHAR}
    </foreach>
    ,UPDATE_TIME=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.updateTime,jdbcType=TIMESTAMP}
    </foreach>
    ,SELF_WEIGHT_DIFF=
    <foreach collection="list" item="item" index="index" separator=" " open="case SCALE_RANGE_NO" close="end">
      when #{item.scaleRangeNo,jdbcType=VARCHAR} then #{item.selfWeightDiff,jdbcType=DECIMAL}
    </foreach>
    where SCALE_RANGE_NO in
    <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
      #{item.scaleRangeNo,jdbcType=VARCHAR}
    </foreach>
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from METER_BASE_SCALE_RANGE
    where SCALE_RANGE_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(SCALE_RANGE_NO, LENGTH(SCALE_RANGE_NO) -4))),0) + 1,5,'0') SCALE_RANGE_NO
    FROM METER_BASE_SCALE_RANGE
  </select>

  <select id="selectForUpdate" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <where>
      <if test="scaleRangeNo != null and scaleRangeNo != ''">
        and SCALE_RANGE_NO != #{scaleRangeNo}
      </if>
      <if test="baseSpotNo != null and baseSpotNo != ''">
        and BASE_SPOT_NO = #{baseSpotNo}
      </if>
      <if test="baseSpotName != null and baseSpotName != ''">
        and BASE_SPOT_NAME = #{baseSpotName}
      </if>
      <if test="scalePointNo != null and scalePointNo != ''">
        and SCALE_POINT_NO = #{scalePointNo}
      </if>
      <if test="scalePointName != null and scalePointName != ''">
        and SCALE_POINT_NAME = #{scalePointName}
      </if>
    </where>
  </select>

  <select id="selectWeight" parameterType="java.util.HashMap" resultMap="BaseResultMap">
     select t.counter_weight counter_weight,t.counter_weight_diff counter_weight_diff
     from METER_BASE_SCALE_RANGE t
     where t.base_spot_no = #{baseSpotNo} and t.base_spot_name = #{baseSpotName} and rownum = 1
  </select>

</mapper>