<?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.appphonehelp.mapper.AppPhoneHelpMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.baseinfo.appphonehelp.model.AppPhoneHelp">
    <id column="HELP_ID" jdbcType="VARCHAR" property="helpId" />
    <result column="CAR_NO" jdbcType="VARCHAR" property="carNo" />
    <result column="PHONE_NO" jdbcType="VARCHAR" property="phoneNo" />
    <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" />
    <result column="END_TIME" jdbcType="TIMESTAMP" property="endTime" />
    <result column="CREATE_NO" jdbcType="VARCHAR" property="createNo" />
    <result column="CREATE_NAME" jdbcType="VARCHAR" property="createName" />
    <result column="RESULT" jdbcType="VARCHAR" property="result" />
    <result column="VALUE_FLAG" jdbcType="VARCHAR" property="valueFlag" />
    <result column="DRIVER_NAME" jdbcType="VARCHAR" property="driverName" />
  </resultMap>
  <sql id="columns">
    HELP_ID, CAR_NO, PHONE_NO, CREATE_TIME, END_TIME, CREATE_NO, CREATE_NAME, RESULT, 
    VALUE_FLAG, DRIVER_NAME
  </sql>
  <sql id="columns_alias">
    t.HELP_ID, t.CAR_NO, t.PHONE_NO, t.CREATE_TIME, t.END_TIME, t.CREATE_NO, t.CREATE_NAME, 
    t.RESULT, t.VALUE_FLAG, t.DRIVER_NAME
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM APP_PHONE_HELP
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM APP_PHONE_HELP t
  </sql>
  <sql id="where">
    <where> 
      <if test="helpId != null and helpId != ''">
        and HELP_ID = #{helpId}
      </if>
      <if test="carNo != null and carNo != ''">
        and CAR_NO = #{carNo}
      </if>
      <if test="phoneNo != null and phoneNo != ''">
        and PHONE_NO = #{phoneNo}
      </if>
      <if test="createTime != null">
        and TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = #{createTime}
      </if>
      <if test="endTime != null">
        and TO_CHAR(END_TIME,'yyyy-MM-dd') = #{endTime}
      </if>
      <if test="createNo != null and createNo != ''">
        and CREATE_NO = #{createNo}
      </if>
      <if test="createName != null and createName != ''">
        and CREATE_NAME = #{createName}
      </if>
      <if test="result != null and result != ''">
        and RESULT = #{result}
      </if>
      <if test="valueFlag != null and valueFlag != ''">
        and VALUE_FLAG = #{valueFlag}
      </if>
      <if test="driverName != null and driverName != ''">
        and DRIVER_NAME = #{driverName}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="helpId != null and helpId != ''">
        and HELP_ID LIKE '%${helpId}%'
      </if>
      <if test="carNo != null and carNo != ''">
        and CAR_NO LIKE '%${carNo}%'
      </if>
      <if test="phoneNo != null and phoneNo != ''">
        and PHONE_NO LIKE '%${phoneNo}%'
      </if>
      <if test="createTime != null">
        and TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = #{createTime}
      </if>
      <if test="endTime != null">
        and TO_CHAR(END_TIME,'yyyy-MM-dd') = #{endTime}
      </if>
      <if test="createNo != null and createNo != ''">
        and CREATE_NO LIKE '%${createNo}%'
      </if>
      <if test="createName != null and createName != ''">
        and CREATE_NAME LIKE '%${createName}%'
      </if>
      <if test="result != null and result != ''">
        and RESULT LIKE '%${result}%'
      </if>
      <if test="valueFlag != null and valueFlag != ''">
        and VALUE_FLAG LIKE '%${valueFlag}%'
      </if>
      <if test="driverName != null and driverName != ''">
        and DRIVER_NAME LIKE '%${driverName}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from APP_PHONE_HELP
    where HELP_ID = #{helpId,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from APP_PHONE_HELP
    where 1!=1 
      <if test="carNo != null and carNo != ''">
        or CAR_NO = #{carNo}
      </if>
      <if test="phoneNo != null and phoneNo != ''">
        or PHONE_NO = #{phoneNo}
      </if>
      <if test="createTime != null">
        or TO_CHAR(CREATE_TIME,'yyyy-MM-dd') = '#{createTime}'
      </if>
      <if test="endTime != null">
        or TO_CHAR(END_TIME,'yyyy-MM-dd') = '#{endTime}'
      </if>
      <if test="createNo != null and createNo != ''">
        or CREATE_NO = #{createNo}
      </if>
      <if test="createName != null and createName != ''">
        or CREATE_NAME = #{createName}
      </if>
      <if test="result != null and result != ''">
        or RESULT = #{result}
      </if>
      <if test="valueFlag != null and valueFlag != ''">
        or VALUE_FLAG = #{valueFlag}
      </if>
      <if test="driverName != null and driverName != ''">
        or DRIVER_NAME = #{driverName}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.baseinfo.appphonehelp.model.AppPhoneHelp">
    insert into APP_PHONE_HELP (HELP_ID, CAR_NO, PHONE_NO, 
      CREATE_TIME, END_TIME, CREATE_NO, 
      CREATE_NAME, RESULT, VALUE_FLAG, 
      DRIVER_NAME)
    values (#{helpId,jdbcType=VARCHAR}, #{carNo,jdbcType=VARCHAR}, #{phoneNo,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{createNo,jdbcType=VARCHAR}, 
      #{createName,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR}, #{valueFlag,jdbcType=VARCHAR}, 
      #{driverName,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.baseinfo.appphonehelp.model.AppPhoneHelp">
    insert into APP_PHONE_HELP
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="helpId != null">
        HELP_ID,
      </if>
      <if test="carNo != null">
        CAR_NO,
      </if>
      <if test="phoneNo != null">
        PHONE_NO,
      </if>
      <if test="createTime != null">
        CREATE_TIME,
      </if>
      <if test="endTime != null">
        END_TIME,
      </if>
      <if test="createNo != null">
        CREATE_NO,
      </if>
      <if test="createName != null">
        CREATE_NAME,
      </if>
      <if test="result != null">
        RESULT,
      </if>
      <if test="valueFlag != null">
        VALUE_FLAG,
      </if>
      <if test="driverName != null">
        DRIVER_NAME,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="helpId != null">
        #{helpId,jdbcType=VARCHAR},
      </if>
      <if test="carNo != null">
        #{carNo,jdbcType=VARCHAR},
      </if>
      <if test="phoneNo != null">
        #{phoneNo,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createNo != null">
        #{createNo,jdbcType=VARCHAR},
      </if>
      <if test="createName != null">
        #{createName,jdbcType=VARCHAR},
      </if>
      <if test="result != null">
        #{result,jdbcType=VARCHAR},
      </if>
      <if test="valueFlag != null">
        #{valueFlag,jdbcType=VARCHAR},
      </if>
      <if test="driverName != null">
        #{driverName,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.baseinfo.appphonehelp.model.AppPhoneHelp">
    update APP_PHONE_HELP
    set CAR_NO = #{carNo,jdbcType=VARCHAR},
      PHONE_NO = #{phoneNo,jdbcType=VARCHAR},
      CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
      END_TIME = #{endTime,jdbcType=TIMESTAMP},
      CREATE_NO = #{createNo,jdbcType=VARCHAR},
      CREATE_NAME = #{createName,jdbcType=VARCHAR},
      RESULT = #{result,jdbcType=VARCHAR},
      VALUE_FLAG = #{valueFlag,jdbcType=VARCHAR},
      DRIVER_NAME = #{driverName,jdbcType=VARCHAR}
    where HELP_ID = #{helpId,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.baseinfo.appphonehelp.model.AppPhoneHelp">
    update APP_PHONE_HELP
    <set>
      <if test="carNo != null">
        CAR_NO = #{carNo,jdbcType=VARCHAR},
      </if>
      <if test="phoneNo != null">
        PHONE_NO = #{phoneNo,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        END_TIME = #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createNo != null">
        CREATE_NO = #{createNo,jdbcType=VARCHAR},
      </if>
      <if test="createName != null">
        CREATE_NAME = #{createName,jdbcType=VARCHAR},
      </if>
      <if test="result != null">
        RESULT = #{result,jdbcType=VARCHAR},
      </if>
      <if test="valueFlag != null">
        VALUE_FLAG = #{valueFlag,jdbcType=VARCHAR},
      </if>
      <if test="driverName != null">
        DRIVER_NAME = #{driverName,jdbcType=VARCHAR},
      </if>
    </set>
    where HELP_ID = #{helpId,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where HELP_ID = #{helpId,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 APP_PHONE_HELP 
      (HELP_ID, 
      CAR_NO, PHONE_NO, CREATE_TIME, 
      END_TIME, CREATE_NO, CREATE_NAME, 
      RESULT, VALUE_FLAG, DRIVER_NAME
      )
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.helpId,jdbcType=VARCHAR}, 
      #{item.carNo,jdbcType=VARCHAR}, #{item.phoneNo,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, 
      #{item.endTime,jdbcType=TIMESTAMP}, #{item.createNo,jdbcType=VARCHAR}, #{item.createName,jdbcType=VARCHAR}, 
      #{item.result,jdbcType=VARCHAR}, #{item.valueFlag,jdbcType=VARCHAR}, #{item.driverName,jdbcType=VARCHAR}
       from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update APP_PHONE_HELP
     set
       HELP_ID=
       <foreach collection="list" item="item" index="index" separator=" " open="case HELP_ID" close="end">
          when #{item.helpId,jdbcType=VARCHAR} then #{item.helpId,jdbcType=VARCHAR}
       </foreach>
       ,CAR_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case HELP_ID" close="end">
          when #{item.helpId,jdbcType=VARCHAR} then #{item.carNo,jdbcType=VARCHAR}
       </foreach>
       ,PHONE_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case HELP_ID" close="end">
          when #{item.helpId,jdbcType=VARCHAR} then #{item.phoneNo,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case HELP_ID" close="end">
          when #{item.helpId,jdbcType=VARCHAR} then #{item.createTime,jdbcType=TIMESTAMP}
       </foreach>
       ,END_TIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case HELP_ID" close="end">
          when #{item.helpId,jdbcType=VARCHAR} then #{item.endTime,jdbcType=TIMESTAMP}
       </foreach>
       ,CREATE_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case HELP_ID" close="end">
          when #{item.helpId,jdbcType=VARCHAR} then #{item.createNo,jdbcType=VARCHAR}
       </foreach>
       ,CREATE_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case HELP_ID" close="end">
          when #{item.helpId,jdbcType=VARCHAR} then #{item.createName,jdbcType=VARCHAR}
       </foreach>
       ,RESULT=
       <foreach collection="list" item="item" index="index" separator=" " open="case HELP_ID" close="end">
          when #{item.helpId,jdbcType=VARCHAR} then #{item.result,jdbcType=VARCHAR}
       </foreach>
       ,VALUE_FLAG=
       <foreach collection="list" item="item" index="index" separator=" " open="case HELP_ID" close="end">
          when #{item.helpId,jdbcType=VARCHAR} then #{item.valueFlag,jdbcType=VARCHAR}
       </foreach>
       ,DRIVER_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case HELP_ID" close="end">
          when #{item.helpId,jdbcType=VARCHAR} then #{item.driverName,jdbcType=VARCHAR}
       </foreach>
     where HELP_ID in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.helpId,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from APP_PHONE_HELP
    where HELP_ID in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->

  <select id="selectByMap" parameterType="java.util.Map" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="where"/>
  </select>
</mapper>