<?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.fjs.scenic.mapper.order.ReceiptMapper">
  <resultMap id="BaseResultMap" type="com.fjs.scenic.entity.order.Receipt">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="type" jdbcType="VARCHAR" property="type" />
    <result column="head" jdbcType="VARCHAR" property="head" />
    <result column="number" jdbcType="VARCHAR" property="number" />
    <result column="content" jdbcType="VARCHAR" property="content" />
    <result column="price" jdbcType="DOUBLE" property="price" />
    <result column="email" jdbcType="VARCHAR" property="email" />
    <result column="order_id" jdbcType="INTEGER" property="orderId" />
  </resultMap>
  <sql id="Base_Column_List">
    id, type, head, number, content, price, email, order_id
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from receipt
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from receipt
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.fjs.scenic.entity.order.Receipt">
    insert into receipt (id, type, head, 
      number, content, price, 
      email, order_id)
    values (#{id,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR}, #{head,jdbcType=VARCHAR}, 
      #{number,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{price,jdbcType=DOUBLE}, 
      #{email,jdbcType=VARCHAR}, #{orderId,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.fjs.scenic.entity.order.Receipt">
    insert into receipt
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="type != null">
        type,
      </if>
      <if test="head != null">
        head,
      </if>
      <if test="number != null">
        number,
      </if>
      <if test="content != null">
        content,
      </if>
      <if test="price != null">
        price,
      </if>
      <if test="email != null">
        email,
      </if>
      <if test="orderId != null">
        order_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="type != null">
        #{type,jdbcType=VARCHAR},
      </if>
      <if test="head != null">
        #{head,jdbcType=VARCHAR},
      </if>
      <if test="number != null">
        #{number,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        #{content,jdbcType=VARCHAR},
      </if>
      <if test="price != null">
        #{price,jdbcType=DOUBLE},
      </if>
      <if test="email != null">
        #{email,jdbcType=VARCHAR},
      </if>
      <if test="orderId != null">
        #{orderId,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.fjs.scenic.entity.order.Receipt">
    update receipt
    <set>
      <if test="type != null">
        type = #{type,jdbcType=VARCHAR},
      </if>
      <if test="head != null">
        head = #{head,jdbcType=VARCHAR},
      </if>
      <if test="number != null">
        number = #{number,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        content = #{content,jdbcType=VARCHAR},
      </if>
      <if test="price != null">
        price = #{price,jdbcType=DOUBLE},
      </if>
      <if test="email != null">
        email = #{email,jdbcType=VARCHAR},
      </if>
      <if test="orderId != null">
        order_id = #{orderId,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fjs.scenic.entity.order.Receipt">
    update receipt
    set type = #{type,jdbcType=VARCHAR},
      head = #{head,jdbcType=VARCHAR},
      number = #{number,jdbcType=VARCHAR},
      content = #{content,jdbcType=VARCHAR},
      price = #{price,jdbcType=DOUBLE},
      email = #{email,jdbcType=VARCHAR},
      order_id = #{orderId,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>