<?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.meterbasedriver.mapper.MeterBaseDriverMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.baseinfo.meterbasedriver.model.MeterBaseDriver">
    <id column="DRIVER_NO" jdbcType="VARCHAR" property="driverNo" />
    <result column="DRIVER_NAME" jdbcType="VARCHAR" property="driverName" />
    <result column="ID_NUM" jdbcType="VARCHAR" property="idNum" />
    <result column="TEL_NUM" jdbcType="VARCHAR" property="telNum" />
    <result column="MEMO" jdbcType="VARCHAR" property="memo" />
    <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="CAR_ID" jdbcType="VARCHAR" property="carId" />
  </resultMap>
  <sql id="columns">
    DRIVER_NO, DRIVER_NAME, ID_NUM, TEL_NUM, MEMO, 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, CAR_ID
  </sql>
  <sql id="columns_alias">
    t.DRIVER_NO, t.DRIVER_NAME, t.ID_NUM, t.TEL_NUM, t.MEMO, 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.CAR_ID
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM METER_BASE_DRIVER
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM METER_BASE_DRIVER t
  </sql>
  <sql id="where">
    <where> 
      <if test="driverNo != null and driverNo != ''">
        and DRIVER_NO = #{driverNo}
      </if>
      <if test="driverName != null and driverName != ''">
        and DRIVER_NAME = #{driverName}
      </if>
      <if test="idNum != null and idNum != ''">
        and ID_NUM = #{idNum}
      </if>
      <if test="telNum != null and telNum != ''">
        and TEL_NUM = #{telNum}
      </if>
      <if test="memo != null and memo != ''">
        and MEMO = #{memo}
      </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="carId != null and carId != ''">
        and CAR_ID = #{carId}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="driverNo != null and driverNo != ''">
        and DRIVER_NO LIKE '%${driverNo}%'
      </if>
      <if test="driverName != null and driverName != ''">
        and DRIVER_NAME LIKE '%${driverName}%'
      </if>
      <if test="idNum != null and idNum != ''">
        and ID_NUM LIKE '%${idNum}%'
      </if>
      <if test="telNum != null and telNum != ''">
        and TEL_NUM LIKE '%${telNum}%'
      </if>
      <if test="memo != null and memo != ''">
        and MEMO LIKE '%${memo}%'
      </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="carId != null and carId != ''">
        and CAR_ID LIKE '%${carId}%'
      </if>
      <if test="startTime != null and endTime != null and startTime != '' and endTime != ''">
        and  CREATE_TIME  >= TO_DATE(#{startTime}, 'yyyy-MM-dd HH24:mi:ss') and CREATE_TIME  &lt;=  TO_DATE(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from METER_BASE_DRIVER
    where DRIVER_NO = #{driverNo,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from METER_BASE_DRIVER
    where 1!=1 
      <if test="driverName != null and driverName != ''">
        or DRIVER_NAME = #{driverName}
      </if>
      <if test="idNum != null and idNum != ''">
        or ID_NUM = #{idNum}
      </if>
      <if test="telNum != null and telNum != ''">
        or TEL_NUM = #{telNum}
      </if>
      <if test="memo != null and memo != ''">
        or MEMO = #{memo}
      </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="carId != null and carId != ''">
        or CAR_ID = #{carId}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.baseinfo.meterbasedriver.model.MeterBaseDriver">
    insert into METER_BASE_DRIVER (DRIVER_NO, DRIVER_NAME, ID_NUM, 
      TEL_NUM, MEMO, 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, 
      CAR_ID)
    values (#{driverNo,jdbcType=VARCHAR}, #{driverName,jdbcType=VARCHAR}, #{idNum,jdbcType=VARCHAR}, 
      #{telNum,jdbcType=VARCHAR}, #{memo,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}, 
      #{carId,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.baseinfo.meterbasedriver.model.MeterBaseDriver">
    insert into METER_BASE_DRIVER
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="driverNo != null">
        DRIVER_NO,
      </if>
      <if test="driverName != null">
        DRIVER_NAME,
      </if>
      <if test="idNum != null">
        ID_NUM,
      </if>
      <if test="telNum != null">
        TEL_NUM,
      </if>
      <if test="memo != null">
        MEMO,
      </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="carId != null">
        CAR_ID,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="driverNo != null">
        #{driverNo,jdbcType=VARCHAR},
      </if>
      <if test="driverName != null">
        #{driverName,jdbcType=VARCHAR},
      </if>
      <if test="idNum != null">
        #{idNum,jdbcType=VARCHAR},
      </if>
      <if test="telNum != null">
        #{telNum,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        #{memo,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="carId != null">
        #{carId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.baseinfo.meterbasedriver.model.MeterBaseDriver">
    update METER_BASE_DRIVER
    set DRIVER_NAME = #{driverName,jdbcType=VARCHAR},
      ID_NUM = #{idNum,jdbcType=VARCHAR},
      TEL_NUM = #{telNum,jdbcType=VARCHAR},
      MEMO = #{memo,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},
      CAR_ID = #{carId,jdbcType=VARCHAR}
    where DRIVER_NO = #{driverNo,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.baseinfo.meterbasedriver.model.MeterBaseDriver">
    update METER_BASE_DRIVER
    <set>
      <if test="driverName != null">
        DRIVER_NAME = #{driverName,jdbcType=VARCHAR},
      </if>
      <if test="idNum != null">
        ID_NUM = #{idNum,jdbcType=VARCHAR},
      </if>
      <if test="telNum != null">
        TEL_NUM = #{telNum,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        MEMO = #{memo,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="carId != null">
        CAR_ID = #{carId,jdbcType=VARCHAR},
      </if>
    </set>
    where DRIVER_NO = #{driverNo,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where DRIVER_NO = #{driverNo,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_DRIVER 
      (DRIVER_NO, 
      DRIVER_NAME, ID_NUM, TEL_NUM, 
      MEMO, 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, 
      CAR_ID)
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.driverNo,jdbcType=VARCHAR}, 
      #{item.driverName,jdbcType=VARCHAR}, #{item.idNum,jdbcType=VARCHAR}, #{item.telNum,jdbcType=VARCHAR}, 
      #{item.memo,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.carId,jdbcType=VARCHAR} from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update METER_BASE_DRIVER
     set
       DRIVER_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.driverNo,jdbcType=VARCHAR}
       </foreach>
       ,DRIVER_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.driverName,jdbcType=VARCHAR}
       </foreach>
       ,ID_NUM=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.idNum,jdbcType=VARCHAR}
       </foreach>
       ,TEL_NUM=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.telNum,jdbcType=VARCHAR}
       </foreach>
       ,MEMO=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.memo,jdbcType=VARCHAR}
       </foreach>
       ,VALID_FLAG=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.validFlag,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_MAN_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.createManNo,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_MAN_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.createManName,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.createTime,jdbcType=TIMESTAMP}
       </foreach>
       ,UPDATE_MAN_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.updateManNo,jdbcType=VARCHAR}
       </foreach>
       ,UPDATE_MAN_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.updateManName,jdbcType=VARCHAR}
       </foreach>
       ,UPDATE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.updateTime,jdbcType=TIMESTAMP}
       </foreach>
       ,DELETE_MAN_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.deleteManNo,jdbcType=VARCHAR}
       </foreach>
       ,DELETE_MAN_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.deleteManName,jdbcType=VARCHAR}
       </foreach>
       ,DELETE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.deleteTime,jdbcType=TIMESTAMP}
       </foreach>
       ,CAR_ID=
       <foreach collection="list" item="item" index="index" separator=" " open="case DRIVER_NO" close="end">
          when #{item.driverNo,jdbcType=VARCHAR} then #{item.carId,jdbcType=VARCHAR}
       </foreach>
     where DRIVER_NO in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.driverNo,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from METER_BASE_DRIVER
    where DRIVER_NO in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  <!--  批量删除车辆对应司机信息-->
  <delete id="batchDeleteSelf" parameterType="java.lang.String">
    delete from METER_BASE_DRIVER
    where CAR_ID = #{carId}
  </delete>

  <select id="getNewID" parameterType="java.lang.String" resultType="java.lang.String">
    SELECT LPAD(NVL(MAX(TO_NUMBER(SUBSTR(DRIVER_NO,9))),0) + 1,4,'0') DRIVER_NO
    FROM METER_BASE_DRIVER where instr(DRIVER_NO,#{afl,jdbcType=VARCHAR})>0
  </select>
<!--  批量删除-->
  <delete id="deleteByBatch" parameterType="java.lang.String">
    delete from METER_BASE_DRIVER
    where DRIVER_NO IN ()
    <foreach collection="array" item="driverNo" open="(" separator="," close=")">
      #{driverNo}
    </foreach>
  </delete>

<!--  <delete id="deleteDriverById" parameterType="java.util.List">-->
<!--    delete from METER_BASE_DRIVER dr where dr.DRIVER_NO in-->
<!--    <foreach item="item" collection="deleteList" open="(" separator="," close=")">-->
<!--      #{item.driverNo,jdbcType=VARCHAR}-->
<!--    </foreach>-->
<!--  </delete>-->

  <update id="deleteDriverById" parameterType="java.util.List">
    update METER_BASE_DRIVER set VALID_FLAG = '1' where DRIVER_NO in
    <foreach item="driverNos" collection="list" open="(" separator="," close=")">
      #{driverNos}
    </foreach>
  </update>

  <update id="deleteCarById" parameterType="java.util.List">
    update METER_BASE_DRIVER set VALID_FLAG = '1' where CAR_ID in
    <foreach item="carNos" collection="list" open="(" separator="," close=")">
      #{carNos}
    </foreach>
  </update>

  <update id="enableCarById" parameterType="java.util.List">
    update METER_BASE_DRIVER set VALID_FLAG = '0' where CAR_ID in
    <foreach item="carNos" collection="list" open="(" separator="," close=")">
      #{carNos}
    </foreach>
  </update>

  <update id="deleteCarById01" parameterType="java.util.List">
    update METER_BASE_DRIVER set VALID_FLAG = '1' where driver_no in
    <foreach item="carNos" collection="list" open="(" separator="," close=")">
      #{carNos}
    </foreach>
  </update>

  <update id="enableCarById01" parameterType="java.util.List">
    update METER_BASE_DRIVER set VALID_FLAG = '0' where driver_no in
    <foreach item="carNos" collection="list" open="(" separator="," close=")">
      #{carNos}
    </foreach>
  </update>

  <select id="getDirverBySup" parameterType="java.lang.String" resultMap="BaseResultMap">
    select * from METER_BASE_DRIVER where CAR_ID in (select CAR_NO from METER_BASE_CAR WHERE CUSTOMER_SUPPLIER_NO = #{customerSupplierNo})
  </select>

  <update id="updateValidFlagByCarId" parameterType="java.util.HashMap">
    update METER_BASE_DRIVER set VALID_FLAG = '0'
    where 1=1
      <if test="carId != null and carId != ''">
        and car_id = #{carId}
      </if>
  </update>
</mapper>