<?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.fuxi.ws.data.dao.EshoporderdetailMapper">
  <resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.Eshoporderdetail">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    <id column="EShopOrderDetailID" jdbcType="BIGINT" property="eshoporderdetailid" />
    <result column="EShopOrderID" jdbcType="INTEGER" property="eshoporderid" />
    <result column="SN" jdbcType="INTEGER" property="sn" />
    <result column="outer_iid" jdbcType="VARCHAR" property="outerIid" />
    <result column="outer_sku_id" jdbcType="VARCHAR" property="outerSkuId" />
    <result column="num_iid" jdbcType="BIGINT" property="numIid" />
    <result column="sku_iid" jdbcType="BIGINT" property="skuIid" />
    <result column="sku_properties_name" jdbcType="VARCHAR" property="skuPropertiesName" />
    <result column="Quantity" jdbcType="INTEGER" property="quantity" />
    <result column="UnitPrice" jdbcType="DECIMAL" property="unitprice" />
    <result column="DiscountRate" jdbcType="DECIMAL" property="discountrate" />
    <result column="Discount" jdbcType="DECIMAL" property="discount" />
    <result column="Amount" jdbcType="DECIMAL" property="amount" />
    <result column="oid" jdbcType="BIGINT" property="oid" />
    <result column="payment" jdbcType="DECIMAL" property="payment" />
    <result column="adjust_fee" jdbcType="DECIMAL" property="adjustFee" />
    <result column="discount_fee" jdbcType="DECIMAL" property="discountFee" />
    <result column="seller_type" jdbcType="VARCHAR" property="sellerType" />
    <result column="EmployeeID" jdbcType="VARCHAR" property="employeeid" />
    <result column="Memo" jdbcType="VARCHAR" property="memo" />
    <result column="GoodsID" jdbcType="VARCHAR" property="goodsid" />
    <result column="ColorID" jdbcType="VARCHAR" property="colorid" />
    <result column="SizeID" jdbcType="VARCHAR" property="sizeid" />
    <result column="RetailSales" jdbcType="DECIMAL" property="retailsales" />
    <result column="RetailAmount" jdbcType="DECIMAL" property="retailamount" />
    <result column="warehouseid" jdbcType="VARCHAR" property="warehouseid" />
    <result column="sendQuantity" jdbcType="INTEGER" property="sendquantity" />
    <result column="ReturnQty" jdbcType="INTEGER" property="returnqty" />
    <result column="Refund" jdbcType="DECIMAL" property="refund" />
    <result column="RefundReason" jdbcType="NVARCHAR" property="refundreason" />
    <result column="Refunder" jdbcType="NVARCHAR" property="refunder" />
    <result column="RefundDate" jdbcType="TIMESTAMP" property="refunddate" />
    <result column="AllotSales" jdbcType="DECIMAL" property="allotsales" />
    <result column="SendTimes" jdbcType="DECIMAL" property="sendtimes" />
    <result column="SendPoint" jdbcType="INTEGER" property="sendpoint" />
    <result column="Integral" jdbcType="INTEGER" property="integral" />
    <result column="PurchaseAmount" jdbcType="DECIMAL" property="purchaseamount" />
    <result column="DeductionPoint" jdbcType="DECIMAL" property="deductionpoint" />
    <result column="BarCode" jdbcType="VARCHAR" property="barcode" />
    <result column="PackageNum" jdbcType="INTEGER" property="packagenum" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    <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 - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    <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 - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    EShopOrderDetailID, EShopOrderID, SN, outer_iid, outer_sku_id, num_iid, sku_iid, 
    sku_properties_name, Quantity, UnitPrice, DiscountRate, Discount, Amount, oid, payment, 
    adjust_fee, discount_fee, seller_type, EmployeeID, Memo, GoodsID, ColorID, SizeID, 
    RetailSales, RetailAmount, warehouseid, sendQuantity, ReturnQty, Refund, RefundReason, 
    Refunder, RefundDate, AllotSales, SendTimes, SendPoint, Integral, PurchaseAmount, 
    DeductionPoint, BarCode, PackageNum
  </sql>
  <select id="selectByExample" parameterType="com.fuxi.ws.data.entity.EshoporderdetailExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    'true' as QUERYID,
    <include refid="Base_Column_List" />
    from EShopOrderDetail
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    select 
    <include refid="Base_Column_List" />
    from EShopOrderDetail
    where EShopOrderDetailID = #{eshoporderdetailid,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    delete from EShopOrderDetail
    where EShopOrderDetailID = #{eshoporderdetailid,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.fuxi.ws.data.entity.EshoporderdetailExample">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    delete from EShopOrderDetail
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.fuxi.ws.data.entity.Eshoporderdetail">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    insert into EShopOrderDetail (EShopOrderDetailID, EShopOrderID, 
      SN, outer_iid, outer_sku_id, 
      num_iid, sku_iid, sku_properties_name, 
      Quantity, UnitPrice, DiscountRate, 
      Discount, Amount, oid, 
      payment, adjust_fee, discount_fee, 
      seller_type, EmployeeID, Memo, 
      GoodsID, ColorID, SizeID, 
      RetailSales, RetailAmount, warehouseid, 
      sendQuantity, ReturnQty, Refund, 
      RefundReason, Refunder, RefundDate, 
      AllotSales, SendTimes, SendPoint, 
      Integral, PurchaseAmount, DeductionPoint, 
      BarCode, PackageNum)
    values (#{eshoporderdetailid,jdbcType=BIGINT}, #{eshoporderid,jdbcType=INTEGER}, 
      #{sn,jdbcType=INTEGER}, #{outerIid,jdbcType=VARCHAR}, #{outerSkuId,jdbcType=VARCHAR}, 
      #{numIid,jdbcType=BIGINT}, #{skuIid,jdbcType=BIGINT}, #{skuPropertiesName,jdbcType=VARCHAR}, 
      #{quantity,jdbcType=INTEGER}, #{unitprice,jdbcType=DECIMAL}, #{discountrate,jdbcType=DECIMAL}, 
      #{discount,jdbcType=DECIMAL}, #{amount,jdbcType=DECIMAL}, #{oid,jdbcType=BIGINT}, 
      #{payment,jdbcType=DECIMAL}, #{adjustFee,jdbcType=DECIMAL}, #{discountFee,jdbcType=DECIMAL}, 
      #{sellerType,jdbcType=VARCHAR}, #{employeeid,jdbcType=VARCHAR}, #{memo,jdbcType=VARCHAR}, 
      #{goodsid,jdbcType=VARCHAR}, #{colorid,jdbcType=VARCHAR}, #{sizeid,jdbcType=VARCHAR}, 
      #{retailsales,jdbcType=DECIMAL}, #{retailamount,jdbcType=DECIMAL}, #{warehouseid,jdbcType=VARCHAR}, 
      #{sendquantity,jdbcType=INTEGER}, #{returnqty,jdbcType=INTEGER}, #{refund,jdbcType=DECIMAL}, 
      #{refundreason,jdbcType=NVARCHAR}, #{refunder,jdbcType=NVARCHAR}, #{refunddate,jdbcType=TIMESTAMP}, 
      #{allotsales,jdbcType=DECIMAL}, #{sendtimes,jdbcType=DECIMAL}, #{sendpoint,jdbcType=INTEGER}, 
      #{integral,jdbcType=INTEGER}, #{purchaseamount,jdbcType=DECIMAL}, #{deductionpoint,jdbcType=DECIMAL}, 
      #{barcode,jdbcType=VARCHAR}, #{packagenum,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.Eshoporderdetail">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    insert into EShopOrderDetail
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="eshoporderdetailid != null">
        EShopOrderDetailID,
      </if>
      <if test="eshoporderid != null">
        EShopOrderID,
      </if>
      <if test="sn != null">
        SN,
      </if>
      <if test="outerIid != null">
        outer_iid,
      </if>
      <if test="outerSkuId != null">
        outer_sku_id,
      </if>
      <if test="numIid != null">
        num_iid,
      </if>
      <if test="skuIid != null">
        sku_iid,
      </if>
      <if test="skuPropertiesName != null">
        sku_properties_name,
      </if>
      <if test="quantity != null">
        Quantity,
      </if>
      <if test="unitprice != null">
        UnitPrice,
      </if>
      <if test="discountrate != null">
        DiscountRate,
      </if>
      <if test="discount != null">
        Discount,
      </if>
      <if test="amount != null">
        Amount,
      </if>
      <if test="oid != null">
        oid,
      </if>
      <if test="payment != null">
        payment,
      </if>
      <if test="adjustFee != null">
        adjust_fee,
      </if>
      <if test="discountFee != null">
        discount_fee,
      </if>
      <if test="sellerType != null">
        seller_type,
      </if>
      <if test="employeeid != null">
        EmployeeID,
      </if>
      <if test="memo != null">
        Memo,
      </if>
      <if test="goodsid != null">
        GoodsID,
      </if>
      <if test="colorid != null">
        ColorID,
      </if>
      <if test="sizeid != null">
        SizeID,
      </if>
      <if test="retailsales != null">
        RetailSales,
      </if>
      <if test="retailamount != null">
        RetailAmount,
      </if>
      <if test="warehouseid != null">
        warehouseid,
      </if>
      <if test="sendquantity != null">
        sendQuantity,
      </if>
      <if test="returnqty != null">
        ReturnQty,
      </if>
      <if test="refund != null">
        Refund,
      </if>
      <if test="refundreason != null">
        RefundReason,
      </if>
      <if test="refunder != null">
        Refunder,
      </if>
      <if test="refunddate != null">
        RefundDate,
      </if>
      <if test="allotsales != null">
        AllotSales,
      </if>
      <if test="sendtimes != null">
        SendTimes,
      </if>
      <if test="sendpoint != null">
        SendPoint,
      </if>
      <if test="integral != null">
        Integral,
      </if>
      <if test="purchaseamount != null">
        PurchaseAmount,
      </if>
      <if test="deductionpoint != null">
        DeductionPoint,
      </if>
      <if test="barcode != null">
        BarCode,
      </if>
      <if test="packagenum != null">
        PackageNum,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="eshoporderdetailid != null">
        #{eshoporderdetailid,jdbcType=BIGINT},
      </if>
      <if test="eshoporderid != null">
        #{eshoporderid,jdbcType=INTEGER},
      </if>
      <if test="sn != null">
        #{sn,jdbcType=INTEGER},
      </if>
      <if test="outerIid != null">
        #{outerIid,jdbcType=VARCHAR},
      </if>
      <if test="outerSkuId != null">
        #{outerSkuId,jdbcType=VARCHAR},
      </if>
      <if test="numIid != null">
        #{numIid,jdbcType=BIGINT},
      </if>
      <if test="skuIid != null">
        #{skuIid,jdbcType=BIGINT},
      </if>
      <if test="skuPropertiesName != null">
        #{skuPropertiesName,jdbcType=VARCHAR},
      </if>
      <if test="quantity != null">
        #{quantity,jdbcType=INTEGER},
      </if>
      <if test="unitprice != null">
        #{unitprice,jdbcType=DECIMAL},
      </if>
      <if test="discountrate != null">
        #{discountrate,jdbcType=DECIMAL},
      </if>
      <if test="discount != null">
        #{discount,jdbcType=DECIMAL},
      </if>
      <if test="amount != null">
        #{amount,jdbcType=DECIMAL},
      </if>
      <if test="oid != null">
        #{oid,jdbcType=BIGINT},
      </if>
      <if test="payment != null">
        #{payment,jdbcType=DECIMAL},
      </if>
      <if test="adjustFee != null">
        #{adjustFee,jdbcType=DECIMAL},
      </if>
      <if test="discountFee != null">
        #{discountFee,jdbcType=DECIMAL},
      </if>
      <if test="sellerType != null">
        #{sellerType,jdbcType=VARCHAR},
      </if>
      <if test="employeeid != null">
        #{employeeid,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        #{memo,jdbcType=VARCHAR},
      </if>
      <if test="goodsid != null">
        #{goodsid,jdbcType=VARCHAR},
      </if>
      <if test="colorid != null">
        #{colorid,jdbcType=VARCHAR},
      </if>
      <if test="sizeid != null">
        #{sizeid,jdbcType=VARCHAR},
      </if>
      <if test="retailsales != null">
        #{retailsales,jdbcType=DECIMAL},
      </if>
      <if test="retailamount != null">
        #{retailamount,jdbcType=DECIMAL},
      </if>
      <if test="warehouseid != null">
        #{warehouseid,jdbcType=VARCHAR},
      </if>
      <if test="sendquantity != null">
        #{sendquantity,jdbcType=INTEGER},
      </if>
      <if test="returnqty != null">
        #{returnqty,jdbcType=INTEGER},
      </if>
      <if test="refund != null">
        #{refund,jdbcType=DECIMAL},
      </if>
      <if test="refundreason != null">
        #{refundreason,jdbcType=NVARCHAR},
      </if>
      <if test="refunder != null">
        #{refunder,jdbcType=NVARCHAR},
      </if>
      <if test="refunddate != null">
        #{refunddate,jdbcType=TIMESTAMP},
      </if>
      <if test="allotsales != null">
        #{allotsales,jdbcType=DECIMAL},
      </if>
      <if test="sendtimes != null">
        #{sendtimes,jdbcType=DECIMAL},
      </if>
      <if test="sendpoint != null">
        #{sendpoint,jdbcType=INTEGER},
      </if>
      <if test="integral != null">
        #{integral,jdbcType=INTEGER},
      </if>
      <if test="purchaseamount != null">
        #{purchaseamount,jdbcType=DECIMAL},
      </if>
      <if test="deductionpoint != null">
        #{deductionpoint,jdbcType=DECIMAL},
      </if>
      <if test="barcode != null">
        #{barcode,jdbcType=VARCHAR},
      </if>
      <if test="packagenum != null">
        #{packagenum,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.fuxi.ws.data.entity.EshoporderdetailExample" resultType="java.lang.Integer">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    select count(*) from EShopOrderDetail
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    update EShopOrderDetail
    <set>
      <if test="record.eshoporderdetailid != null">
        EShopOrderDetailID = #{record.eshoporderdetailid,jdbcType=BIGINT},
      </if>
      <if test="record.eshoporderid != null">
        EShopOrderID = #{record.eshoporderid,jdbcType=INTEGER},
      </if>
      <if test="record.sn != null">
        SN = #{record.sn,jdbcType=INTEGER},
      </if>
      <if test="record.outerIid != null">
        outer_iid = #{record.outerIid,jdbcType=VARCHAR},
      </if>
      <if test="record.outerSkuId != null">
        outer_sku_id = #{record.outerSkuId,jdbcType=VARCHAR},
      </if>
      <if test="record.numIid != null">
        num_iid = #{record.numIid,jdbcType=BIGINT},
      </if>
      <if test="record.skuIid != null">
        sku_iid = #{record.skuIid,jdbcType=BIGINT},
      </if>
      <if test="record.skuPropertiesName != null">
        sku_properties_name = #{record.skuPropertiesName,jdbcType=VARCHAR},
      </if>
      <if test="record.quantity != null">
        Quantity = #{record.quantity,jdbcType=INTEGER},
      </if>
      <if test="record.unitprice != null">
        UnitPrice = #{record.unitprice,jdbcType=DECIMAL},
      </if>
      <if test="record.discountrate != null">
        DiscountRate = #{record.discountrate,jdbcType=DECIMAL},
      </if>
      <if test="record.discount != null">
        Discount = #{record.discount,jdbcType=DECIMAL},
      </if>
      <if test="record.amount != null">
        Amount = #{record.amount,jdbcType=DECIMAL},
      </if>
      <if test="record.oid != null">
        oid = #{record.oid,jdbcType=BIGINT},
      </if>
      <if test="record.payment != null">
        payment = #{record.payment,jdbcType=DECIMAL},
      </if>
      <if test="record.adjustFee != null">
        adjust_fee = #{record.adjustFee,jdbcType=DECIMAL},
      </if>
      <if test="record.discountFee != null">
        discount_fee = #{record.discountFee,jdbcType=DECIMAL},
      </if>
      <if test="record.sellerType != null">
        seller_type = #{record.sellerType,jdbcType=VARCHAR},
      </if>
      <if test="record.employeeid != null">
        EmployeeID = #{record.employeeid,jdbcType=VARCHAR},
      </if>
      <if test="record.memo != null">
        Memo = #{record.memo,jdbcType=VARCHAR},
      </if>
      <if test="record.goodsid != null">
        GoodsID = #{record.goodsid,jdbcType=VARCHAR},
      </if>
      <if test="record.colorid != null">
        ColorID = #{record.colorid,jdbcType=VARCHAR},
      </if>
      <if test="record.sizeid != null">
        SizeID = #{record.sizeid,jdbcType=VARCHAR},
      </if>
      <if test="record.retailsales != null">
        RetailSales = #{record.retailsales,jdbcType=DECIMAL},
      </if>
      <if test="record.retailamount != null">
        RetailAmount = #{record.retailamount,jdbcType=DECIMAL},
      </if>
      <if test="record.warehouseid != null">
        warehouseid = #{record.warehouseid,jdbcType=VARCHAR},
      </if>
      <if test="record.sendquantity != null">
        sendQuantity = #{record.sendquantity,jdbcType=INTEGER},
      </if>
      <if test="record.returnqty != null">
        ReturnQty = #{record.returnqty,jdbcType=INTEGER},
      </if>
      <if test="record.refund != null">
        Refund = #{record.refund,jdbcType=DECIMAL},
      </if>
      <if test="record.refundreason != null">
        RefundReason = #{record.refundreason,jdbcType=NVARCHAR},
      </if>
      <if test="record.refunder != null">
        Refunder = #{record.refunder,jdbcType=NVARCHAR},
      </if>
      <if test="record.refunddate != null">
        RefundDate = #{record.refunddate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.allotsales != null">
        AllotSales = #{record.allotsales,jdbcType=DECIMAL},
      </if>
      <if test="record.sendtimes != null">
        SendTimes = #{record.sendtimes,jdbcType=DECIMAL},
      </if>
      <if test="record.sendpoint != null">
        SendPoint = #{record.sendpoint,jdbcType=INTEGER},
      </if>
      <if test="record.integral != null">
        Integral = #{record.integral,jdbcType=INTEGER},
      </if>
      <if test="record.purchaseamount != null">
        PurchaseAmount = #{record.purchaseamount,jdbcType=DECIMAL},
      </if>
      <if test="record.deductionpoint != null">
        DeductionPoint = #{record.deductionpoint,jdbcType=DECIMAL},
      </if>
      <if test="record.barcode != null">
        BarCode = #{record.barcode,jdbcType=VARCHAR},
      </if>
      <if test="record.packagenum != null">
        PackageNum = #{record.packagenum,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    update EShopOrderDetail
    set EShopOrderDetailID = #{record.eshoporderdetailid,jdbcType=BIGINT},
      EShopOrderID = #{record.eshoporderid,jdbcType=INTEGER},
      SN = #{record.sn,jdbcType=INTEGER},
      outer_iid = #{record.outerIid,jdbcType=VARCHAR},
      outer_sku_id = #{record.outerSkuId,jdbcType=VARCHAR},
      num_iid = #{record.numIid,jdbcType=BIGINT},
      sku_iid = #{record.skuIid,jdbcType=BIGINT},
      sku_properties_name = #{record.skuPropertiesName,jdbcType=VARCHAR},
      Quantity = #{record.quantity,jdbcType=INTEGER},
      UnitPrice = #{record.unitprice,jdbcType=DECIMAL},
      DiscountRate = #{record.discountrate,jdbcType=DECIMAL},
      Discount = #{record.discount,jdbcType=DECIMAL},
      Amount = #{record.amount,jdbcType=DECIMAL},
      oid = #{record.oid,jdbcType=BIGINT},
      payment = #{record.payment,jdbcType=DECIMAL},
      adjust_fee = #{record.adjustFee,jdbcType=DECIMAL},
      discount_fee = #{record.discountFee,jdbcType=DECIMAL},
      seller_type = #{record.sellerType,jdbcType=VARCHAR},
      EmployeeID = #{record.employeeid,jdbcType=VARCHAR},
      Memo = #{record.memo,jdbcType=VARCHAR},
      GoodsID = #{record.goodsid,jdbcType=VARCHAR},
      ColorID = #{record.colorid,jdbcType=VARCHAR},
      SizeID = #{record.sizeid,jdbcType=VARCHAR},
      RetailSales = #{record.retailsales,jdbcType=DECIMAL},
      RetailAmount = #{record.retailamount,jdbcType=DECIMAL},
      warehouseid = #{record.warehouseid,jdbcType=VARCHAR},
      sendQuantity = #{record.sendquantity,jdbcType=INTEGER},
      ReturnQty = #{record.returnqty,jdbcType=INTEGER},
      Refund = #{record.refund,jdbcType=DECIMAL},
      RefundReason = #{record.refundreason,jdbcType=NVARCHAR},
      Refunder = #{record.refunder,jdbcType=NVARCHAR},
      RefundDate = #{record.refunddate,jdbcType=TIMESTAMP},
      AllotSales = #{record.allotsales,jdbcType=DECIMAL},
      SendTimes = #{record.sendtimes,jdbcType=DECIMAL},
      SendPoint = #{record.sendpoint,jdbcType=INTEGER},
      Integral = #{record.integral,jdbcType=INTEGER},
      PurchaseAmount = #{record.purchaseamount,jdbcType=DECIMAL},
      DeductionPoint = #{record.deductionpoint,jdbcType=DECIMAL},
      BarCode = #{record.barcode,jdbcType=VARCHAR},
      PackageNum = #{record.packagenum,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.Eshoporderdetail">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    update EShopOrderDetail
    <set>
      <if test="eshoporderid != null">
        EShopOrderID = #{eshoporderid,jdbcType=INTEGER},
      </if>
      <if test="sn != null">
        SN = #{sn,jdbcType=INTEGER},
      </if>
      <if test="outerIid != null">
        outer_iid = #{outerIid,jdbcType=VARCHAR},
      </if>
      <if test="outerSkuId != null">
        outer_sku_id = #{outerSkuId,jdbcType=VARCHAR},
      </if>
      <if test="numIid != null">
        num_iid = #{numIid,jdbcType=BIGINT},
      </if>
      <if test="skuIid != null">
        sku_iid = #{skuIid,jdbcType=BIGINT},
      </if>
      <if test="skuPropertiesName != null">
        sku_properties_name = #{skuPropertiesName,jdbcType=VARCHAR},
      </if>
      <if test="quantity != null">
        Quantity = #{quantity,jdbcType=INTEGER},
      </if>
      <if test="unitprice != null">
        UnitPrice = #{unitprice,jdbcType=DECIMAL},
      </if>
      <if test="discountrate != null">
        DiscountRate = #{discountrate,jdbcType=DECIMAL},
      </if>
      <if test="discount != null">
        Discount = #{discount,jdbcType=DECIMAL},
      </if>
      <if test="amount != null">
        Amount = #{amount,jdbcType=DECIMAL},
      </if>
      <if test="oid != null">
        oid = #{oid,jdbcType=BIGINT},
      </if>
      <if test="payment != null">
        payment = #{payment,jdbcType=DECIMAL},
      </if>
      <if test="adjustFee != null">
        adjust_fee = #{adjustFee,jdbcType=DECIMAL},
      </if>
      <if test="discountFee != null">
        discount_fee = #{discountFee,jdbcType=DECIMAL},
      </if>
      <if test="sellerType != null">
        seller_type = #{sellerType,jdbcType=VARCHAR},
      </if>
      <if test="employeeid != null">
        EmployeeID = #{employeeid,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        Memo = #{memo,jdbcType=VARCHAR},
      </if>
      <if test="goodsid != null">
        GoodsID = #{goodsid,jdbcType=VARCHAR},
      </if>
      <if test="colorid != null">
        ColorID = #{colorid,jdbcType=VARCHAR},
      </if>
      <if test="sizeid != null">
        SizeID = #{sizeid,jdbcType=VARCHAR},
      </if>
      <if test="retailsales != null">
        RetailSales = #{retailsales,jdbcType=DECIMAL},
      </if>
      <if test="retailamount != null">
        RetailAmount = #{retailamount,jdbcType=DECIMAL},
      </if>
      <if test="warehouseid != null">
        warehouseid = #{warehouseid,jdbcType=VARCHAR},
      </if>
      <if test="sendquantity != null">
        sendQuantity = #{sendquantity,jdbcType=INTEGER},
      </if>
      <if test="returnqty != null">
        ReturnQty = #{returnqty,jdbcType=INTEGER},
      </if>
      <if test="refund != null">
        Refund = #{refund,jdbcType=DECIMAL},
      </if>
      <if test="refundreason != null">
        RefundReason = #{refundreason,jdbcType=NVARCHAR},
      </if>
      <if test="refunder != null">
        Refunder = #{refunder,jdbcType=NVARCHAR},
      </if>
      <if test="refunddate != null">
        RefundDate = #{refunddate,jdbcType=TIMESTAMP},
      </if>
      <if test="allotsales != null">
        AllotSales = #{allotsales,jdbcType=DECIMAL},
      </if>
      <if test="sendtimes != null">
        SendTimes = #{sendtimes,jdbcType=DECIMAL},
      </if>
      <if test="sendpoint != null">
        SendPoint = #{sendpoint,jdbcType=INTEGER},
      </if>
      <if test="integral != null">
        Integral = #{integral,jdbcType=INTEGER},
      </if>
      <if test="purchaseamount != null">
        PurchaseAmount = #{purchaseamount,jdbcType=DECIMAL},
      </if>
      <if test="deductionpoint != null">
        DeductionPoint = #{deductionpoint,jdbcType=DECIMAL},
      </if>
      <if test="barcode != null">
        BarCode = #{barcode,jdbcType=VARCHAR},
      </if>
      <if test="packagenum != null">
        PackageNum = #{packagenum,jdbcType=INTEGER},
      </if>
    </set>
    where EShopOrderDetailID = #{eshoporderdetailid,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fuxi.ws.data.entity.Eshoporderdetail">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 22 17:44:07 CST 2019.
    -->
    update EShopOrderDetail
    set EShopOrderID = #{eshoporderid,jdbcType=INTEGER},
      SN = #{sn,jdbcType=INTEGER},
      outer_iid = #{outerIid,jdbcType=VARCHAR},
      outer_sku_id = #{outerSkuId,jdbcType=VARCHAR},
      num_iid = #{numIid,jdbcType=BIGINT},
      sku_iid = #{skuIid,jdbcType=BIGINT},
      sku_properties_name = #{skuPropertiesName,jdbcType=VARCHAR},
      Quantity = #{quantity,jdbcType=INTEGER},
      UnitPrice = #{unitprice,jdbcType=DECIMAL},
      DiscountRate = #{discountrate,jdbcType=DECIMAL},
      Discount = #{discount,jdbcType=DECIMAL},
      Amount = #{amount,jdbcType=DECIMAL},
      oid = #{oid,jdbcType=BIGINT},
      payment = #{payment,jdbcType=DECIMAL},
      adjust_fee = #{adjustFee,jdbcType=DECIMAL},
      discount_fee = #{discountFee,jdbcType=DECIMAL},
      seller_type = #{sellerType,jdbcType=VARCHAR},
      EmployeeID = #{employeeid,jdbcType=VARCHAR},
      Memo = #{memo,jdbcType=VARCHAR},
      GoodsID = #{goodsid,jdbcType=VARCHAR},
      ColorID = #{colorid,jdbcType=VARCHAR},
      SizeID = #{sizeid,jdbcType=VARCHAR},
      RetailSales = #{retailsales,jdbcType=DECIMAL},
      RetailAmount = #{retailamount,jdbcType=DECIMAL},
      warehouseid = #{warehouseid,jdbcType=VARCHAR},
      sendQuantity = #{sendquantity,jdbcType=INTEGER},
      ReturnQty = #{returnqty,jdbcType=INTEGER},
      Refund = #{refund,jdbcType=DECIMAL},
      RefundReason = #{refundreason,jdbcType=NVARCHAR},
      Refunder = #{refunder,jdbcType=NVARCHAR},
      RefundDate = #{refunddate,jdbcType=TIMESTAMP},
      AllotSales = #{allotsales,jdbcType=DECIMAL},
      SendTimes = #{sendtimes,jdbcType=DECIMAL},
      SendPoint = #{sendpoint,jdbcType=INTEGER},
      Integral = #{integral,jdbcType=INTEGER},
      PurchaseAmount = #{purchaseamount,jdbcType=DECIMAL},
      DeductionPoint = #{deductionpoint,jdbcType=DECIMAL},
      BarCode = #{barcode,jdbcType=VARCHAR},
      PackageNum = #{packagenum,jdbcType=INTEGER}
    where EShopOrderDetailID = #{eshoporderdetailid,jdbcType=BIGINT}
  </update>
  
  <select id="getProfitsharorder" resultType="java.util.LinkedHashMap">
	select EShopOrderID,GoodsID,EmployeeID,SUM(Amount) as AmountSum,SUM(Quantity) as Quantity 
	from EShopOrderDetail 
	where EShopOrderID = #{eshoporderid,jdbcType=INTEGER}
	group by EShopOrderID,GoodsID,EmployeeID
  </select>
  <select id="existsGoods" resultType="java.lang.String">
	select top 1 a.GoodsID
		from EShopOrderDetail a
	where GoodsID = #{goodsid,jdbcType=VARCHAR}
  </select>
  
  <select id="getorder" parameterType="java.util.HashMap" resultType="java.util.LinkedHashMap"> 
  		select ed.EShopOrderDetailID,ed.EShopOrderID,ed.SN,ed.Quantity,ed.UnitPrice,ed.DiscountRate,
		ed.Discount,ed.Amount,ed.EmployeeID,em.Name as EmpName,ed.Memo,ed.GoodsID,wg.Code,wg.GoodName,
		ed.ColorID,c.Color,ed.SizeID,s.Size,ed.warehouseid,ed.sendQuantity,ed.ReturnQty 
		from EShopOrderDetail as ed 
		inner join EShopOrder as e on ed.EShopOrderID=e.EShopOrderID 
		left join Employee as em on ed.EmployeeID=em.EmployeeID
		left join W_Goods as wg on ed.GoodsID=wg.GoodsID
		left join Color as c on ed.ColorID=c.ColorID 
		left join Size as s on ed.SizeID=s.SizeID
    <if test="conditions != null and conditions != ''">
		where			
		${conditions}
	</if>
	order by ed.EShopOrderID desc
  </select>
  
  <select id="getorderdetailbyapi" resultType="java.util.LinkedHashMap"> 
  	select isnull(isnull(zh.barcode_d,b.BarCode),'') as outer_sku, isnull(wg.GoodName,'') as goods_name,
	isnull(zh.qty,1)*ed.Quantity as goods_number,isnull(zh.price,ed.UnitPrice) as goods_price,
	case when e.AmountSum=0 then 0.0 else (e.AmountSum-isnull(wt.Parvalue,0))*ed.Amount/e.AmountSum end as payment_ft,
	0 as is_gift
	from EShopOrderDetail as ed 
	inner join EShopOrder as e on ed.EShopOrderID=e.EShopOrderID
	inner join W_Goods as wg on ed.GoodsID=wg.GoodsID
	inner join Barcode as b on ed.GoodsID=b.GoodsID and ed.SizeID=b.SizeID and ed.ColorID=b.ColorID
	left join W_VipTicket as wvt on e.EShopOrderID=wvt.EShopOrderID
	left join W_Ticket as wt on wvt.TicketID=wt.TicketID 
	left join zuhe_goods as zh on b.barcode=zh.barcode_m
    where ed.EShopOrderID = #{eshoporderid,jdbcType=INTEGER}
  </select>
  
  <select id="wxpaygoodsname" resultType="java.util.LinkedHashMap"> 
  	select a.GoodsID,GoodName 
	from EShopOrderDetail as a
	inner join W_Goods as b on a.goodsid=b.goodsid
	where EShopOrderID = #{eshoporderid,jdbcType=INTEGER}
  </select>
  
  <select id="selectOrderdtls" resultType="java.util.LinkedHashMap"> 
  	select EShopOrderDetailID,b.Code goodsno,c.No colorno,d.No sizeno, a.quantity from EShopOrderDetail a 
	inner join W_Goods b on a.GoodsID=b.GoodsID
	inner join Color c on c.ColorID=a.ColorID
	inner join Size d on d.SizeID=a.SizeID
	where EShopOrderID = #{eshoporderid,jdbcType=INTEGER}
  </select>
</mapper>