<?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.meterbasematterinfodirect.mapper.MeterBaseMatterInfoDirectMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.baseinfo.meterbasematterinfodirect.model.MeterBaseMatterInfoDirect">
    <id column="MATTER_NO" jdbcType="VARCHAR" property="matterNo" />
    <result column="MATTER_NAME" jdbcType="VARCHAR" property="matterName" />
    <result column="INDEX_CODE" jdbcType="VARCHAR" property="indexCode" />
    <result column="MNEMONIC_CODE" jdbcType="VARCHAR" property="mnemonicCode" />
    <result column="MATTER_NATURE_NO" jdbcType="VARCHAR" property="matterNatureNo" />
    <result column="MATTER_NATURE_NAME" jdbcType="VARCHAR" property="matterNatureName" />
    <result column="METER_NATURE_NO" jdbcType="VARCHAR" property="meterNatureNo" />
    <result column="METER_NATURE_NAME" jdbcType="VARCHAR" property="meterNatureName" />
    <result column="VALID_FLAG" jdbcType="VARCHAR" property="validFlag" />
    <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="METER_CODE" jdbcType="VARCHAR" property="meterCode" />
    <result column="ALLOWED_TARE_WEIGHT" jdbcType="VARCHAR" property="allowedTareWeight" />
    <result column="ALLOWED_ADD_WEIGHT" jdbcType="VARCHAR" property="allowedAddWeight" />
    <result column="SCALE_VALID_PERIOD" jdbcType="VARCHAR" property="scaleValidPeriod" />
    <result column="SPEC_NAME" jdbcType="VARCHAR" property="specName" />
    <result column="MEMO" jdbcType="VARCHAR" property="memo" />
    <result column="REPORT_CODE" jdbcType="VARCHAR" property="reportCode" />
    <result column="SETTLEMENT_UNIT" jdbcType="VARCHAR" property="settlementUnit" />
    <result column="SETTLEMENT_PRICE" jdbcType="DECIMAL" property="settlementPrice" />
    <result column="BELT_TYPE_CODE" jdbcType="VARCHAR" property="beltTypeCode" />
    <result column="BELT_TYPE_NAME" jdbcType="VARCHAR" property="beltTypeName" />
    <result column="IS_SECOND_RESOURCES" jdbcType="VARCHAR" property="isSecondResources" />
    <result column="IS_LIANDA" jdbcType="VARCHAR" property="isLianda" />
  </resultMap>
  <sql id="columns">
    MATTER_NO, MATTER_NAME, INDEX_CODE, MNEMONIC_CODE, MATTER_NATURE_NO, MATTER_NATURE_NAME, 
    METER_NATURE_NO, METER_NATURE_NAME, VALID_FLAG, CREATE_MAN_NO, CREATE_MAN_NAME, CREATE_TIME, 
    UPDATE_MAN_NO, UPDATE_MAN_NAME, UPDATE_TIME, DELETE_MAN_NO, DELETE_MAN_NAME, DELETE_TIME, 
    METER_CODE, ALLOWED_TARE_WEIGHT, ALLOWED_ADD_WEIGHT, SCALE_VALID_PERIOD, SPEC_NAME, 
    MEMO, REPORT_CODE, SETTLEMENT_UNIT, SETTLEMENT_PRICE, BELT_TYPE_CODE, BELT_TYPE_NAME, 
    IS_SECOND_RESOURCES, IS_LIANDA
  </sql>
  <sql id="columns_alias">
    t.MATTER_NO, t.MATTER_NAME, t.INDEX_CODE, t.MNEMONIC_CODE, t.MATTER_NATURE_NO, t.MATTER_NATURE_NAME, 
    t.METER_NATURE_NO, t.METER_NATURE_NAME, t.VALID_FLAG, 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.METER_CODE, t.ALLOWED_TARE_WEIGHT, t.ALLOWED_ADD_WEIGHT, 
    t.SCALE_VALID_PERIOD, t.SPEC_NAME, t.MEMO, t.REPORT_CODE, t.SETTLEMENT_UNIT, t.SETTLEMENT_PRICE, 
    t.BELT_TYPE_CODE, t.BELT_TYPE_NAME, t.IS_SECOND_RESOURCES, t.IS_LIANDA
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM METER_BASE_MATTER_INFO_DIRECT
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM METER_BASE_MATTER_INFO_DIRECT t
  </sql>
  <sql id="where">
    <where> 
      <if test="matterNo != null and matterNo != ''">
        and MATTER_NO = #{matterNo}
      </if>
      <if test="matterName != null and matterName != ''">
        and MATTER_NAME = #{matterName}
      </if>
      <if test="indexCode != null and indexCode != ''">
        and INDEX_CODE = #{indexCode}
      </if>
      <if test="mnemonicCode != null and mnemonicCode != ''">
        and MNEMONIC_CODE = #{mnemonicCode}
      </if>
      <if test="matterNatureNo != null and matterNatureNo != ''">
        and MATTER_NATURE_NO = #{matterNatureNo}
      </if>
      <if test="matterNatureName != null and matterNatureName != ''">
        and MATTER_NATURE_NAME = #{matterNatureName}
      </if>
      <if test="meterNatureNo != null and meterNatureNo != ''">
        and METER_NATURE_NO = #{meterNatureNo}
      </if>
      <if test="meterNatureName != null and meterNatureName != ''">
        and METER_NATURE_NAME = #{meterNatureName}
      </if>
      <if test="validFlag != null and validFlag != ''">
        and VALID_FLAG = #{validFlag}
      </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="meterCode != null and meterCode != ''">
        and METER_CODE = #{meterCode}
      </if>
      <if test="allowedTareWeight != null and allowedTareWeight != ''">
        and ALLOWED_TARE_WEIGHT = #{allowedTareWeight}
      </if>
      <if test="allowedAddWeight != null and allowedAddWeight != ''">
        and ALLOWED_ADD_WEIGHT = #{allowedAddWeight}
      </if>
      <if test="scaleValidPeriod != null and scaleValidPeriod != ''">
        and SCALE_VALID_PERIOD = #{scaleValidPeriod}
      </if>
      <if test="specName != null and specName != ''">
        and SPEC_NAME = #{specName}
      </if>
      <if test="memo != null and memo != ''">
        and MEMO = #{memo}
      </if>
      <if test="reportCode != null and reportCode != ''">
        and REPORT_CODE = #{reportCode}
      </if>
      <if test="settlementUnit != null and settlementUnit != ''">
        and SETTLEMENT_UNIT = #{settlementUnit}
      </if>
      <if test="settlementPrice != null">
        and SETTLEMENT_PRICE = #{settlementPrice}
      </if>
      <if test="beltTypeCode != null and beltTypeCode != ''">
        and BELT_TYPE_CODE = #{beltTypeCode}
      </if>
      <if test="beltTypeName != null and beltTypeName != ''">
        and BELT_TYPE_NAME = #{beltTypeName}
      </if>
      <if test="isSecondResources != null and isSecondResources != ''">
        and IS_SECOND_RESOURCES = #{isSecondResources}
      </if>
      <if test="isLianda != null and isLianda != ''">
        and IS_LIANDA = #{isLianda}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <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="indexCode != null and indexCode != ''">
        and INDEX_CODE LIKE '%${indexCode}%'
      </if>
      <if test="mnemonicCode != null and mnemonicCode != ''">
        and MNEMONIC_CODE LIKE '%${mnemonicCode}%'
      </if>
      <if test="matterNatureNo != null and matterNatureNo != ''">
        and MATTER_NATURE_NO LIKE '%${matterNatureNo}%'
      </if>
      <if test="matterNatureName != null and matterNatureName != ''">
        and MATTER_NATURE_NAME LIKE '%${matterNatureName}%'
      </if>
      <if test="meterNatureNo != null and meterNatureNo != ''">
        and METER_NATURE_NO LIKE '%${meterNatureNo}%'
      </if>
      <if test="meterNatureName != null and meterNatureName != ''">
        and METER_NATURE_NAME LIKE '%${meterNatureName}%'
      </if>
      <if test="validFlag != null and validFlag != ''">
        and VALID_FLAG LIKE '%${validFlag}%'
      </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="meterCode != null and meterCode != ''">
        and METER_CODE LIKE '%${meterCode}%'
      </if>
      <if test="allowedTareWeight != null and allowedTareWeight != ''">
        and ALLOWED_TARE_WEIGHT LIKE '%${allowedTareWeight}%'
      </if>
      <if test="allowedAddWeight != null and allowedAddWeight != ''">
        and ALLOWED_ADD_WEIGHT LIKE '%${allowedAddWeight}%'
      </if>
      <if test="scaleValidPeriod != null and scaleValidPeriod != ''">
        and SCALE_VALID_PERIOD LIKE '%${scaleValidPeriod}%'
      </if>
      <if test="specName != null and specName != ''">
        and SPEC_NAME LIKE '%${specName}%'
      </if>
      <if test="memo != null and memo != ''">
        and MEMO LIKE '%${memo}%'
      </if>
      <if test="reportCode != null and reportCode != ''">
        and REPORT_CODE LIKE '%${reportCode}%'
      </if>
      <if test="settlementUnit != null and settlementUnit != ''">
        and SETTLEMENT_UNIT LIKE '%${settlementUnit}%'
      </if>
      <if test="settlementPrice != null">
        and SETTLEMENT_PRICE = #{settlementPrice}
      </if>
      <if test="beltTypeCode != null and beltTypeCode != ''">
        and BELT_TYPE_CODE LIKE '%${beltTypeCode}%'
      </if>
      <if test="beltTypeName != null and beltTypeName != ''">
        and BELT_TYPE_NAME LIKE '%${beltTypeName}%'
      </if>
      <if test="isSecondResources != null and isSecondResources != ''">
        and IS_SECOND_RESOURCES LIKE '%${isSecondResources}%'
      </if>
      <if test="isLianda != null and isLianda != ''">
        and IS_LIANDA LIKE '%${isLianda}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from METER_BASE_MATTER_INFO_DIRECT
    where MATTER_NO = #{matterNo,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from METER_BASE_MATTER_INFO_DIRECT
    where 1!=1 
      <if test="matterName != null and matterName != ''">
        or MATTER_NAME = #{matterName}
      </if>
      <if test="indexCode != null and indexCode != ''">
        or INDEX_CODE = #{indexCode}
      </if>
      <if test="mnemonicCode != null and mnemonicCode != ''">
        or MNEMONIC_CODE = #{mnemonicCode}
      </if>
      <if test="matterNatureNo != null and matterNatureNo != ''">
        or MATTER_NATURE_NO = #{matterNatureNo}
      </if>
      <if test="matterNatureName != null and matterNatureName != ''">
        or MATTER_NATURE_NAME = #{matterNatureName}
      </if>
      <if test="meterNatureNo != null and meterNatureNo != ''">
        or METER_NATURE_NO = #{meterNatureNo}
      </if>
      <if test="meterNatureName != null and meterNatureName != ''">
        or METER_NATURE_NAME = #{meterNatureName}
      </if>
      <if test="validFlag != null and validFlag != ''">
        or VALID_FLAG = #{validFlag}
      </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="meterCode != null and meterCode != ''">
        or METER_CODE = #{meterCode}
      </if>
      <if test="allowedTareWeight != null and allowedTareWeight != ''">
        or ALLOWED_TARE_WEIGHT = #{allowedTareWeight}
      </if>
      <if test="allowedAddWeight != null and allowedAddWeight != ''">
        or ALLOWED_ADD_WEIGHT = #{allowedAddWeight}
      </if>
      <if test="scaleValidPeriod != null and scaleValidPeriod != ''">
        or SCALE_VALID_PERIOD = #{scaleValidPeriod}
      </if>
      <if test="specName != null and specName != ''">
        or SPEC_NAME = #{specName}
      </if>
      <if test="memo != null and memo != ''">
        or MEMO = #{memo}
      </if>
      <if test="reportCode != null and reportCode != ''">
        or REPORT_CODE = #{reportCode}
      </if>
      <if test="settlementUnit != null and settlementUnit != ''">
        or SETTLEMENT_UNIT = #{settlementUnit}
      </if>
      <if test="settlementPrice != null">
        or SETTLEMENT_PRICE = #{settlementPrice}
      </if>
      <if test="beltTypeCode != null and beltTypeCode != ''">
        or BELT_TYPE_CODE = #{beltTypeCode}
      </if>
      <if test="beltTypeName != null and beltTypeName != ''">
        or BELT_TYPE_NAME = #{beltTypeName}
      </if>
      <if test="isSecondResources != null and isSecondResources != ''">
        or IS_SECOND_RESOURCES = #{isSecondResources}
      </if>
      <if test="isLianda != null and isLianda != ''">
        or IS_LIANDA = #{isLianda}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.baseinfo.meterbasematterinfodirect.model.MeterBaseMatterInfoDirect">
    insert into METER_BASE_MATTER_INFO_DIRECT (MATTER_NO, MATTER_NAME, INDEX_CODE, 
      MNEMONIC_CODE, MATTER_NATURE_NO, MATTER_NATURE_NAME, 
      METER_NATURE_NO, METER_NATURE_NAME, VALID_FLAG, 
      CREATE_MAN_NO, CREATE_MAN_NAME, CREATE_TIME, 
      UPDATE_MAN_NO, UPDATE_MAN_NAME, UPDATE_TIME, 
      DELETE_MAN_NO, DELETE_MAN_NAME, DELETE_TIME, 
      METER_CODE, ALLOWED_TARE_WEIGHT, ALLOWED_ADD_WEIGHT, 
      SCALE_VALID_PERIOD, SPEC_NAME, MEMO, 
      REPORT_CODE, SETTLEMENT_UNIT, SETTLEMENT_PRICE, 
      BELT_TYPE_CODE, BELT_TYPE_NAME, IS_SECOND_RESOURCES, 
      IS_LIANDA)
    values (#{matterNo,jdbcType=VARCHAR}, #{matterName,jdbcType=VARCHAR}, #{indexCode,jdbcType=VARCHAR}, 
      #{mnemonicCode,jdbcType=VARCHAR}, #{matterNatureNo,jdbcType=VARCHAR}, #{matterNatureName,jdbcType=VARCHAR}, 
      #{meterNatureNo,jdbcType=VARCHAR}, #{meterNatureName,jdbcType=VARCHAR}, #{validFlag,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}, 
      #{meterCode,jdbcType=VARCHAR}, #{allowedTareWeight,jdbcType=VARCHAR}, #{allowedAddWeight,jdbcType=VARCHAR}, 
      #{scaleValidPeriod,jdbcType=VARCHAR}, #{specName,jdbcType=VARCHAR}, #{memo,jdbcType=VARCHAR}, 
      #{reportCode,jdbcType=VARCHAR}, #{settlementUnit,jdbcType=VARCHAR}, #{settlementPrice,jdbcType=DECIMAL}, 
      #{beltTypeCode,jdbcType=VARCHAR}, #{beltTypeName,jdbcType=VARCHAR}, #{isSecondResources,jdbcType=VARCHAR}, 
      #{isLianda,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.baseinfo.meterbasematterinfodirect.model.MeterBaseMatterInfoDirect">
    insert into METER_BASE_MATTER_INFO_DIRECT
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="matterNo != null">
        MATTER_NO,
      </if>
      <if test="matterName != null">
        MATTER_NAME,
      </if>
      <if test="indexCode != null">
        INDEX_CODE,
      </if>
      <if test="mnemonicCode != null">
        MNEMONIC_CODE,
      </if>
      <if test="matterNatureNo != null">
        MATTER_NATURE_NO,
      </if>
      <if test="matterNatureName != null">
        MATTER_NATURE_NAME,
      </if>
      <if test="meterNatureNo != null">
        METER_NATURE_NO,
      </if>
      <if test="meterNatureName != null">
        METER_NATURE_NAME,
      </if>
      <if test="validFlag != null">
        VALID_FLAG,
      </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="meterCode != null">
        METER_CODE,
      </if>
      <if test="allowedTareWeight != null">
        ALLOWED_TARE_WEIGHT,
      </if>
      <if test="allowedAddWeight != null">
        ALLOWED_ADD_WEIGHT,
      </if>
      <if test="scaleValidPeriod != null">
        SCALE_VALID_PERIOD,
      </if>
      <if test="specName != null">
        SPEC_NAME,
      </if>
      <if test="memo != null">
        MEMO,
      </if>
      <if test="reportCode != null">
        REPORT_CODE,
      </if>
      <if test="settlementUnit != null">
        SETTLEMENT_UNIT,
      </if>
      <if test="settlementPrice != null">
        SETTLEMENT_PRICE,
      </if>
      <if test="beltTypeCode != null">
        BELT_TYPE_CODE,
      </if>
      <if test="beltTypeName != null">
        BELT_TYPE_NAME,
      </if>
      <if test="isSecondResources != null">
        IS_SECOND_RESOURCES,
      </if>
      <if test="isLianda != null">
        IS_LIANDA,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="matterNo != null">
        #{matterNo,jdbcType=VARCHAR},
      </if>
      <if test="matterName != null">
        #{matterName,jdbcType=VARCHAR},
      </if>
      <if test="indexCode != null">
        #{indexCode,jdbcType=VARCHAR},
      </if>
      <if test="mnemonicCode != null">
        #{mnemonicCode,jdbcType=VARCHAR},
      </if>
      <if test="matterNatureNo != null">
        #{matterNatureNo,jdbcType=VARCHAR},
      </if>
      <if test="matterNatureName != null">
        #{matterNatureName,jdbcType=VARCHAR},
      </if>
      <if test="meterNatureNo != null">
        #{meterNatureNo,jdbcType=VARCHAR},
      </if>
      <if test="meterNatureName != null">
        #{meterNatureName,jdbcType=VARCHAR},
      </if>
      <if test="validFlag != null">
        #{validFlag,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="meterCode != null">
        #{meterCode,jdbcType=VARCHAR},
      </if>
      <if test="allowedTareWeight != null">
        #{allowedTareWeight,jdbcType=VARCHAR},
      </if>
      <if test="allowedAddWeight != null">
        #{allowedAddWeight,jdbcType=VARCHAR},
      </if>
      <if test="scaleValidPeriod != null">
        #{scaleValidPeriod,jdbcType=VARCHAR},
      </if>
      <if test="specName != null">
        #{specName,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        #{memo,jdbcType=VARCHAR},
      </if>
      <if test="reportCode != null">
        #{reportCode,jdbcType=VARCHAR},
      </if>
      <if test="settlementUnit != null">
        #{settlementUnit,jdbcType=VARCHAR},
      </if>
      <if test="settlementPrice != null">
        #{settlementPrice,jdbcType=DECIMAL},
      </if>
      <if test="beltTypeCode != null">
        #{beltTypeCode,jdbcType=VARCHAR},
      </if>
      <if test="beltTypeName != null">
        #{beltTypeName,jdbcType=VARCHAR},
      </if>
      <if test="isSecondResources != null">
        #{isSecondResources,jdbcType=VARCHAR},
      </if>
      <if test="isLianda != null">
        #{isLianda,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.baseinfo.meterbasematterinfodirect.model.MeterBaseMatterInfoDirect">
    update METER_BASE_MATTER_INFO_DIRECT
    set MATTER_NAME = #{matterName,jdbcType=VARCHAR},
      INDEX_CODE = #{indexCode,jdbcType=VARCHAR},
      MNEMONIC_CODE = #{mnemonicCode,jdbcType=VARCHAR},
      MATTER_NATURE_NO = #{matterNatureNo,jdbcType=VARCHAR},
      MATTER_NATURE_NAME = #{matterNatureName,jdbcType=VARCHAR},
      METER_NATURE_NO = #{meterNatureNo,jdbcType=VARCHAR},
      METER_NATURE_NAME = #{meterNatureName,jdbcType=VARCHAR},
      VALID_FLAG = #{validFlag,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},
      METER_CODE = #{meterCode,jdbcType=VARCHAR},
      ALLOWED_TARE_WEIGHT = #{allowedTareWeight,jdbcType=VARCHAR},
      ALLOWED_ADD_WEIGHT = #{allowedAddWeight,jdbcType=VARCHAR},
      SCALE_VALID_PERIOD = #{scaleValidPeriod,jdbcType=VARCHAR},
      SPEC_NAME = #{specName,jdbcType=VARCHAR},
      MEMO = #{memo,jdbcType=VARCHAR},
      REPORT_CODE = #{reportCode,jdbcType=VARCHAR},
      SETTLEMENT_UNIT = #{settlementUnit,jdbcType=VARCHAR},
      SETTLEMENT_PRICE = #{settlementPrice,jdbcType=DECIMAL},
      BELT_TYPE_CODE = #{beltTypeCode,jdbcType=VARCHAR},
      BELT_TYPE_NAME = #{beltTypeName,jdbcType=VARCHAR},
      IS_SECOND_RESOURCES = #{isSecondResources,jdbcType=VARCHAR},
      IS_LIANDA = #{isLianda,jdbcType=VARCHAR}
    where MATTER_NO = #{matterNo,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.baseinfo.meterbasematterinfodirect.model.MeterBaseMatterInfoDirect">
    update METER_BASE_MATTER_INFO_DIRECT
    <set>
      <if test="matterName != null">
        MATTER_NAME = #{matterName,jdbcType=VARCHAR},
      </if>
      <if test="indexCode != null">
        INDEX_CODE = #{indexCode,jdbcType=VARCHAR},
      </if>
      <if test="mnemonicCode != null">
        MNEMONIC_CODE = #{mnemonicCode,jdbcType=VARCHAR},
      </if>
      <if test="matterNatureNo != null">
        MATTER_NATURE_NO = #{matterNatureNo,jdbcType=VARCHAR},
      </if>
      <if test="matterNatureName != null">
        MATTER_NATURE_NAME = #{matterNatureName,jdbcType=VARCHAR},
      </if>
      <if test="meterNatureNo != null">
        METER_NATURE_NO = #{meterNatureNo,jdbcType=VARCHAR},
      </if>
      <if test="meterNatureName != null">
        METER_NATURE_NAME = #{meterNatureName,jdbcType=VARCHAR},
      </if>
      <if test="validFlag != null">
        VALID_FLAG = #{validFlag,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="meterCode != null">
        METER_CODE = #{meterCode,jdbcType=VARCHAR},
      </if>
      <if test="allowedTareWeight != null">
        ALLOWED_TARE_WEIGHT = #{allowedTareWeight,jdbcType=VARCHAR},
      </if>
      <if test="allowedAddWeight != null">
        ALLOWED_ADD_WEIGHT = #{allowedAddWeight,jdbcType=VARCHAR},
      </if>
      <if test="scaleValidPeriod != null">
        SCALE_VALID_PERIOD = #{scaleValidPeriod,jdbcType=VARCHAR},
      </if>
      <if test="specName != null">
        SPEC_NAME = #{specName,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        MEMO = #{memo,jdbcType=VARCHAR},
      </if>
      <if test="reportCode != null">
        REPORT_CODE = #{reportCode,jdbcType=VARCHAR},
      </if>
      <if test="settlementUnit != null">
        SETTLEMENT_UNIT = #{settlementUnit,jdbcType=VARCHAR},
      </if>
      <if test="settlementPrice != null">
        SETTLEMENT_PRICE = #{settlementPrice,jdbcType=DECIMAL},
      </if>
      <if test="beltTypeCode != null">
        BELT_TYPE_CODE = #{beltTypeCode,jdbcType=VARCHAR},
      </if>
      <if test="beltTypeName != null">
        BELT_TYPE_NAME = #{beltTypeName,jdbcType=VARCHAR},
      </if>
      <if test="isSecondResources != null">
        IS_SECOND_RESOURCES = #{isSecondResources,jdbcType=VARCHAR},
      </if>
      <if test="isLianda != null">
        IS_LIANDA = #{isLianda,jdbcType=VARCHAR},
      </if>
    </set>
    where MATTER_NO = #{matterNo,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where MATTER_NO = #{matterNo,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_INFO_DIRECT 
      (MATTER_NO, 
      MATTER_NAME, INDEX_CODE, MNEMONIC_CODE, 
      MATTER_NATURE_NO, MATTER_NATURE_NAME, 
      METER_NATURE_NO, METER_NATURE_NAME, 
      VALID_FLAG, CREATE_MAN_NO, CREATE_MAN_NAME, 
      CREATE_TIME, UPDATE_MAN_NO, UPDATE_MAN_NAME, 
      UPDATE_TIME, DELETE_MAN_NO, DELETE_MAN_NAME, 
      DELETE_TIME, METER_CODE, ALLOWED_TARE_WEIGHT, 
      ALLOWED_ADD_WEIGHT, SCALE_VALID_PERIOD, 
      SPEC_NAME, MEMO, REPORT_CODE, 
      SETTLEMENT_UNIT, SETTLEMENT_PRICE, 
      BELT_TYPE_CODE, BELT_TYPE_NAME, IS_SECOND_RESOURCES, 
      IS_LIANDA)
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.matterNo,jdbcType=VARCHAR}, 
      #{item.matterName,jdbcType=VARCHAR}, #{item.indexCode,jdbcType=VARCHAR}, #{item.mnemonicCode,jdbcType=VARCHAR}, 
      #{item.matterNatureNo,jdbcType=VARCHAR}, #{item.matterNatureName,jdbcType=VARCHAR}, 
      #{item.meterNatureNo,jdbcType=VARCHAR}, #{item.meterNatureName,jdbcType=VARCHAR}, 
      #{item.validFlag,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.meterCode,jdbcType=VARCHAR}, #{item.allowedTareWeight,jdbcType=VARCHAR}, 
      #{item.allowedAddWeight,jdbcType=VARCHAR}, #{item.scaleValidPeriod,jdbcType=VARCHAR}, 
      #{item.specName,jdbcType=VARCHAR}, #{item.memo,jdbcType=VARCHAR}, #{item.reportCode,jdbcType=VARCHAR}, 
      #{item.settlementUnit,jdbcType=VARCHAR}, #{item.settlementPrice,jdbcType=DECIMAL}, 
      #{item.beltTypeCode,jdbcType=VARCHAR}, #{item.beltTypeName,jdbcType=VARCHAR}, #{item.isSecondResources,jdbcType=VARCHAR}, 
      #{item.isLianda,jdbcType=VARCHAR} from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update METER_BASE_MATTER_INFO_DIRECT
     set
       MATTER_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.matterNo,jdbcType=VARCHAR}
       </foreach>
       ,MATTER_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.matterName,jdbcType=VARCHAR}
       </foreach>
       ,INDEX_CODE=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.indexCode,jdbcType=VARCHAR}
       </foreach>
       ,MNEMONIC_CODE=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.mnemonicCode,jdbcType=VARCHAR}
       </foreach>
       ,MATTER_NATURE_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.matterNatureNo,jdbcType=VARCHAR}
       </foreach>
       ,MATTER_NATURE_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.matterNatureName,jdbcType=VARCHAR}
       </foreach>
       ,METER_NATURE_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.meterNatureNo,jdbcType=VARCHAR}
       </foreach>
       ,METER_NATURE_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.meterNatureName,jdbcType=VARCHAR}
       </foreach>
       ,VALID_FLAG=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.validFlag,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_MAN_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.createManNo,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_MAN_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.createManName,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.createTime,jdbcType=TIMESTAMP}
       </foreach>
       ,UPDATE_MAN_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.updateManNo,jdbcType=VARCHAR}
       </foreach>
       ,UPDATE_MAN_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.updateManName,jdbcType=VARCHAR}
       </foreach>
       ,UPDATE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.updateTime,jdbcType=TIMESTAMP}
       </foreach>
       ,DELETE_MAN_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.deleteManNo,jdbcType=VARCHAR}
       </foreach>
       ,DELETE_MAN_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.deleteManName,jdbcType=VARCHAR}
       </foreach>
       ,DELETE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.deleteTime,jdbcType=TIMESTAMP}
       </foreach>
       ,METER_CODE=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.meterCode,jdbcType=VARCHAR}
       </foreach>
       ,ALLOWED_TARE_WEIGHT=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.allowedTareWeight,jdbcType=VARCHAR}
       </foreach>
       ,ALLOWED_ADD_WEIGHT=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.allowedAddWeight,jdbcType=VARCHAR}
       </foreach>
       ,SCALE_VALID_PERIOD=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.scaleValidPeriod,jdbcType=VARCHAR}
       </foreach>
       ,SPEC_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.specName,jdbcType=VARCHAR}
       </foreach>
       ,MEMO=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.memo,jdbcType=VARCHAR}
       </foreach>
       ,REPORT_CODE=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.reportCode,jdbcType=VARCHAR}
       </foreach>
       ,SETTLEMENT_UNIT=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.settlementUnit,jdbcType=VARCHAR}
       </foreach>
       ,SETTLEMENT_PRICE=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.settlementPrice,jdbcType=DECIMAL}
       </foreach>
       ,BELT_TYPE_CODE=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.beltTypeCode,jdbcType=VARCHAR}
       </foreach>
       ,BELT_TYPE_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.beltTypeName,jdbcType=VARCHAR}
       </foreach>
       ,IS_SECOND_RESOURCES=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.isSecondResources,jdbcType=VARCHAR}
       </foreach>
       ,IS_LIANDA=
       <foreach collection="list" item="item" index="index" separator=" " open="case MATTER_NO" close="end">
          when #{item.matterNo,jdbcType=VARCHAR} then #{item.isLianda,jdbcType=VARCHAR}
       </foreach>
     where MATTER_NO in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.matterNo,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from METER_BASE_MATTER_INFO_DIRECT
    where MATTER_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(MATTER_NO, LENGTH(MATTER_NO) - 4))),0) + 1,5,'0') MATTER_NO
    FROM METER_BASE_MATTER_INFO_DIRECT
  </select>

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