<?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.associate.maintenancerecord.mapper.MaintenanceRecordMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.associate.maintenancerecord.model.MaintenanceRecord">
    <id column="MAINTENANCE_RECORD_NO" jdbcType="VARCHAR" property="maintenanceRecordNo" />
    <result column="EQUIPMENT_NO" jdbcType="VARCHAR" property="equipmentNo" />
    <result column="TEAM_GROUP_NO" jdbcType="VARCHAR" property="teamGroupNo" />
    <result column="START_TIME" jdbcType="TIMESTAMP" property="startTime" />
    <result column="END_TIME" jdbcType="TIMESTAMP" property="endTime" />
    <result column="FAULT_PHENOMENON" jdbcType="VARCHAR" property="faultPhenomenon" />
    <result column="RESULT_HANDLING" jdbcType="VARCHAR" property="resultHandling" />
    <result column="DISPOSE_MAN_NAME" jdbcType="VARCHAR" property="disposeManName" />
    <result column="SUBMISSION_MAN_NAME" jdbcType="VARCHAR" property="submissionManName" />
    <result column="RECORD_MAN_NAME" jdbcType="VARCHAR" property="recordManName" />
    <result column="VAILD_FLAG" jdbcType="VARCHAR" property="vaildFlag" />
    <result column="MEMO" jdbcType="VARCHAR" property="memo" />
    <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="EQUIPMENT_NAME" jdbcType="VARCHAR" property="equipmentName" />
  </resultMap>
  <sql id="columns">
    MAINTENANCE_RECORD_NO, EQUIPMENT_NO, TEAM_GROUP_NO, START_TIME, END_TIME, FAULT_PHENOMENON, 
    RESULT_HANDLING, DISPOSE_MAN_NAME, SUBMISSION_MAN_NAME, RECORD_MAN_NAME, VAILD_FLAG, 
    MEMO, CREATE_MAN_NO, CREATE_MAN_NAME, CREATE_TIME, UPDATE_MAN_NO, UPDATE_MAN_NAME, 
    UPDATE_TIME, DELETE_MAN_NO, DELETE_MAN_NAME, DELETE_TIME, EQUIPMENT_NAME
  </sql>
  <sql id="columns_alias">
    t.MAINTENANCE_RECORD_NO, t.EQUIPMENT_NO, t.TEAM_GROUP_NO, t.START_TIME, t.END_TIME, 
    t.FAULT_PHENOMENON, t.RESULT_HANDLING, t.DISPOSE_MAN_NAME, t.SUBMISSION_MAN_NAME, 
    t.RECORD_MAN_NAME, t.VAILD_FLAG, t.MEMO, 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.EQUIPMENT_NAME
  </sql>
  <sql id="select">
    SELECT <include refid="columns" /> FROM MAINTENANCE_RECORD
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias" /> FROM MAINTENANCE_RECORD t
  </sql>
  <sql id="where">
    <where> 
      <if test="maintenanceRecordNo != null and maintenanceRecordNo != ''">
        and MAINTENANCE_RECORD_NO = #{maintenanceRecordNo}
      </if>
      <if test="equipmentNo != null and equipmentNo != ''">
        and EQUIPMENT_NO = #{equipmentNo}
      </if>
      <if test="teamGroupNo != null and teamGroupNo != ''">
        and TEAM_GROUP_NO = #{teamGroupNo}
      </if>
      <if test="startTime != null">
        and TO_CHAR(START_TIME,'yyyy-MM-dd') = #{startTime}
      </if>
      <if test="endTime != null">
        and TO_CHAR(END_TIME,'yyyy-MM-dd') = #{endTime}
      </if>
      <if test="faultPhenomenon != null and faultPhenomenon != ''">
        and FAULT_PHENOMENON = #{faultPhenomenon}
      </if>
      <if test="resultHandling != null and resultHandling != ''">
        and RESULT_HANDLING = #{resultHandling}
      </if>
      <if test="disposeManName != null and disposeManName != ''">
        and DISPOSE_MAN_NAME = #{disposeManName}
      </if>
      <if test="submissionManName != null and submissionManName != ''">
        and SUBMISSION_MAN_NAME = #{submissionManName}
      </if>
      <if test="recordManName != null and recordManName != ''">
        and RECORD_MAN_NAME = #{recordManName}
      </if>
      <if test="vaildFlag != null and vaildFlag != ''">
        and VAILD_FLAG = #{vaildFlag}
      </if>
      <if test="memo != null and memo != ''">
        and MEMO = #{memo}
      </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="equipmentName != null and equipmentName != ''">
        and EQUIPMENT_NAME = #{equipmentName}
      </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>
  <sql id="whereLike">
    <where> 
      <if test="maintenanceRecordNo != null and maintenanceRecordNo != ''">
        and MAINTENANCE_RECORD_NO LIKE '%${maintenanceRecordNo}%'
      </if>
      <if test="equipmentNo != null and equipmentNo != ''">
        and EQUIPMENT_NO LIKE '%${equipmentNo}%'
      </if>
      <if test="teamGroupNo != null and teamGroupNo != ''">
        and TEAM_GROUP_NO LIKE '%${teamGroupNo}%'
      </if>
      <if test="startTime != null">
        and TO_CHAR(START_TIME,'yyyy-MM-dd') = #{startTime}
      </if>
      <if test="endTime != null">
        and TO_CHAR(END_TIME,'yyyy-MM-dd') = #{endTime}
      </if>
      <if test="faultPhenomenon != null and faultPhenomenon != ''">
        and FAULT_PHENOMENON LIKE '%${faultPhenomenon}%'
      </if>
      <if test="resultHandling != null and resultHandling != ''">
        and RESULT_HANDLING LIKE '%${resultHandling}%'
      </if>
      <if test="disposeManName != null and disposeManName != ''">
        and DISPOSE_MAN_NAME LIKE '%${disposeManName}%'
      </if>
      <if test="submissionManName != null and submissionManName != ''">
        and SUBMISSION_MAN_NAME LIKE '%${submissionManName}%'
      </if>
      <if test="recordManName != null and recordManName != ''">
        and RECORD_MAN_NAME LIKE '%${recordManName}%'
      </if>
      <if test="vaildFlag != null and vaildFlag != ''">
        and VAILD_FLAG LIKE '%${vaildFlag}%'
      </if>
      <if test="memo != null and memo != ''">
        and MEMO LIKE '%${memo}%'
      </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="equipmentName != null and equipmentName != ''">
        and EQUIPMENT_NAME LIKE '%${equipmentName}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from MAINTENANCE_RECORD
    where MAINTENANCE_RECORD_NO = #{maintenanceRecordNo,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from MAINTENANCE_RECORD
    where 1!=1 
      <if test="equipmentNo != null and equipmentNo != ''">
        or EQUIPMENT_NO = #{equipmentNo}
      </if>
      <if test="teamGroupNo != null and teamGroupNo != ''">
        or TEAM_GROUP_NO = #{teamGroupNo}
      </if>
      <if test="startTime != null">
        or TO_CHAR(START_TIME,'yyyy-MM-dd') = '#{startTime}'
      </if>
      <if test="endTime != null">
        or TO_CHAR(END_TIME,'yyyy-MM-dd') = '#{endTime}'
      </if>
      <if test="faultPhenomenon != null and faultPhenomenon != ''">
        or FAULT_PHENOMENON = #{faultPhenomenon}
      </if>
      <if test="resultHandling != null and resultHandling != ''">
        or RESULT_HANDLING = #{resultHandling}
      </if>
      <if test="disposeManName != null and disposeManName != ''">
        or DISPOSE_MAN_NAME = #{disposeManName}
      </if>
      <if test="submissionManName != null and submissionManName != ''">
        or SUBMISSION_MAN_NAME = #{submissionManName}
      </if>
      <if test="recordManName != null and recordManName != ''">
        or RECORD_MAN_NAME = #{recordManName}
      </if>
      <if test="vaildFlag != null and vaildFlag != ''">
        or VAILD_FLAG = #{vaildFlag}
      </if>
      <if test="memo != null and memo != ''">
        or MEMO = #{memo}
      </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="equipmentName != null and equipmentName != ''">
        or EQUIPMENT_NAME = #{equipmentName}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.associate.maintenancerecord.model.MaintenanceRecord">
    insert into MAINTENANCE_RECORD (MAINTENANCE_RECORD_NO, EQUIPMENT_NO, 
      TEAM_GROUP_NO, START_TIME, END_TIME, 
      FAULT_PHENOMENON, RESULT_HANDLING, DISPOSE_MAN_NAME, 
      SUBMISSION_MAN_NAME, RECORD_MAN_NAME, VAILD_FLAG, 
      MEMO, CREATE_MAN_NO, CREATE_MAN_NAME, 
      CREATE_TIME, UPDATE_MAN_NO, UPDATE_MAN_NAME, 
      UPDATE_TIME, DELETE_MAN_NO, DELETE_MAN_NAME, 
      DELETE_TIME, EQUIPMENT_NAME)
    values (#{maintenanceRecordNo,jdbcType=VARCHAR}, #{equipmentNo,jdbcType=VARCHAR}, 
      #{teamGroupNo,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, 
      #{faultPhenomenon,jdbcType=VARCHAR}, #{resultHandling,jdbcType=VARCHAR}, #{disposeManName,jdbcType=VARCHAR}, 
      #{submissionManName,jdbcType=VARCHAR}, #{recordManName,jdbcType=VARCHAR}, #{vaildFlag,jdbcType=VARCHAR}, 
      #{memo,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}, #{equipmentName,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.associate.maintenancerecord.model.MaintenanceRecord">
    insert into MAINTENANCE_RECORD
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="maintenanceRecordNo != null">
        MAINTENANCE_RECORD_NO,
      </if>
      <if test="equipmentNo != null">
        EQUIPMENT_NO,
      </if>
      <if test="teamGroupNo != null">
        TEAM_GROUP_NO,
      </if>
      <if test="startTime != null">
        START_TIME,
      </if>
      <if test="endTime != null">
        END_TIME,
      </if>
      <if test="faultPhenomenon != null">
        FAULT_PHENOMENON,
      </if>
      <if test="resultHandling != null">
        RESULT_HANDLING,
      </if>
      <if test="disposeManName != null">
        DISPOSE_MAN_NAME,
      </if>
      <if test="submissionManName != null">
        SUBMISSION_MAN_NAME,
      </if>
      <if test="recordManName != null">
        RECORD_MAN_NAME,
      </if>
      <if test="vaildFlag != null">
        VAILD_FLAG,
      </if>
      <if test="memo != null">
        MEMO,
      </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="equipmentName != null">
        EQUIPMENT_NAME,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="maintenanceRecordNo != null">
        #{maintenanceRecordNo,jdbcType=VARCHAR},
      </if>
      <if test="equipmentNo != null">
        #{equipmentNo,jdbcType=VARCHAR},
      </if>
      <if test="teamGroupNo != null">
        #{teamGroupNo,jdbcType=VARCHAR},
      </if>
      <if test="startTime != null">
        #{startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="faultPhenomenon != null">
        #{faultPhenomenon,jdbcType=VARCHAR},
      </if>
      <if test="resultHandling != null">
        #{resultHandling,jdbcType=VARCHAR},
      </if>
      <if test="disposeManName != null">
        #{disposeManName,jdbcType=VARCHAR},
      </if>
      <if test="submissionManName != null">
        #{submissionManName,jdbcType=VARCHAR},
      </if>
      <if test="recordManName != null">
        #{recordManName,jdbcType=VARCHAR},
      </if>
      <if test="vaildFlag != null">
        #{vaildFlag,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        #{memo,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="equipmentName != null">
        #{equipmentName,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.associate.maintenancerecord.model.MaintenanceRecord">
    update MAINTENANCE_RECORD
    set EQUIPMENT_NO = #{equipmentNo,jdbcType=VARCHAR},
      TEAM_GROUP_NO = #{teamGroupNo,jdbcType=VARCHAR},
      START_TIME = #{startTime,jdbcType=TIMESTAMP},
      END_TIME = #{endTime,jdbcType=TIMESTAMP},
      FAULT_PHENOMENON = #{faultPhenomenon,jdbcType=VARCHAR},
      RESULT_HANDLING = #{resultHandling,jdbcType=VARCHAR},
      DISPOSE_MAN_NAME = #{disposeManName,jdbcType=VARCHAR},
      SUBMISSION_MAN_NAME = #{submissionManName,jdbcType=VARCHAR},
      RECORD_MAN_NAME = #{recordManName,jdbcType=VARCHAR},
      VAILD_FLAG = #{vaildFlag,jdbcType=VARCHAR},
      MEMO = #{memo,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},
      EQUIPMENT_NAME = #{equipmentName,jdbcType=VARCHAR}
    where MAINTENANCE_RECORD_NO = #{maintenanceRecordNo,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.associate.maintenancerecord.model.MaintenanceRecord">
    update MAINTENANCE_RECORD
    <set>
      <if test="equipmentNo != null">
        EQUIPMENT_NO = #{equipmentNo,jdbcType=VARCHAR},
      </if>
      <if test="teamGroupNo != null">
        TEAM_GROUP_NO = #{teamGroupNo,jdbcType=VARCHAR},
      </if>
      <if test="startTime != null">
        START_TIME = #{startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        END_TIME = #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="faultPhenomenon != null">
        FAULT_PHENOMENON = #{faultPhenomenon,jdbcType=VARCHAR},
      </if>
      <if test="resultHandling != null">
        RESULT_HANDLING = #{resultHandling,jdbcType=VARCHAR},
      </if>
      <if test="disposeManName != null">
        DISPOSE_MAN_NAME = #{disposeManName,jdbcType=VARCHAR},
      </if>
      <if test="submissionManName != null">
        SUBMISSION_MAN_NAME = #{submissionManName,jdbcType=VARCHAR},
      </if>
      <if test="recordManName != null">
        RECORD_MAN_NAME = #{recordManName,jdbcType=VARCHAR},
      </if>
      <if test="vaildFlag != null">
        VAILD_FLAG = #{vaildFlag,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        MEMO = #{memo,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="equipmentName != null">
        EQUIPMENT_NAME = #{equipmentName,jdbcType=VARCHAR},
      </if>
    </set>
    where MAINTENANCE_RECORD_NO = #{maintenanceRecordNo,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select" />
    where MAINTENANCE_RECORD_NO = #{maintenanceRecordNo,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 MAINTENANCE_RECORD 
      (MAINTENANCE_RECORD_NO, 
      EQUIPMENT_NO, TEAM_GROUP_NO, START_TIME, 
      END_TIME, FAULT_PHENOMENON, RESULT_HANDLING, 
      DISPOSE_MAN_NAME, SUBMISSION_MAN_NAME, 
      RECORD_MAN_NAME, VAILD_FLAG, MEMO, 
      CREATE_MAN_NO, CREATE_MAN_NAME, CREATE_TIME, 
      UPDATE_MAN_NO, UPDATE_MAN_NAME, UPDATE_TIME, 
      DELETE_MAN_NO, DELETE_MAN_NAME, DELETE_TIME, 
      EQUIPMENT_NAME)
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.maintenanceRecordNo,jdbcType=VARCHAR}, 
      #{item.equipmentNo,jdbcType=VARCHAR}, #{item.teamGroupNo,jdbcType=VARCHAR}, #{item.startTime,jdbcType=TIMESTAMP}, 
      #{item.endTime,jdbcType=TIMESTAMP}, #{item.faultPhenomenon,jdbcType=VARCHAR}, #{item.resultHandling,jdbcType=VARCHAR}, 
      #{item.disposeManName,jdbcType=VARCHAR}, #{item.submissionManName,jdbcType=VARCHAR}, 
      #{item.recordManName,jdbcType=VARCHAR}, #{item.vaildFlag,jdbcType=VARCHAR}, #{item.memo,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.equipmentName,jdbcType=VARCHAR} from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update MAINTENANCE_RECORD
     set
       MAINTENANCE_RECORD_NO=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.maintenanceRecordNo,jdbcType=VARCHAR}
       </foreach>
       ,EQUIPMENT_NO=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.equipmentNo,jdbcType=VARCHAR}
       </foreach>
       ,TEAM_GROUP_NO=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.teamGroupNo,jdbcType=VARCHAR}
       </foreach>
       ,START_TIME=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.startTime,jdbcType=TIMESTAMP}
       </foreach>
       ,END_TIME=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.endTime,jdbcType=TIMESTAMP}
       </foreach>
       ,FAULT_PHENOMENON=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.faultPhenomenon,jdbcType=VARCHAR}
       </foreach>
       ,RESULT_HANDLING=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.resultHandling,jdbcType=VARCHAR}
       </foreach>
       ,DISPOSE_MAN_NAME=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.disposeManName,jdbcType=VARCHAR}
       </foreach>
       ,SUBMISSION_MAN_NAME=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.submissionManName,jdbcType=VARCHAR}
       </foreach>
       ,RECORD_MAN_NAME=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.recordManName,jdbcType=VARCHAR}
       </foreach>
       ,VAILD_FLAG=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.vaildFlag,jdbcType=VARCHAR}
       </foreach>
       ,MEMO=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.memo,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_MAN_NO=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.createManNo,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_MAN_NAME=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.createManName,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_TIME=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.createTime,jdbcType=TIMESTAMP}
       </foreach>
       ,UPDATE_MAN_NO=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.updateManNo,jdbcType=VARCHAR}
       </foreach>
       ,UPDATE_MAN_NAME=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.updateManName,jdbcType=VARCHAR}
       </foreach>
       ,UPDATE_TIME=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.updateTime,jdbcType=TIMESTAMP}
       </foreach>
       ,DELETE_MAN_NO=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.deleteManNo,jdbcType=VARCHAR}
       </foreach>
       ,DELETE_MAN_NAME=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.deleteManName,jdbcType=VARCHAR}
       </foreach>
       ,DELETE_TIME=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.deleteTime,jdbcType=TIMESTAMP}
       </foreach>
       ,EQUIPMENT_NAME=
       <foreach close="end" collection="list" index="index" item="item" open="case MAINTENANCE_RECORD_NO" separator=" ">
          when #{item.maintenanceRecordNo,jdbcType=VARCHAR} then #{item.equipmentName,jdbcType=VARCHAR}
       </foreach>
     where MAINTENANCE_RECORD_NO in 
     <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
    #{item.maintenanceRecordNo,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from MAINTENANCE_RECORD
    where MAINTENANCE_RECORD_NO in 
    <foreach close=")" collection="list" item="id" open="(" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  <select id="GetNewID" parameterType="java.lang.String" resultType="java.lang.String">
    SELECT LPAD(NVL(MAX(TO_NUMBER(SUBSTR(MAINTENANCE_RECORD_NO, LENGTH(MAINTENANCE_RECORD_NO) -3))),0) + 1,4,'0') MAINTENANCE_RECORD_NO
    FROM MAINTENANCE_RECORD
   </select>

  <select id="selectForUpdate" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <where>
      <if test="maintenanceRecordNo != null and maintenanceRecordNo != ''">
        and MAINTENANCE_RECORD_NO != #{carrierUnitNo}
      </if>
    </where>
  </select>
</mapper>