<?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.cab.dao.ValidationCodeMapper" >
  <resultMap id="BaseResultMap" type="com.cab.model.ValidationCode" >
    <id column="phone" property="phone" jdbcType="VARCHAR" />
    <result column="validation_code" property="validationCode" jdbcType="VARCHAR" />
    <result column="code_time" property="codeTime" jdbcType="TIMESTAMP" />
    <result column="apply_time" property="applyTime" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    phone, validation_code, code_time, apply_time
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select 
    <include refid="Base_Column_List" />
    from cab_validation_code
    where phone = #{phone,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    delete from cab_validation_code
    where phone = #{phone,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.cab.model.ValidationCode" >
    insert into cab_validation_code (phone, validation_code, code_time, apply_time
      )
    values (#{phone,jdbcType=VARCHAR}, #{validationCode,jdbcType=VARCHAR}, #{codeTime,jdbcType=TIMESTAMP}, #{applyTime,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.cab.model.ValidationCode" >
    insert into cab_validation_code
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="phone != null" >
        phone,
      </if>
      <if test="validationCode != null" >
        validation_code,
      </if>
      <if test="codeTime != null" >
        code_time,
      </if>
      <if test="applyTime != null" >
        apply_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="phone != null" >
        #{phone,jdbcType=VARCHAR},
      </if>
      <if test="validationCode != null" >
        #{validationCode,jdbcType=VARCHAR},
      </if>
      <if test="codeTime != null" >
        #{codeTime,jdbcType=TIMESTAMP},
      </if>
      <if test="applyTime != null" >
        #{applyTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.cab.model.ValidationCode" >
    update cab_validation_code
    <set >
      <if test="validationCode != null" >
        validation_code = #{validationCode,jdbcType=VARCHAR},
      </if>
      <if test="codeTime != null" >
        code_time = #{codeTime,jdbcType=TIMESTAMP},
      </if>
      <if test="applyTime != null" >
        apply_time = #{applyTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where phone = #{phone,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.cab.model.ValidationCode" >
    update cab_validation_code
    set validation_code = #{validationCode,jdbcType=VARCHAR},
      apply_time = #{applyTime,jdbcType=TIMESTAMP}, 
      code_time = #{codeTime,jdbcType=TIMESTAMP}
    where phone = #{phone,jdbcType=VARCHAR}
  </update>
</mapper>