<?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.goafanti.common.dao.ConsultOrderMapper">
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.ConsultOrder">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="price" jdbcType="DOUBLE" property="price" />
    <result column="order_state" jdbcType="INTEGER" property="orderState" />
    <result column="order_time" jdbcType="TIMESTAMP" property="orderTime" />
    <result column="user_id" jdbcType="VARCHAR" property="userId" />
    <result column="to_user_id" jdbcType="VARCHAR" property="toUserId" />
    <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime" />
    <result column="payment_value" jdbcType="DOUBLE" property="paymentValue" />
    <result column="payment_type" jdbcType="VARCHAR" property="paymentType" />
    <result column="payment_id" jdbcType="VARCHAR" property="paymentId" />
  </resultMap>
  <sql id="Base_Column_List">
    id, price, order_state, order_time, user_id, to_user_id, payment_time, payment_value, 
    payment_type, payment_id
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from consult_order
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from consult_order
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.goafanti.common.model.ConsultOrder">
    insert into consult_order (id, price, order_state, 
      order_time, user_id, to_user_id, 
      payment_time, payment_value, payment_type, 
      payment_id)
    values (#{id,jdbcType=BIGINT}, #{price,jdbcType=DOUBLE}, #{orderState,jdbcType=INTEGER}, 
      #{orderTime,jdbcType=TIMESTAMP}, #{userId,jdbcType=VARCHAR}, #{toUserId,jdbcType=VARCHAR}, 
      #{paymentTime,jdbcType=TIMESTAMP}, #{paymentValue,jdbcType=DOUBLE}, #{paymentType,jdbcType=VARCHAR}, 
      #{paymentId,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.goafanti.common.model.ConsultOrder">
    insert into consult_order
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="price != null">
        price,
      </if>
      <if test="orderState != null">
        order_state,
      </if>
      <if test="orderTime != null">
        order_time,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="toUserId != null">
        to_user_id,
      </if>
      <if test="paymentTime != null">
        payment_time,
      </if>
      <if test="paymentValue != null">
        payment_value,
      </if>
      <if test="paymentType != null">
        payment_type,
      </if>
      <if test="paymentId != null">
        payment_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="price != null">
        #{price,jdbcType=DOUBLE},
      </if>
      <if test="orderState != null">
        #{orderState,jdbcType=INTEGER},
      </if>
      <if test="orderTime != null">
        #{orderTime,jdbcType=TIMESTAMP},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=VARCHAR},
      </if>
      <if test="toUserId != null">
        #{toUserId,jdbcType=VARCHAR},
      </if>
      <if test="paymentTime != null">
        #{paymentTime,jdbcType=TIMESTAMP},
      </if>
      <if test="paymentValue != null">
        #{paymentValue,jdbcType=DOUBLE},
      </if>
      <if test="paymentType != null">
        #{paymentType,jdbcType=VARCHAR},
      </if>
      <if test="paymentId != null">
        #{paymentId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ConsultOrder">
    update consult_order
    <set>
      <if test="price != null">
        price = #{price,jdbcType=DOUBLE},
      </if>
      <if test="orderState != null">
        order_state = #{orderState,jdbcType=INTEGER},
      </if>
      <if test="orderTime != null">
        order_time = #{orderTime,jdbcType=TIMESTAMP},
      </if>
      <if test="userId != null">
        user_id = #{userId,jdbcType=VARCHAR},
      </if>
      <if test="toUserId != null">
        to_user_id = #{toUserId,jdbcType=VARCHAR},
      </if>
      <if test="paymentTime != null">
        payment_time = #{paymentTime,jdbcType=TIMESTAMP},
      </if>
      <if test="paymentValue != null">
        payment_value = #{paymentValue,jdbcType=DOUBLE},
      </if>
      <if test="paymentType != null">
        payment_type = #{paymentType,jdbcType=VARCHAR},
      </if>
      <if test="paymentId != null">
        payment_id = #{paymentId,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.ConsultOrder">
    update consult_order
    set price = #{price,jdbcType=DOUBLE},
      order_state = #{orderState,jdbcType=INTEGER},
      order_time = #{orderTime,jdbcType=TIMESTAMP},
      user_id = #{userId,jdbcType=VARCHAR},
      to_user_id = #{toUserId,jdbcType=VARCHAR},
      payment_time = #{paymentTime,jdbcType=TIMESTAMP},
      payment_value = #{paymentValue,jdbcType=DOUBLE},
      payment_type = #{paymentType,jdbcType=VARCHAR},
      payment_id = #{paymentId,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>