<?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.meterbaseunitinfo.mapper.MeterBaseUnitInfoMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.baseinfo.meterbaseunitinfo.model.MeterBaseUnitInfo">
    <id column="UNIT_NO" jdbcType="VARCHAR" property="unitNo" />
    <result column="FORWARDING_UNIT_NO" jdbcType="VARCHAR" property="forwardingUnitNo" />
    <result column="FORWARDING_UNIT_NAME" jdbcType="VARCHAR" property="forwardingUnitName" />
    <result column="RECEIVING_UNIT_NO" jdbcType="VARCHAR" property="receivingUnitNo" />
    <result column="RECEIVING_UNIT_NAME" jdbcType="VARCHAR" property="receivingUnitName" />
    <result column="ALLOWED_TARE_WEIGHT" jdbcType="VARCHAR" property="allowedTareWeight" />
    <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="DELETE_MAN_NO" jdbcType="VARCHAR" property="deleteManNo" />
    <result column="DELETE_MAN_NAME" jdbcType="VARCHAR" property="deleteManName" />
    <result column="DELETE_TIME" jdbcType="TIMESTAMP" property="deleteTime" />
    <result column="VAULE_FLAG" jdbcType="VARCHAR" property="vauleFlag" />
    <result column="MATTER_NO" jdbcType="VARCHAR" property="matterNo" />
    <result column="MATTER_NAME" jdbcType="VARCHAR" property="matterName" />
    <result column="CAR_NO" jdbcType="VARCHAR" property="carNo" />
  </resultMap>
  <sql id="columns">
    UNIT_NO, FORWARDING_UNIT_NO, FORWARDING_UNIT_NAME, RECEIVING_UNIT_NO, RECEIVING_UNIT_NAME, 
    ALLOWED_TARE_WEIGHT, CREATE_MAN_NO, CREATE_MAN_NAME, CREATE_TIME, UPDATE_MAN_NO, 
    UPDATE_MAN_NAME, UPDATE_TIME, DELETE_MAN_NO, DELETE_MAN_NAME, DELETE_TIME, VAULE_FLAG, 
    MATTER_NO, MATTER_NAME, CAR_NO
  </sql>
  <sql id="columns_alias">
    t.UNIT_NO, t.FORWARDING_UNIT_NO, t.FORWARDING_UNIT_NAME, t.RECEIVING_UNIT_NO, t.RECEIVING_UNIT_NAME, 
    t.ALLOWED_TARE_WEIGHT, t.CREATE_MAN_NO, t.CREATE_MAN_NAME, t.CREATE_TIME, t.UPDATE_MAN_NO, 
    t.UPDATE_MAN_NAME, t.UPDATE_TIME, t.DELETE_MAN_NO, t.DELETE_MAN_NAME, t.DELETE_TIME, 
    t.VAULE_FLAG, t.MATTER_NO, t.MATTER_NAME, t.CAR_NO
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM METER_BASE_UNIT_INFO
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM METER_BASE_UNIT_INFO t
  </sql>
  <sql id="where">
    <where> 
      <if test="unitNo != null and unitNo != ''">
        and UNIT_NO = #{unitNo}
      </if>
      <if test="forwardingUnitNo != null and forwardingUnitNo != ''">
        and FORWARDING_UNIT_NO = #{forwardingUnitNo}
      </if>
      <if test="forwardingUnitName != null and forwardingUnitName != ''">
        and FORWARDING_UNIT_NAME = #{forwardingUnitName}
      </if>
      <if test="receivingUnitNo != null and receivingUnitNo != ''">
        and RECEIVING_UNIT_NO = #{receivingUnitNo}
      </if>
      <if test="receivingUnitName != null and receivingUnitName != ''">
        and RECEIVING_UNIT_NAME = #{receivingUnitName}
      </if>
      <if test="allowedTareWeight != null and allowedTareWeight != ''">
        and ALLOWED_TARE_WEIGHT = #{allowedTareWeight}
      </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="deleteManNo != null and deleteManNo != ''">
        and DELETE_MAN_NO = #{deleteManNo}
      </if>
      <if test="deleteManName != null and deleteManName != ''">
        and DELETE_MAN_NAME = #{deleteManName}
      </if>
      <if test="deleteTime != null">
        and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
      </if>
      <if test="vauleFlag != null and vauleFlag != ''">
        and VAULE_FLAG = #{vauleFlag}
      </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="carNo != null and carNo != ''">
        and CAR_NO = #{carNo}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="unitNo != null and unitNo != ''">
        and UNIT_NO LIKE '%${unitNo}%'
      </if>
      <if test="forwardingUnitNo != null and forwardingUnitNo != ''">
        and FORWARDING_UNIT_NO LIKE '%${forwardingUnitNo}%'
      </if>
      <if test="forwardingUnitName != null and forwardingUnitName != ''">
        and FORWARDING_UNIT_NAME LIKE '%${forwardingUnitName}%'
      </if>
      <if test="receivingUnitNo != null and receivingUnitNo != ''">
        and RECEIVING_UNIT_NO LIKE '%${receivingUnitNo}%'
      </if>
      <if test="receivingUnitName != null and receivingUnitName != ''">
        and RECEIVING_UNIT_NAME LIKE '%${receivingUnitName}%'
      </if>
      <if test="allowedTareWeight != null and allowedTareWeight != ''">
        and ALLOWED_TARE_WEIGHT LIKE '%${allowedTareWeight}%'
      </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="deleteManNo != null and deleteManNo != ''">
        and DELETE_MAN_NO LIKE '%${deleteManNo}%'
      </if>
      <if test="deleteManName != null and deleteManName != ''">
        and DELETE_MAN_NAME LIKE '%${deleteManName}%'
      </if>
      <if test="deleteTime != null">
        and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
      </if>
      <if test="vauleFlag != null and vauleFlag != ''">
        and VAULE_FLAG LIKE '%${vauleFlag}%'
      </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="carNo != null and carNo != ''">
        and CAR_NO LIKE '%${carNo}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from METER_BASE_UNIT_INFO
    where UNIT_NO = #{unitNo,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from METER_BASE_UNIT_INFO
    where 1!=1 
      <if test="forwardingUnitNo != null and forwardingUnitNo != ''">
        or FORWARDING_UNIT_NO = #{forwardingUnitNo}
      </if>
      <if test="forwardingUnitName != null and forwardingUnitName != ''">
        or FORWARDING_UNIT_NAME = #{forwardingUnitName}
      </if>
      <if test="receivingUnitNo != null and receivingUnitNo != ''">
        or RECEIVING_UNIT_NO = #{receivingUnitNo}
      </if>
      <if test="receivingUnitName != null and receivingUnitName != ''">
        or RECEIVING_UNIT_NAME = #{receivingUnitName}
      </if>
      <if test="allowedTareWeight != null and allowedTareWeight != ''">
        or ALLOWED_TARE_WEIGHT = #{allowedTareWeight}
      </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="deleteManNo != null and deleteManNo != ''">
        or DELETE_MAN_NO = #{deleteManNo}
      </if>
      <if test="deleteManName != null and deleteManName != ''">
        or DELETE_MAN_NAME = #{deleteManName}
      </if>
      <if test="deleteTime != null">
        or TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = '#{deleteTime}'
      </if>
      <if test="vauleFlag != null and vauleFlag != ''">
        or VAULE_FLAG = #{vauleFlag}
      </if>
      <if test="matterNo != null and matterNo != ''">
        or MATTER_NO = #{matterNo}
      </if>
      <if test="matterName != null and matterName != ''">
        or MATTER_NAME = #{matterName}
      </if>
      <if test="carNo != null and carNo != ''">
        or CAR_NO = #{carNo}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.baseinfo.meterbaseunitinfo.model.MeterBaseUnitInfo">
    insert into METER_BASE_UNIT_INFO (UNIT_NO, FORWARDING_UNIT_NO, FORWARDING_UNIT_NAME, 
      RECEIVING_UNIT_NO, RECEIVING_UNIT_NAME, ALLOWED_TARE_WEIGHT, 
      CREATE_MAN_NO, CREATE_MAN_NAME, CREATE_TIME, 
      UPDATE_MAN_NO, UPDATE_MAN_NAME, UPDATE_TIME, 
      DELETE_MAN_NO, DELETE_MAN_NAME, DELETE_TIME, 
      VAULE_FLAG, MATTER_NO, MATTER_NAME, 
      CAR_NO)
    values (#{unitNo,jdbcType=VARCHAR}, #{forwardingUnitNo,jdbcType=VARCHAR}, #{forwardingUnitName,jdbcType=VARCHAR}, 
      #{receivingUnitNo,jdbcType=VARCHAR}, #{receivingUnitName,jdbcType=VARCHAR}, #{allowedTareWeight,jdbcType=VARCHAR}, 
      #{createManNo,jdbcType=VARCHAR}, #{createManName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
      #{updateManNo,jdbcType=VARCHAR}, #{updateManName,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, 
      #{deleteManNo,jdbcType=VARCHAR}, #{deleteManName,jdbcType=VARCHAR}, #{deleteTime,jdbcType=TIMESTAMP}, 
      #{vauleFlag,jdbcType=VARCHAR}, #{matterNo,jdbcType=VARCHAR}, #{matterName,jdbcType=VARCHAR}, 
      #{carNo,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.baseinfo.meterbaseunitinfo.model.MeterBaseUnitInfo">
    insert into METER_BASE_UNIT_INFO
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="unitNo != null">
        UNIT_NO,
      </if>
      <if test="forwardingUnitNo != null">
        FORWARDING_UNIT_NO,
      </if>
      <if test="forwardingUnitName != null">
        FORWARDING_UNIT_NAME,
      </if>
      <if test="receivingUnitNo != null">
        RECEIVING_UNIT_NO,
      </if>
      <if test="receivingUnitName != null">
        RECEIVING_UNIT_NAME,
      </if>
      <if test="allowedTareWeight != null">
        ALLOWED_TARE_WEIGHT,
      </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="deleteManNo != null">
        DELETE_MAN_NO,
      </if>
      <if test="deleteManName != null">
        DELETE_MAN_NAME,
      </if>
      <if test="deleteTime != null">
        DELETE_TIME,
      </if>
      <if test="vauleFlag != null">
        VAULE_FLAG,
      </if>
      <if test="matterNo != null">
        MATTER_NO,
      </if>
      <if test="matterName != null">
        MATTER_NAME,
      </if>
      <if test="carNo != null">
        CAR_NO,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="unitNo != null">
        #{unitNo,jdbcType=VARCHAR},
      </if>
      <if test="forwardingUnitNo != null">
        #{forwardingUnitNo,jdbcType=VARCHAR},
      </if>
      <if test="forwardingUnitName != null">
        #{forwardingUnitName,jdbcType=VARCHAR},
      </if>
      <if test="receivingUnitNo != null">
        #{receivingUnitNo,jdbcType=VARCHAR},
      </if>
      <if test="receivingUnitName != null">
        #{receivingUnitName,jdbcType=VARCHAR},
      </if>
      <if test="allowedTareWeight != null">
        #{allowedTareWeight,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>
      <if test="deleteManNo != null">
        #{deleteManNo,jdbcType=VARCHAR},
      </if>
      <if test="deleteManName != null">
        #{deleteManName,jdbcType=VARCHAR},
      </if>
      <if test="deleteTime != null">
        #{deleteTime,jdbcType=TIMESTAMP},
      </if>
      <if test="vauleFlag != null">
        #{vauleFlag,jdbcType=VARCHAR},
      </if>
      <if test="matterNo != null">
        #{matterNo,jdbcType=VARCHAR},
      </if>
      <if test="matterName != null">
        #{matterName,jdbcType=VARCHAR},
      </if>
      <if test="carNo != null">
        #{carNo,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.baseinfo.meterbaseunitinfo.model.MeterBaseUnitInfo">
    update METER_BASE_UNIT_INFO
    set FORWARDING_UNIT_NO = #{forwardingUnitNo,jdbcType=VARCHAR},
      FORWARDING_UNIT_NAME = #{forwardingUnitName,jdbcType=VARCHAR},
      RECEIVING_UNIT_NO = #{receivingUnitNo,jdbcType=VARCHAR},
      RECEIVING_UNIT_NAME = #{receivingUnitName,jdbcType=VARCHAR},
      ALLOWED_TARE_WEIGHT = #{allowedTareWeight,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},
      DELETE_MAN_NO = #{deleteManNo,jdbcType=VARCHAR},
      DELETE_MAN_NAME = #{deleteManName,jdbcType=VARCHAR},
      DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
      VAULE_FLAG = #{vauleFlag,jdbcType=VARCHAR},
      MATTER_NO = #{matterNo,jdbcType=VARCHAR},
      MATTER_NAME = #{matterName,jdbcType=VARCHAR},
      CAR_NO = #{carNo,jdbcType=VARCHAR}
    where UNIT_NO = #{unitNo,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.baseinfo.meterbaseunitinfo.model.MeterBaseUnitInfo">
    update METER_BASE_UNIT_INFO
    <set>
      <if test="forwardingUnitNo != null">
        FORWARDING_UNIT_NO = #{forwardingUnitNo,jdbcType=VARCHAR},
      </if>
      <if test="forwardingUnitName != null">
        FORWARDING_UNIT_NAME = #{forwardingUnitName,jdbcType=VARCHAR},
      </if>
      <if test="receivingUnitNo != null">
        RECEIVING_UNIT_NO = #{receivingUnitNo,jdbcType=VARCHAR},
      </if>
      <if test="receivingUnitName != null">
        RECEIVING_UNIT_NAME = #{receivingUnitName,jdbcType=VARCHAR},
      </if>
      <if test="allowedTareWeight != null">
        ALLOWED_TARE_WEIGHT = #{allowedTareWeight,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>
      <if test="deleteManNo != null">
        DELETE_MAN_NO = #{deleteManNo,jdbcType=VARCHAR},
      </if>
      <if test="deleteManName != null">
        DELETE_MAN_NAME = #{deleteManName,jdbcType=VARCHAR},
      </if>
      <if test="deleteTime != null">
        DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
      </if>
      <if test="vauleFlag != null">
        VAULE_FLAG = #{vauleFlag,jdbcType=VARCHAR},
      </if>
      <if test="matterNo != null">
        MATTER_NO = #{matterNo,jdbcType=VARCHAR},
      </if>
      <if test="matterName != null">
        MATTER_NAME = #{matterName,jdbcType=VARCHAR},
      </if>
      <if test="carNo != null">
        CAR_NO = #{carNo,jdbcType=VARCHAR},
      </if>
    </set>
    where UNIT_NO = #{unitNo,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where UNIT_NO = #{unitNo,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_UNIT_INFO 
      (UNIT_NO, 
      FORWARDING_UNIT_NO, FORWARDING_UNIT_NAME, 
      RECEIVING_UNIT_NO, RECEIVING_UNIT_NAME, 
      ALLOWED_TARE_WEIGHT, CREATE_MAN_NO, 
      CREATE_MAN_NAME, CREATE_TIME, 
      UPDATE_MAN_NO, UPDATE_MAN_NAME, UPDATE_TIME, 
      DELETE_MAN_NO, DELETE_MAN_NAME, DELETE_TIME, 
      VAULE_FLAG, MATTER_NO, MATTER_NAME, 
      CAR_NO)
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.unitNo,jdbcType=VARCHAR}, 
      #{item.forwardingUnitNo,jdbcType=VARCHAR}, #{item.forwardingUnitName,jdbcType=VARCHAR}, 
      #{item.receivingUnitNo,jdbcType=VARCHAR}, #{item.receivingUnitName,jdbcType=VARCHAR}, 
      #{item.allowedTareWeight,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}, 
      #{item.deleteManNo,jdbcType=VARCHAR}, #{item.deleteManName,jdbcType=VARCHAR}, #{item.deleteTime,jdbcType=TIMESTAMP}, 
      #{item.vauleFlag,jdbcType=VARCHAR}, #{item.matterNo,jdbcType=VARCHAR}, #{item.matterName,jdbcType=VARCHAR}, 
      #{item.carNo,jdbcType=VARCHAR} from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update METER_BASE_UNIT_INFO
     set
       UNIT_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.unitNo,jdbcType=VARCHAR}
       </foreach>
       ,FORWARDING_UNIT_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.forwardingUnitNo,jdbcType=VARCHAR}
       </foreach>
       ,FORWARDING_UNIT_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.forwardingUnitName,jdbcType=VARCHAR}
       </foreach>
       ,RECEIVING_UNIT_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.receivingUnitNo,jdbcType=VARCHAR}
       </foreach>
       ,RECEIVING_UNIT_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.receivingUnitName,jdbcType=VARCHAR}
       </foreach>
       ,ALLOWED_TARE_WEIGHT=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.allowedTareWeight,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_MAN_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.createManNo,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_MAN_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.createManName,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.createTime,jdbcType=TIMESTAMP}
       </foreach>
       ,UPDATE_MAN_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.updateManNo,jdbcType=VARCHAR}
       </foreach>
       ,UPDATE_MAN_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.updateManName,jdbcType=VARCHAR}
       </foreach>
       ,UPDATE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.updateTime,jdbcType=TIMESTAMP}
       </foreach>
       ,DELETE_MAN_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.deleteManNo,jdbcType=VARCHAR}
       </foreach>
       ,DELETE_MAN_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.deleteManName,jdbcType=VARCHAR}
       </foreach>
       ,DELETE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.deleteTime,jdbcType=TIMESTAMP}
       </foreach>
       ,VAULE_FLAG=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.vauleFlag,jdbcType=VARCHAR}
       </foreach>
       ,MATTER_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.matterNo,jdbcType=VARCHAR}
       </foreach>
       ,MATTER_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.matterName,jdbcType=VARCHAR}
       </foreach>
       ,CAR_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case UNIT_NO" close="end">
          when #{item.unitNo,jdbcType=VARCHAR} then #{item.carNo,jdbcType=VARCHAR}
       </foreach>
     where UNIT_NO in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.unitNo,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from METER_BASE_UNIT_INFO
    where UNIT_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(unit_no,9))),0) + 1,4,'0') unit_no
    FROM meter_base_unit_info where instr(unit_no,#{afl,jdbcType=VARCHAR})>0
  </select>

  <select id="queryBynoPage" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="whereLike"/>
    order by create_time desc
  </select>

  <select id="getUnitInfo" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    select * from METER_BASE_UNIT_INFO where (CAR_NO = #{carNo,jdbcType=VARCHAR} or CAR_NO is NULL)
    and ((FORWARDING_UNIT_NO  = #{forwardingUnitNo,jdbcType=VARCHAR} and RECEIVING_UNIT_NO = #{receivingUnitNo,jdbcType=VARCHAR}) or (FORWARDING_UNIT_NO is NULL and RECEIVING_UNIT_NO is NULL))
    and (MATTER_NO = #{matterNo,jdbcType=VARCHAR} or MATTER_NO is NULL)
  </select>
</mapper>