<?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.meterwork.meterworkcalibrationbranch.mapper.MeterWorkCalibrationBranchMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.meterwork.meterworkcalibrationbranch.model.MeterWorkCalibrationBranch">
    <id column="CALIBRATION_BRANCH_NO" jdbcType="VARCHAR" property="calibrationBranchNo" />
    <result column="CALIBRATION_MAIN_NO" jdbcType="VARCHAR" property="calibrationMainNo" />
    <result column="BASE_SPOT_NO" jdbcType="VARCHAR" property="baseSpotNo" />
    <result column="BASE_SPOT_NAME" jdbcType="VARCHAR" property="baseSpotName" />
    <result column="SPOT_TYPE_NO" jdbcType="VARCHAR" property="spotTypeNo" />
    <result column="SPOT_TYPE_NAME" jdbcType="VARCHAR" property="spotTypeName" />
    <result column="CALIBRATION_TYPE_NO" jdbcType="VARCHAR" property="calibrationTypeNo" />
    <result column="CALIBRATION_TYPE_NAME" jdbcType="VARCHAR" property="calibrationTypeName" />
    <result column="CALIBRATION_WEIGHT" jdbcType="VARCHAR" property="calibrationWeight" />
    <result column="VALUE_FLAG" jdbcType="VARCHAR" property="valueFlag" />
    <result column="CALIBR_CONTRAST_BRANCH_NO" jdbcType="VARCHAR" property="calibrContrastBranchNo" />
    <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="CAR_NO" jdbcType="VARCHAR" property="carNo" />
  </resultMap>
  <sql id="columns">
    CALIBRATION_BRANCH_NO, CALIBRATION_MAIN_NO, BASE_SPOT_NO, BASE_SPOT_NAME, SPOT_TYPE_NO,
    SPOT_TYPE_NAME, CALIBRATION_TYPE_NO, CALIBRATION_TYPE_NAME, CALIBRATION_WEIGHT, VALUE_FLAG,
    CALIBR_CONTRAST_BRANCH_NO, CREATE_MAN_NO, CREATE_MAN_NAME, CREATE_TIME, CAR_NO
  </sql>
  <sql id="columns_alias">
    t.CALIBRATION_BRANCH_NO, t.CALIBRATION_MAIN_NO, t.BASE_SPOT_NO, t.BASE_SPOT_NAME,
    t.SPOT_TYPE_NO, t.SPOT_TYPE_NAME, t.CALIBRATION_TYPE_NO, t.CALIBRATION_TYPE_NAME,
    t.CALIBRATION_WEIGHT, t.VALUE_FLAG, t.CALIBR_CONTRAST_BRANCH_NO, t.CREATE_MAN_NO,
    t.CREATE_MAN_NAME, t.CREATE_TIME, t.CAR_NO
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM METER_WORK_CALIBRATION_BRANCH
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM METER_WORK_CALIBRATION_BRANCH t
  </sql>
  <sql id="where">
    <where>
      <if test="calibrationBranchNo != null and calibrationBranchNo != ''">
        and CALIBRATION_BRANCH_NO = #{calibrationBranchNo}
      </if>
      <if test="calibrationMainNo != null and calibrationMainNo != ''">
        and CALIBRATION_MAIN_NO = #{calibrationMainNo}
      </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="spotTypeNo != null and spotTypeNo != ''">
        and SPOT_TYPE_NO = #{spotTypeNo}
      </if>
      <if test="spotTypeName != null and spotTypeName != ''">
        and SPOT_TYPE_NAME = #{spotTypeName}
      </if>
      <if test="calibrationTypeNo != null and calibrationTypeNo != ''">
        and CALIBRATION_TYPE_NO = #{calibrationTypeNo}
      </if>
      <if test="calibrationTypeName != null and calibrationTypeName != ''">
        and CALIBRATION_TYPE_NAME = #{calibrationTypeName}
      </if>
      <if test="calibrationWeight != null and calibrationWeight != ''">
        and CALIBRATION_WEIGHT = #{calibrationWeight}
      </if>
      <if test="valueFlag != null and valueFlag != ''">
        and VALUE_FLAG = #{valueFlag}
      </if>
      <if test="calibrContrastBranchNo != null and calibrContrastBranchNo != ''">
        and CALIBR_CONTRAST_BRANCH_NO = #{calibrContrastBranchNo}
      </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="carNo != null and carNo != ''">
        and CAR_NO = #{carNo}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where>
      <if test="calibrationBranchNo != null and calibrationBranchNo != ''">
        and CALIBRATION_BRANCH_NO LIKE '%${calibrationBranchNo}%'
      </if>
      <if test="calibrationMainNo != null and calibrationMainNo != ''">
        and CALIBRATION_MAIN_NO LIKE '%${calibrationMainNo}%'
      </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="spotTypeNo != null and spotTypeNo != ''">
        and SPOT_TYPE_NO LIKE '%${spotTypeNo}%'
      </if>
      <if test="spotTypeName != null and spotTypeName != ''">
        and SPOT_TYPE_NAME LIKE '%${spotTypeName}%'
      </if>
      <if test="calibrationTypeNo != null and calibrationTypeNo != ''">
        and CALIBRATION_TYPE_NO LIKE '%${calibrationTypeNo}%'
      </if>
      <if test="calibrationTypeName != null and calibrationTypeName != ''">
        and CALIBRATION_TYPE_NAME LIKE '%${calibrationTypeName}%'
      </if>
      <if test="calibrationWeight != null and calibrationWeight != ''">
        and CALIBRATION_WEIGHT LIKE '%${calibrationWeight}%'
      </if>
      <if test="valueFlag != null and valueFlag != ''">
        and VALUE_FLAG LIKE '%${valueFlag}%'
      </if>
      <if test="calibrContrastBranchNo != null and calibrContrastBranchNo != ''">
        and CALIBR_CONTRAST_BRANCH_NO LIKE '%${calibrContrastBranchNo}%'
      </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="carNo != null and carNo != ''">
        and CAR_NO LIKE '%${carNo}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from METER_WORK_CALIBRATION_BRANCH
    where CALIBRATION_BRANCH_NO = #{calibrationBranchNo,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from METER_WORK_CALIBRATION_BRANCH
    where 1!=1
    <if test="calibrationMainNo != null and calibrationMainNo != ''">
      or CALIBRATION_MAIN_NO = #{calibrationMainNo}
    </if>
    <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="spotTypeNo != null and spotTypeNo != ''">
      or SPOT_TYPE_NO = #{spotTypeNo}
    </if>
    <if test="spotTypeName != null and spotTypeName != ''">
      or SPOT_TYPE_NAME = #{spotTypeName}
    </if>
    <if test="calibrationTypeNo != null and calibrationTypeNo != ''">
      or CALIBRATION_TYPE_NO = #{calibrationTypeNo}
    </if>
    <if test="calibrationTypeName != null and calibrationTypeName != ''">
      or CALIBRATION_TYPE_NAME = #{calibrationTypeName}
    </if>
    <if test="calibrationWeight != null and calibrationWeight != ''">
      or CALIBRATION_WEIGHT = #{calibrationWeight}
    </if>
    <if test="valueFlag != null and valueFlag != ''">
      or VALUE_FLAG = #{valueFlag}
    </if>
    <if test="calibrContrastBranchNo != null and calibrContrastBranchNo != ''">
      or CALIBR_CONTRAST_BRANCH_NO = #{calibrContrastBranchNo}
    </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="carNo != null and carNo != ''">
      or CAR_NO = #{carNo}
    </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.meterwork.meterworkcalibrationbranch.model.MeterWorkCalibrationBranch">
    insert into METER_WORK_CALIBRATION_BRANCH (CALIBRATION_BRANCH_NO, CALIBRATION_MAIN_NO,
      BASE_SPOT_NO, BASE_SPOT_NAME, SPOT_TYPE_NO,
      SPOT_TYPE_NAME, CALIBRATION_TYPE_NO, CALIBRATION_TYPE_NAME,
      CALIBRATION_WEIGHT, VALUE_FLAG, CALIBR_CONTRAST_BRANCH_NO,
      CREATE_MAN_NO, CREATE_MAN_NAME, CREATE_TIME,
      CAR_NO)
    values (#{calibrationBranchNo,jdbcType=VARCHAR}, #{calibrationMainNo,jdbcType=VARCHAR},
      #{baseSpotNo,jdbcType=VARCHAR}, #{baseSpotName,jdbcType=VARCHAR}, #{spotTypeNo,jdbcType=VARCHAR},
      #{spotTypeName,jdbcType=VARCHAR}, #{calibrationTypeNo,jdbcType=VARCHAR}, #{calibrationTypeName,jdbcType=VARCHAR},
      #{calibrationWeight,jdbcType=VARCHAR}, #{valueFlag,jdbcType=VARCHAR}, #{calibrContrastBranchNo,jdbcType=VARCHAR},
      #{createManNo,jdbcType=VARCHAR}, #{createManName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
      #{carNo,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.meterwork.meterworkcalibrationbranch.model.MeterWorkCalibrationBranch">
    insert into METER_WORK_CALIBRATION_BRANCH
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="calibrationBranchNo != null">
        CALIBRATION_BRANCH_NO,
      </if>
      <if test="calibrationMainNo != null">
        CALIBRATION_MAIN_NO,
      </if>
      <if test="baseSpotNo != null">
        BASE_SPOT_NO,
      </if>
      <if test="baseSpotName != null">
        BASE_SPOT_NAME,
      </if>
      <if test="spotTypeNo != null">
        SPOT_TYPE_NO,
      </if>
      <if test="spotTypeName != null">
        SPOT_TYPE_NAME,
      </if>
      <if test="calibrationTypeNo != null">
        CALIBRATION_TYPE_NO,
      </if>
      <if test="calibrationTypeName != null">
        CALIBRATION_TYPE_NAME,
      </if>
      <if test="calibrationWeight != null">
        CALIBRATION_WEIGHT,
      </if>
      <if test="valueFlag != null">
        VALUE_FLAG,
      </if>
      <if test="calibrContrastBranchNo != null">
        CALIBR_CONTRAST_BRANCH_NO,
      </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="carNo != null">
        CAR_NO,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="calibrationBranchNo != null">
        #{calibrationBranchNo,jdbcType=VARCHAR},
      </if>
      <if test="calibrationMainNo != null">
        #{calibrationMainNo,jdbcType=VARCHAR},
      </if>
      <if test="baseSpotNo != null">
        #{baseSpotNo,jdbcType=VARCHAR},
      </if>
      <if test="baseSpotName != null">
        #{baseSpotName,jdbcType=VARCHAR},
      </if>
      <if test="spotTypeNo != null">
        #{spotTypeNo,jdbcType=VARCHAR},
      </if>
      <if test="spotTypeName != null">
        #{spotTypeName,jdbcType=VARCHAR},
      </if>
      <if test="calibrationTypeNo != null">
        #{calibrationTypeNo,jdbcType=VARCHAR},
      </if>
      <if test="calibrationTypeName != null">
        #{calibrationTypeName,jdbcType=VARCHAR},
      </if>
      <if test="calibrationWeight != null">
        #{calibrationWeight,jdbcType=VARCHAR},
      </if>
      <if test="valueFlag != null">
        #{valueFlag,jdbcType=VARCHAR},
      </if>
      <if test="calibrContrastBranchNo != null">
        #{calibrContrastBranchNo,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="carNo != null">
        #{carNo,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.meterwork.meterworkcalibrationbranch.model.MeterWorkCalibrationBranch">
    update METER_WORK_CALIBRATION_BRANCH
    set CALIBRATION_MAIN_NO = #{calibrationMainNo,jdbcType=VARCHAR},
      BASE_SPOT_NO = #{baseSpotNo,jdbcType=VARCHAR},
      BASE_SPOT_NAME = #{baseSpotName,jdbcType=VARCHAR},
      SPOT_TYPE_NO = #{spotTypeNo,jdbcType=VARCHAR},
      SPOT_TYPE_NAME = #{spotTypeName,jdbcType=VARCHAR},
      CALIBRATION_TYPE_NO = #{calibrationTypeNo,jdbcType=VARCHAR},
      CALIBRATION_TYPE_NAME = #{calibrationTypeName,jdbcType=VARCHAR},
      CALIBRATION_WEIGHT = #{calibrationWeight,jdbcType=VARCHAR},
      VALUE_FLAG = #{valueFlag,jdbcType=VARCHAR},
      CALIBR_CONTRAST_BRANCH_NO = #{calibrContrastBranchNo,jdbcType=VARCHAR},
      CREATE_MAN_NO = #{createManNo,jdbcType=VARCHAR},
      CREATE_MAN_NAME = #{createManName,jdbcType=VARCHAR},
      CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
      CAR_NO = #{carNo,jdbcType=VARCHAR}
    where CALIBRATION_BRANCH_NO = #{calibrationBranchNo,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.meterwork.meterworkcalibrationbranch.model.MeterWorkCalibrationBranch">
    update METER_WORK_CALIBRATION_BRANCH
    <set>
      <if test="calibrationMainNo != null">
        CALIBRATION_MAIN_NO = #{calibrationMainNo,jdbcType=VARCHAR},
      </if>
      <if test="baseSpotNo != null">
        BASE_SPOT_NO = #{baseSpotNo,jdbcType=VARCHAR},
      </if>
      <if test="baseSpotName != null">
        BASE_SPOT_NAME = #{baseSpotName,jdbcType=VARCHAR},
      </if>
      <if test="spotTypeNo != null">
        SPOT_TYPE_NO = #{spotTypeNo,jdbcType=VARCHAR},
      </if>
      <if test="spotTypeName != null">
        SPOT_TYPE_NAME = #{spotTypeName,jdbcType=VARCHAR},
      </if>
      <if test="calibrationTypeNo != null">
        CALIBRATION_TYPE_NO = #{calibrationTypeNo,jdbcType=VARCHAR},
      </if>
      <if test="calibrationTypeName != null">
        CALIBRATION_TYPE_NAME = #{calibrationTypeName,jdbcType=VARCHAR},
      </if>
      <if test="calibrationWeight != null">
        CALIBRATION_WEIGHT = #{calibrationWeight,jdbcType=VARCHAR},
      </if>
      <if test="valueFlag != null">
        VALUE_FLAG = #{valueFlag,jdbcType=VARCHAR},
      </if>
      <if test="calibrContrastBranchNo != null">
        CALIBR_CONTRAST_BRANCH_NO = #{calibrContrastBranchNo,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="carNo != null">
        CAR_NO = #{carNo,jdbcType=VARCHAR},
      </if>
    </set>
    where CALIBRATION_BRANCH_NO = #{calibrationBranchNo,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where CALIBRATION_BRANCH_NO = #{calibrationBranchNo,jdbcType=VARCHAR}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="where"/>
    order by  CALIBRATION_BRANCH_NO desc
  </select>
  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="whereLike"/>
    order by  CALIBRATION_BRANCH_NO desc
  </select>
  <insert id="batchInsert" parameterType="java.util.List">
    insert into METER_WORK_CALIBRATION_BRANCH
    (CALIBRATION_BRANCH_NO,
    CALIBRATION_MAIN_NO, BASE_SPOT_NO,
    BASE_SPOT_NAME, SPOT_TYPE_NO, SPOT_TYPE_NAME,
    CALIBRATION_TYPE_NO, CALIBRATION_TYPE_NAME,
    CALIBRATION_WEIGHT, VALUE_FLAG,
    CALIBR_CONTRAST_BRANCH_NO, CREATE_MAN_NO,
    CREATE_MAN_NAME, CREATE_TIME,
    CAR_NO)
    ( <foreach collection="list" item="item" separator="union all">
    select
    #{item.calibrationBranchNo,jdbcType=VARCHAR},
    #{item.calibrationMainNo,jdbcType=VARCHAR}, #{item.baseSpotNo,jdbcType=VARCHAR},
    #{item.baseSpotName,jdbcType=VARCHAR}, #{item.spotTypeNo,jdbcType=VARCHAR}, #{item.spotTypeName,jdbcType=VARCHAR},
    #{item.calibrationTypeNo,jdbcType=VARCHAR}, #{item.calibrationTypeName,jdbcType=VARCHAR},
    #{item.calibrationWeight,jdbcType=VARCHAR}, #{item.valueFlag,jdbcType=VARCHAR},
    #{item.calibrContrastBranchNo,jdbcType=VARCHAR}, #{item.createManNo,jdbcType=VARCHAR},
    #{item.createManName,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
    #{item.carNo,jdbcType=VARCHAR} from dual
  </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
    update METER_WORK_CALIBRATION_BRANCH
    set
    CALIBRATION_BRANCH_NO=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.calibrationBranchNo,jdbcType=VARCHAR}
    </foreach>
    ,CALIBRATION_MAIN_NO=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.calibrationMainNo,jdbcType=VARCHAR}
    </foreach>
    ,BASE_SPOT_NO=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.baseSpotNo,jdbcType=VARCHAR}
    </foreach>
    ,BASE_SPOT_NAME=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.baseSpotName,jdbcType=VARCHAR}
    </foreach>
    ,SPOT_TYPE_NO=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.spotTypeNo,jdbcType=VARCHAR}
    </foreach>
    ,SPOT_TYPE_NAME=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.spotTypeName,jdbcType=VARCHAR}
    </foreach>
    ,CALIBRATION_TYPE_NO=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.calibrationTypeNo,jdbcType=VARCHAR}
    </foreach>
    ,CALIBRATION_TYPE_NAME=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.calibrationTypeName,jdbcType=VARCHAR}
    </foreach>
    ,CALIBRATION_WEIGHT=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.calibrationWeight,jdbcType=VARCHAR}
    </foreach>
    ,VALUE_FLAG=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.valueFlag,jdbcType=VARCHAR}
    </foreach>
    ,CALIBR_CONTRAST_BRANCH_NO=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.calibrContrastBranchNo,jdbcType=VARCHAR}
    </foreach>
    ,CREATE_MAN_NO=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.createManNo,jdbcType=VARCHAR}
    </foreach>
    ,CREATE_MAN_NAME=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.createManName,jdbcType=VARCHAR}
    </foreach>
    ,CREATE_TIME=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.createTime,jdbcType=TIMESTAMP}
    </foreach>
    ,CAR_NO=
    <foreach collection="list" item="item" index="index" separator=" " open="case CALIBRATION_BRANCH_NO" close="end">
      when #{item.calibrationBranchNo,jdbcType=VARCHAR} then #{item.carNo,jdbcType=VARCHAR}
    </foreach>
    where CALIBRATION_BRANCH_NO in
    <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
      #{item.calibrationBranchNo,jdbcType=VARCHAR}
    </foreach>
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from METER_WORK_CALIBRATION_BRANCH
    where CALIBRATION_BRANCH_NO in
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  <select id="getByMainNo" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where CALIBRATION_MAIN_NO = #{calibrationBranchNo,jdbcType=VARCHAR} order by CREATE_TIME  desc
  </select>

  <select id="getNewID" parameterType="java.lang.String" resultType="java.lang.String">
    SELECT LPAD(NVL(MAX(TO_NUMBER(SUBSTR(CALIBRATION_BRANCH_NO, LENGTH(CALIBRATION_BRANCH_NO) - 5))),0) + 1,6,'0') CALIBRATION_BRANCH_NO
    FROM METER_WORK_CALIBRATION_BRANCH where instr(CALIBRATION_BRANCH_NO,#{afl})>0
  </select>

  <select id="selectForMutual" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    select t1.*
    from METER_WORK_CALIBRATION_BRANCH t1
    where
     1=1
    <if test="carNo != null and carNo != ''">
      and t1.car_no = #{carNo}
    </if>
     and t1.calibration_type_no = '001005002'
     and to_char(t1.Create_Time, 'yyyy-MM-dd') =
         to_char(sysdate, 'yyyy-MM-dd')
     and t1.calibration_main_no in
         (select t.calibration_main_no
            from METER_WORK_CALIBRATION_MAIN t
           where t.base_contrast_spot_no = #{baseSpotNo}
             and t.value_flag = '3'
             and t.calibration_type_no = '001005002')
  </select>

  <select id="selectForJudge" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  select t1.*
  from METER_WORK_CALIBRATION_BRANCH t1
 where
    1=1
    <if test="carNo != null and carNo != ''">
      and t1.car_no = #{carNo}
    </if>
     and t1.base_spot_no = #{baseSpotNo}
     and t1.value_flag = #{valueFlag}
     and t1.calibration_type_no = #{calibrationTypeNo}
     and to_char(t1.Create_Time, 'yyyy-MM-dd') =
         to_char(sysdate, 'yyyy-MM-dd')
     and t1.calibration_main_no in
         (select t.calibration_main_no
            from METER_WORK_CALIBRATION_MAIN t
           where t.base_contrast_spot_no = #{baseSpotNoContrast}
             and t.value_flag = '3'
             and t.calibration_type_no = '001005002')
  </select>

  <select id="doQuerySomeWf" parameterType="java.util.List" resultMap="BaseResultMap">
    select * from METER_WORK_CALIBRATION_BRANCH
    where CALIBRATION_MAIN_NO in
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </select>
</mapper>