<?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="org.linlinjava.jz.db.dao.JzOrderMapper">
  <resultMap id="BaseResultMap" type="org.linlinjava.jz.db.domain.JzOrder">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="user_id" jdbcType="INTEGER" property="userId" />
    <result column="order_sn" jdbcType="VARCHAR" property="orderSn" />
    <result column="order_status" jdbcType="SMALLINT" property="orderStatus" />
    <result column="order_channel" jdbcType="INTEGER" property="orderChannel" />
    <result column="order_shop_id" jdbcType="INTEGER" property="orderShopId" />
    <result column="order_date" jdbcType="VARCHAR" property="orderDate" />
    <result column="aftersale_status" jdbcType="SMALLINT" property="aftersaleStatus" />
    <result column="consignee" jdbcType="VARCHAR" property="consignee" />
    <result column="mobile" jdbcType="VARCHAR" property="mobile" />
    <result column="address" jdbcType="VARCHAR" property="address" />
    <result column="address_id" jdbcType="INTEGER" property="addressId" />
    <result column="message" jdbcType="VARCHAR" property="message" />
    <result column="goods_price" jdbcType="DECIMAL" property="goodsPrice" />
    <result column="freight_price" jdbcType="DECIMAL" property="freightPrice" />
    <result column="coupon_price" jdbcType="DECIMAL" property="couponPrice" />
    <result column="integral_price" jdbcType="DECIMAL" property="integralPrice" />
    <result column="groupon_price" jdbcType="DECIMAL" property="grouponPrice" />
    <result column="order_price" jdbcType="DECIMAL" property="orderPrice" />
    <result column="actual_price" jdbcType="DECIMAL" property="actualPrice" />
    <result column="pay_id" jdbcType="VARCHAR" property="payId" />
    <result column="pay_time" jdbcType="TIMESTAMP" property="payTime" />
    <result column="ship_sn" jdbcType="VARCHAR" property="shipSn" />
    <result column="ship_channel" jdbcType="VARCHAR" property="shipChannel" />
    <result column="ship_time" jdbcType="TIMESTAMP" property="shipTime" />
    <result column="refund_amount" jdbcType="DECIMAL" property="refundAmount" />
    <result column="refund_type" jdbcType="VARCHAR" property="refundType" />
    <result column="refund_content" jdbcType="VARCHAR" property="refundContent" />
    <result column="refund_time" jdbcType="TIMESTAMP" property="refundTime" />
    <result column="confirm_time" jdbcType="TIMESTAMP" property="confirmTime" />
    <result column="comments" jdbcType="SMALLINT" property="comments" />
    <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="import_time" jdbcType="TIMESTAMP" property="importTime" />
    <result column="deleted" jdbcType="BIT" property="deleted" />
    <result column="comment_time" jdbcType="TIMESTAMP" property="commentTime" />
    <association property="shop" column="order_shop_id" javaType="org.linlinjava.jz.db.domain.JzShop" select="getShop"/>
  </resultMap>

    <!--购买商品信息-->
  <select id="getShop" parameterType="java.lang.Integer" resultMap="BaseResultMap2">
    select
    id, shop_no, shop_name    from jz_shop   where id = #{order_shop_id,jdbcType=INTEGER}
  </select>
  <resultMap id="BaseResultMap2" type="org.linlinjava.jz.db.domain.JzShop">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="shop_name" jdbcType="VARCHAR" property="shopName" />
  </resultMap>


  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    id, user_id, order_sn, order_status, order_channel, order_shop_id, order_date, aftersale_status, 
    consignee, mobile, address, address_id, message, goods_price, freight_price, coupon_price, 
    integral_price, groupon_price, order_price, actual_price, pay_id, pay_time, ship_sn, 
    ship_channel, ship_time, refund_amount, refund_type, refund_content, refund_time, 
    confirm_time, comments, end_time, create_time, update_time, import_time, deleted, 
    comment_time
  </sql>
  <select id="selectByExample" parameterType="org.linlinjava.jz.db.domain.JzOrderExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from jz_order
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="example != null and example.distinct">
      distinct
    </if>
    <choose>
      <when test="selective != null and selective.length &gt; 0">
        <foreach collection="selective" item="column" separator=",">
          ${column.aliasedEscapedColumnName}
        </foreach>
      </when>
      <otherwise>
        <include refid="Base_Column_List" />
      </otherwise>
    </choose>
    from jz_order
    <if test="example != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
    <if test="example != null and example.orderByClause != null">
      order by ${example.orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from jz_order
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectByPrimaryKeyWithLogicalDelete" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from jz_order
    where id = #{id,jdbcType=INTEGER}
      and deleted = 
    <choose>
      <when test="andLogicalDeleted">
        1
      </when>
      <otherwise>
        0
      </otherwise>
    </choose>
  </select>
  <select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <choose>
      <when test="selective != null and selective.length &gt; 0">
        <foreach collection="selective" item="column" separator=",">
          ${column.aliasedEscapedColumnName}
        </foreach>
      </when>
      <otherwise>
        <include refid="Base_Column_List" />
      </otherwise>
    </choose>
    from jz_order
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from jz_order
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="org.linlinjava.jz.db.domain.JzOrderExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from jz_order
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="org.linlinjava.jz.db.domain.JzOrder">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into jz_order (user_id, order_sn, order_status, 
      order_channel, order_shop_id, order_date, 
      aftersale_status, consignee, mobile, 
      address, address_id, message, 
      goods_price, freight_price, coupon_price, 
      integral_price, groupon_price, order_price, 
      actual_price, pay_id, pay_time, 
      ship_sn, ship_channel, ship_time, 
      refund_amount, refund_type, refund_content, 
      refund_time, confirm_time, comments, 
      end_time, create_time, update_time, 
      import_time, deleted, comment_time
      )
    values (#{userId,jdbcType=INTEGER}, #{orderSn,jdbcType=VARCHAR}, #{orderStatus,jdbcType=SMALLINT}, 
      #{orderChannel,jdbcType=INTEGER}, #{orderShopId,jdbcType=INTEGER}, #{orderDate,jdbcType=VARCHAR}, 
      #{aftersaleStatus,jdbcType=SMALLINT}, #{consignee,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, 
      #{address,jdbcType=VARCHAR}, #{addressId,jdbcType=INTEGER}, #{message,jdbcType=VARCHAR}, 
      #{goodsPrice,jdbcType=DECIMAL}, #{freightPrice,jdbcType=DECIMAL}, #{couponPrice,jdbcType=DECIMAL}, 
      #{integralPrice,jdbcType=DECIMAL}, #{grouponPrice,jdbcType=DECIMAL}, #{orderPrice,jdbcType=DECIMAL}, 
      #{actualPrice,jdbcType=DECIMAL}, #{payId,jdbcType=VARCHAR}, #{payTime,jdbcType=TIMESTAMP}, 
      #{shipSn,jdbcType=VARCHAR}, #{shipChannel,jdbcType=VARCHAR}, #{shipTime,jdbcType=TIMESTAMP}, 
      #{refundAmount,jdbcType=DECIMAL}, #{refundType,jdbcType=VARCHAR}, #{refundContent,jdbcType=VARCHAR}, 
      #{refundTime,jdbcType=TIMESTAMP}, #{confirmTime,jdbcType=TIMESTAMP}, #{comments,jdbcType=SMALLINT}, 
      #{endTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, 
      #{importTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}, #{commentTime,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="org.linlinjava.jz.db.domain.JzOrder">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into jz_order
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        user_id,
      </if>
      <if test="orderSn != null">
        order_sn,
      </if>
      <if test="orderStatus != null">
        order_status,
      </if>
      <if test="orderChannel != null">
        order_channel,
      </if>
      <if test="orderShopId != null">
        order_shop_id,
      </if>
      <if test="orderDate != null">
        order_date,
      </if>
      <if test="aftersaleStatus != null">
        aftersale_status,
      </if>
      <if test="consignee != null">
        consignee,
      </if>
      <if test="mobile != null">
        mobile,
      </if>
      <if test="address != null">
        address,
      </if>
      <if test="addressId != null">
        address_id,
      </if>
      <if test="message != null">
        message,
      </if>
      <if test="goodsPrice != null">
        goods_price,
      </if>
      <if test="freightPrice != null">
        freight_price,
      </if>
      <if test="couponPrice != null">
        coupon_price,
      </if>
      <if test="integralPrice != null">
        integral_price,
      </if>
      <if test="grouponPrice != null">
        groupon_price,
      </if>
      <if test="orderPrice != null">
        order_price,
      </if>
      <if test="actualPrice != null">
        actual_price,
      </if>
      <if test="payId != null">
        pay_id,
      </if>
      <if test="payTime != null">
        pay_time,
      </if>
      <if test="shipSn != null">
        ship_sn,
      </if>
      <if test="shipChannel != null">
        ship_channel,
      </if>
      <if test="shipTime != null">
        ship_time,
      </if>
      <if test="refundAmount != null">
        refund_amount,
      </if>
      <if test="refundType != null">
        refund_type,
      </if>
      <if test="refundContent != null">
        refund_content,
      </if>
      <if test="refundTime != null">
        refund_time,
      </if>
      <if test="confirmTime != null">
        confirm_time,
      </if>
      <if test="comments != null">
        comments,
      </if>
      <if test="endTime != null">
        end_time,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="importTime != null">
        import_time,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
      <if test="commentTime != null">
        comment_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="orderSn != null">
        #{orderSn,jdbcType=VARCHAR},
      </if>
      <if test="orderStatus != null">
        #{orderStatus,jdbcType=SMALLINT},
      </if>
      <if test="orderChannel != null">
        #{orderChannel,jdbcType=INTEGER},
      </if>
      <if test="orderShopId != null">
        #{orderShopId,jdbcType=INTEGER},
      </if>
      <if test="orderDate != null">
        #{orderDate,jdbcType=VARCHAR},
      </if>
      <if test="aftersaleStatus != null">
        #{aftersaleStatus,jdbcType=SMALLINT},
      </if>
      <if test="consignee != null">
        #{consignee,jdbcType=VARCHAR},
      </if>
      <if test="mobile != null">
        #{mobile,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="addressId != null">
        #{addressId,jdbcType=INTEGER},
      </if>
      <if test="message != null">
        #{message,jdbcType=VARCHAR},
      </if>
      <if test="goodsPrice != null">
        #{goodsPrice,jdbcType=DECIMAL},
      </if>
      <if test="freightPrice != null">
        #{freightPrice,jdbcType=DECIMAL},
      </if>
      <if test="couponPrice != null">
        #{couponPrice,jdbcType=DECIMAL},
      </if>
      <if test="integralPrice != null">
        #{integralPrice,jdbcType=DECIMAL},
      </if>
      <if test="grouponPrice != null">
        #{grouponPrice,jdbcType=DECIMAL},
      </if>
      <if test="orderPrice != null">
        #{orderPrice,jdbcType=DECIMAL},
      </if>
      <if test="actualPrice != null">
        #{actualPrice,jdbcType=DECIMAL},
      </if>
      <if test="payId != null">
        #{payId,jdbcType=VARCHAR},
      </if>
      <if test="payTime != null">
        #{payTime,jdbcType=TIMESTAMP},
      </if>
      <if test="shipSn != null">
        #{shipSn,jdbcType=VARCHAR},
      </if>
      <if test="shipChannel != null">
        #{shipChannel,jdbcType=VARCHAR},
      </if>
      <if test="shipTime != null">
        #{shipTime,jdbcType=TIMESTAMP},
      </if>
      <if test="refundAmount != null">
        #{refundAmount,jdbcType=DECIMAL},
      </if>
      <if test="refundType != null">
        #{refundType,jdbcType=VARCHAR},
      </if>
      <if test="refundContent != null">
        #{refundContent,jdbcType=VARCHAR},
      </if>
      <if test="refundTime != null">
        #{refundTime,jdbcType=TIMESTAMP},
      </if>
      <if test="confirmTime != null">
        #{confirmTime,jdbcType=TIMESTAMP},
      </if>
      <if test="comments != null">
        #{comments,jdbcType=SMALLINT},
      </if>
      <if test="endTime != null">
        #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="importTime != null">
        #{importTime,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=BIT},
      </if>
      <if test="commentTime != null">
        #{commentTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="org.linlinjava.jz.db.domain.JzOrderExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from jz_order
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jz_order
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.userId != null">
        user_id = #{record.userId,jdbcType=INTEGER},
      </if>
      <if test="record.orderSn != null">
        order_sn = #{record.orderSn,jdbcType=VARCHAR},
      </if>
      <if test="record.orderStatus != null">
        order_status = #{record.orderStatus,jdbcType=SMALLINT},
      </if>
      <if test="record.orderChannel != null">
        order_channel = #{record.orderChannel,jdbcType=INTEGER},
      </if>
      <if test="record.orderShopId != null">
        order_shop_id = #{record.orderShopId,jdbcType=INTEGER},
      </if>
      <if test="record.orderDate != null">
        order_date = #{record.orderDate,jdbcType=VARCHAR},
      </if>
      <if test="record.aftersaleStatus != null">
        aftersale_status = #{record.aftersaleStatus,jdbcType=SMALLINT},
      </if>
      <if test="record.consignee != null">
        consignee = #{record.consignee,jdbcType=VARCHAR},
      </if>
      <if test="record.mobile != null">
        mobile = #{record.mobile,jdbcType=VARCHAR},
      </if>
      <if test="record.address != null">
        address = #{record.address,jdbcType=VARCHAR},
      </if>
      <if test="record.addressId != null">
        address_id = #{record.addressId,jdbcType=INTEGER},
      </if>
      <if test="record.message != null">
        message = #{record.message,jdbcType=VARCHAR},
      </if>
      <if test="record.goodsPrice != null">
        goods_price = #{record.goodsPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.freightPrice != null">
        freight_price = #{record.freightPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.couponPrice != null">
        coupon_price = #{record.couponPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.integralPrice != null">
        integral_price = #{record.integralPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.grouponPrice != null">
        groupon_price = #{record.grouponPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.orderPrice != null">
        order_price = #{record.orderPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.actualPrice != null">
        actual_price = #{record.actualPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.payId != null">
        pay_id = #{record.payId,jdbcType=VARCHAR},
      </if>
      <if test="record.payTime != null">
        pay_time = #{record.payTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.shipSn != null">
        ship_sn = #{record.shipSn,jdbcType=VARCHAR},
      </if>
      <if test="record.shipChannel != null">
        ship_channel = #{record.shipChannel,jdbcType=VARCHAR},
      </if>
      <if test="record.shipTime != null">
        ship_time = #{record.shipTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.refundAmount != null">
        refund_amount = #{record.refundAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.refundType != null">
        refund_type = #{record.refundType,jdbcType=VARCHAR},
      </if>
      <if test="record.refundContent != null">
        refund_content = #{record.refundContent,jdbcType=VARCHAR},
      </if>
      <if test="record.refundTime != null">
        refund_time = #{record.refundTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.confirmTime != null">
        confirm_time = #{record.confirmTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.comments != null">
        comments = #{record.comments,jdbcType=SMALLINT},
      </if>
      <if test="record.endTime != null">
        end_time = #{record.endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.importTime != null">
        import_time = #{record.importTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.deleted != null">
        deleted = #{record.deleted,jdbcType=BIT},
      </if>
      <if test="record.commentTime != null">
        comment_time = #{record.commentTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jz_order
    set id = #{record.id,jdbcType=INTEGER},
      user_id = #{record.userId,jdbcType=INTEGER},
      order_sn = #{record.orderSn,jdbcType=VARCHAR},
      order_status = #{record.orderStatus,jdbcType=SMALLINT},
      order_channel = #{record.orderChannel,jdbcType=INTEGER},
      order_shop_id = #{record.orderShopId,jdbcType=INTEGER},
      order_date = #{record.orderDate,jdbcType=VARCHAR},
      aftersale_status = #{record.aftersaleStatus,jdbcType=SMALLINT},
      consignee = #{record.consignee,jdbcType=VARCHAR},
      mobile = #{record.mobile,jdbcType=VARCHAR},
      address = #{record.address,jdbcType=VARCHAR},
      address_id = #{record.addressId,jdbcType=INTEGER},
      message = #{record.message,jdbcType=VARCHAR},
      goods_price = #{record.goodsPrice,jdbcType=DECIMAL},
      freight_price = #{record.freightPrice,jdbcType=DECIMAL},
      coupon_price = #{record.couponPrice,jdbcType=DECIMAL},
      integral_price = #{record.integralPrice,jdbcType=DECIMAL},
      groupon_price = #{record.grouponPrice,jdbcType=DECIMAL},
      order_price = #{record.orderPrice,jdbcType=DECIMAL},
      actual_price = #{record.actualPrice,jdbcType=DECIMAL},
      pay_id = #{record.payId,jdbcType=VARCHAR},
      pay_time = #{record.payTime,jdbcType=TIMESTAMP},
      ship_sn = #{record.shipSn,jdbcType=VARCHAR},
      ship_channel = #{record.shipChannel,jdbcType=VARCHAR},
      ship_time = #{record.shipTime,jdbcType=TIMESTAMP},
      refund_amount = #{record.refundAmount,jdbcType=DECIMAL},
      refund_type = #{record.refundType,jdbcType=VARCHAR},
      refund_content = #{record.refundContent,jdbcType=VARCHAR},
      refund_time = #{record.refundTime,jdbcType=TIMESTAMP},
      confirm_time = #{record.confirmTime,jdbcType=TIMESTAMP},
      comments = #{record.comments,jdbcType=SMALLINT},
      end_time = #{record.endTime,jdbcType=TIMESTAMP},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      import_time = #{record.importTime,jdbcType=TIMESTAMP},
      deleted = #{record.deleted,jdbcType=BIT},
      comment_time = #{record.commentTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="org.linlinjava.jz.db.domain.JzOrder">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jz_order
    <set>
      <if test="userId != null">
        user_id = #{userId,jdbcType=INTEGER},
      </if>
      <if test="orderSn != null">
        order_sn = #{orderSn,jdbcType=VARCHAR},
      </if>
      <if test="orderStatus != null">
        order_status = #{orderStatus,jdbcType=SMALLINT},
      </if>
      <if test="orderChannel != null">
        order_channel = #{orderChannel,jdbcType=INTEGER},
      </if>
      <if test="orderShopId != null">
        order_shop_id = #{orderShopId,jdbcType=INTEGER},
      </if>
      <if test="orderDate != null">
        order_date = #{orderDate,jdbcType=VARCHAR},
      </if>
      <if test="aftersaleStatus != null">
        aftersale_status = #{aftersaleStatus,jdbcType=SMALLINT},
      </if>
      <if test="consignee != null">
        consignee = #{consignee,jdbcType=VARCHAR},
      </if>
      <if test="mobile != null">
        mobile = #{mobile,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        address = #{address,jdbcType=VARCHAR},
      </if>
      <if test="addressId != null">
        address_id = #{addressId,jdbcType=INTEGER},
      </if>
      <if test="message != null">
        message = #{message,jdbcType=VARCHAR},
      </if>
      <if test="goodsPrice != null">
        goods_price = #{goodsPrice,jdbcType=DECIMAL},
      </if>
      <if test="freightPrice != null">
        freight_price = #{freightPrice,jdbcType=DECIMAL},
      </if>
      <if test="couponPrice != null">
        coupon_price = #{couponPrice,jdbcType=DECIMAL},
      </if>
      <if test="integralPrice != null">
        integral_price = #{integralPrice,jdbcType=DECIMAL},
      </if>
      <if test="grouponPrice != null">
        groupon_price = #{grouponPrice,jdbcType=DECIMAL},
      </if>
      <if test="orderPrice != null">
        order_price = #{orderPrice,jdbcType=DECIMAL},
      </if>
      <if test="actualPrice != null">
        actual_price = #{actualPrice,jdbcType=DECIMAL},
      </if>
      <if test="payId != null">
        pay_id = #{payId,jdbcType=VARCHAR},
      </if>
      <if test="payTime != null">
        pay_time = #{payTime,jdbcType=TIMESTAMP},
      </if>
      <if test="shipSn != null">
        ship_sn = #{shipSn,jdbcType=VARCHAR},
      </if>
      <if test="shipChannel != null">
        ship_channel = #{shipChannel,jdbcType=VARCHAR},
      </if>
      <if test="shipTime != null">
        ship_time = #{shipTime,jdbcType=TIMESTAMP},
      </if>
      <if test="refundAmount != null">
        refund_amount = #{refundAmount,jdbcType=DECIMAL},
      </if>
      <if test="refundType != null">
        refund_type = #{refundType,jdbcType=VARCHAR},
      </if>
      <if test="refundContent != null">
        refund_content = #{refundContent,jdbcType=VARCHAR},
      </if>
      <if test="refundTime != null">
        refund_time = #{refundTime,jdbcType=TIMESTAMP},
      </if>
      <if test="confirmTime != null">
        confirm_time = #{confirmTime,jdbcType=TIMESTAMP},
      </if>
      <if test="comments != null">
        comments = #{comments,jdbcType=SMALLINT},
      </if>
      <if test="endTime != null">
        end_time = #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="importTime != null">
        import_time = #{importTime,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=BIT},
      </if>
      <if test="commentTime != null">
        comment_time = #{commentTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="org.linlinjava.jz.db.domain.JzOrder">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jz_order
    set user_id = #{userId,jdbcType=INTEGER},
      order_sn = #{orderSn,jdbcType=VARCHAR},
      order_status = #{orderStatus,jdbcType=SMALLINT},
      order_channel = #{orderChannel,jdbcType=INTEGER},
      order_shop_id = #{orderShopId,jdbcType=INTEGER},
      order_date = #{orderDate,jdbcType=VARCHAR},
      aftersale_status = #{aftersaleStatus,jdbcType=SMALLINT},
      consignee = #{consignee,jdbcType=VARCHAR},
      mobile = #{mobile,jdbcType=VARCHAR},
      address = #{address,jdbcType=VARCHAR},
      address_id = #{addressId,jdbcType=INTEGER},
      message = #{message,jdbcType=VARCHAR},
      goods_price = #{goodsPrice,jdbcType=DECIMAL},
      freight_price = #{freightPrice,jdbcType=DECIMAL},
      coupon_price = #{couponPrice,jdbcType=DECIMAL},
      integral_price = #{integralPrice,jdbcType=DECIMAL},
      groupon_price = #{grouponPrice,jdbcType=DECIMAL},
      order_price = #{orderPrice,jdbcType=DECIMAL},
      actual_price = #{actualPrice,jdbcType=DECIMAL},
      pay_id = #{payId,jdbcType=VARCHAR},
      pay_time = #{payTime,jdbcType=TIMESTAMP},
      ship_sn = #{shipSn,jdbcType=VARCHAR},
      ship_channel = #{shipChannel,jdbcType=VARCHAR},
      ship_time = #{shipTime,jdbcType=TIMESTAMP},
      refund_amount = #{refundAmount,jdbcType=DECIMAL},
      refund_type = #{refundType,jdbcType=VARCHAR},
      refund_content = #{refundContent,jdbcType=VARCHAR},
      refund_time = #{refundTime,jdbcType=TIMESTAMP},
      confirm_time = #{confirmTime,jdbcType=TIMESTAMP},
      comments = #{comments,jdbcType=SMALLINT},
      end_time = #{endTime,jdbcType=TIMESTAMP},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      import_time = #{importTime,jdbcType=TIMESTAMP},
      deleted = #{deleted,jdbcType=BIT},
      comment_time = #{commentTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="selectOneByExample" parameterType="org.linlinjava.jz.db.domain.JzOrderExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <include refid="Base_Column_List" />
    from jz_order
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    limit 1
  </select>
  <select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <choose>
      <when test="selective != null and selective.length &gt; 0">
        <foreach collection="selective" item="column" separator=",">
          ${column.aliasedEscapedColumnName}
        </foreach>
      </when>
      <otherwise>
        <include refid="Base_Column_List" />
      </otherwise>
    </choose>
    from jz_order
    <if test="example != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
    <if test="example != null and example.orderByClause != null">
      order by ${example.orderByClause}
    </if>
    limit 1
  </select>
  <update id="logicalDeleteByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jz_order set deleted = 1
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="logicalDeleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jz_order set deleted = 1
    where id = #{id,jdbcType=INTEGER}
  </update>


  <select id="getGoods" parameterType="java.lang.Integer" resultMap="BaseOrderGoods">
    select id,goods_id,goods_name,goods_sn,product_id,pic_url,number,price from jz_order_goods where order_id= #{id,jdbcType=INTEGER}
  </select>

  <resultMap id="BaseOrderGoods" type="org.linlinjava.jz.db.domain.JzOrderGoods">
    <result column="id" jdbcType="INTEGER" property="id" />
    <result column="goods_id" jdbcType="INTEGER" property="goodsId" />
    <result column="goods_name" jdbcType="VARCHAR" property="goodsName" />
    <result column="goods_sn" jdbcType="VARCHAR" property="goodsSn" />
    <result column="product_id" jdbcType="INTEGER" property="productId" />
    <result column="number" jdbcType="SMALLINT" property="number" />
    <result column="price" jdbcType="DECIMAL" property="price" />
    <result column="pic_url" jdbcType="VARCHAR" property="picUrl" />
    <association column="goods_id" javaType="org.linlinjava.jz.db.domain.JzGoods" property="goods" select="getBaseGoods" />
  </resultMap>

  <select id="getBaseGoods" parameterType="java.lang.Integer" resultMap="BaseGoodMap3">
    select
    id, goods_sn, `name`,unit
    from jz_goods
    where id = #{goods_id,jdbcType=INTEGER}
  </select>
  <resultMap id="BaseGoodMap3" type="org.linlinjava.jz.db.domain.JzGoods">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="goods_sn" jdbcType="VARCHAR" property="goodsSn" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="unit" jdbcType="VARCHAR" property="unit" />
  </resultMap>

  <resultMap id="BaseResultMap1" type="org.linlinjava.jz.db.domain.CustomerClient">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="customer_name" jdbcType="VARCHAR" property="customerName" />
    <result column="nickname" jdbcType="VARCHAR" property="nickname" />
    <result column="tel" jdbcType="VARCHAR" property="tel" />
    <result column="customer_idcard" jdbcType="VARCHAR" property="customerIdcard" />
    <result column="state" jdbcType="INTEGER" property="state" />
  </resultMap>
  <select id="getUser" parameterType="java.lang.Integer" resultMap="BaseResultMap1">
    select
    id, customer_name,
    nickname, tel,customer_idcard
    from customer_client
    where id = #{id,jdbcType=INTEGER}
  </select>

</mapper>