123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- <?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.caimei365.order.mapper.SubmitMapper">
- <insert id="insertMainOrder" keyColumn="orderID" keyProperty="orderId"
- parameterType="com.caimei365.order.model.po.OrderPo" useGeneratedKeys="true">
- INSERT INTO cm_order (orderSeen, orderSource, orderNo, userID, clubID, organizeID, buyUserID, spID, orderTime, updateDate,
- delFlag,
- userBeans, orderType, orderSubmitType, confirmFlag, onlinePayFlag, splitFlag, payFlag,
- receiptStatus, payStatus, zeroCostFlag, sendOutStatus, refundType, affirmPaymentFlag,
- productCount, presentCount, promotionalGiftsCount, hasActProduct, promotionFullReduction,
- svipFullReduction, secondHandOrderFlag, invoiceFlag, freePostFlag, freight,
- productTotalFee,
- orderTotalFee, payTotalFee, payableAmount, balancePayFee, couponAmount, status,
- confirmTime,
- payTime, rebateFlag,rebateFee, clauseID, clauseName)
- VALUES (#{orderSeen}, #{orderSource}, #{orderNo}, #{userId}, #{clubId}, #{organizeId}, #{buyUserId}, #{spId}, #{orderTime},
- #{updateDate},
- #{delFlag},
- #{userBeans}, #{orderType}, #{orderSubmitType}, #{confirmFlag}, #{onlinePayFlag}, #{splitFlag},
- #{payFlag},
- #{receiptStatus}, #{payStatus}, #{zeroCostFlag}, #{sendOutStatus}, #{refundType}, #{affirmPaymentFlag},
- #{productCount}, #{presentCount}, #{promotionalGiftsCount}, #{hasActProduct}, #{promotionFullReduction},
- #{svipFullReduction},
- #{secondHandOrderFlag}, #{invoiceFlag}, #{postageFlag}, #{postage}, #{productTotalFee},
- #{orderTotalFee},
- #{payTotalFee}, #{payableAmount}, #{balancePayFee}, #{couponAmount}, #{status}, #{confirmTime},
- #{payTime}, #{rebateFlag},#{rebateFee},
- #{clauseId}, #{clauseName})
- </insert>
- <insert id="insertShopOrder" keyColumn="shopOrderID" keyProperty="shopOrderId"
- parameterType="com.caimei365.order.model.po.OrderShopPo" useGeneratedKeys="true">
- INSERT INTO cm_shop_order (onlinePayWays, shopOrderNo, orderID, orderNo, organizeID, isColdChina, shopID, note, userID, clubID, orderType,
- spID, orderPromotionsId, promotionFullReduction, svipShopReduction, brokerage,
- canRefundAmount, itemCount,
- totalAmount, productAmount, needPayAmount, shopProductAmount, shopPostFee, shopPostFlag,
- shopTaxFee,
- shouldPayShopAmount, orderTime, orderSubmitType, splitFlag, payStatus,
- payedShopAmount, splitCode, realPay, eachDiscount, receiptStatus)
- VALUES (#{onlinePayWays}, #{shopOrderNo}, #{orderId}, #{orderNo}, #{organizeId},#{isColdChina}, #{shopId}, #{note}, #{userId}, #{clubId}, #{orderType},
- #{spId}, #{orderPromotionsId}, #{promotionFullReduction}, #{svipShopReduction}, #{brokerage},
- #{canRefundAmount}, #{itemCount},
- #{totalAmount}, #{productAmount}, #{needPayAmount}, #{shopProductAmount}, #{shopPostFee}, #{shopPostFlag}, #{shopTaxFee},
- #{shouldPayShopAmount}, #{orderTime}, #{orderSubmitType}, #{splitFlag}, #{payStatus},
- #{payedShopAmount}, #{splitCode}, #{realPay}, #{eachDiscount}, 1)
- </insert>
- <update id="updateOrder">
- update cm_order
- set freight = #{freight}
- where orderId = #{orderId}
- </update>
- <insert id="insertOrderProduct" keyColumn="orderProductID" keyProperty="orderProductId"
- parameterType="com.caimei365.order.model.po.OrderProductPo" useGeneratedKeys="true">
- INSERT INTO cm_order_product (orderID, orderNo, shopOrderID, shopOrderNo, organizeProductID,organizeID, orderPromotionsId, productId, shopId,
- name,
- productImage, price, shopName, costPrice, normalPrice, ladderPriceFlag,
- discountPrice, discount,
- totalAmount, totalFee, shouldPayFee, productUnit, num, presentNum, discountFee,
- includedTax,
- invoiceType, taxRate, addedValueTax, totalAddedValueTax, supplierTaxRate,
- singleShouldPayTotalTax, shouldPayTotalTax,
- shopProductAmount, singleShopFee, shopFee, singleOtherFee, otherFee, singleCmFee,
- cmFee,
- payStatus, buyAgainFlag, notOutStore, isActProduct, productType, svipPriceFlag,
- svipPriceType,
- svipDiscount, svipReduction,skuID, organizeSkuId, cmPercent, organizePercent, shopPercent)
- VALUES (#{orderId}, #{orderNo}, #{shopOrderId}, #{shopOrderNo}, #{organizeProductId}, #{organizeId}, #{orderPromotionsId}, #{productId}, #{shopId},
- #{name},
- #{image}, #{price}, #{shopName}, #{costPrice}, #{normalPrice}, #{ladderPriceFlag},
- #{discountPrice}, #{discount},
- #{totalAmount}, #{totalFee}, #{shouldPayFee}, #{productUnit}, #{num}, #{presentNum}, #{discountFee},
- #{includedTax},
- #{invoiceType}, #{taxRate}, #{addedValueTax}, #{totalAddedValueTax}, #{shopTaxRate},
- #{singleShouldPayTotalTax}, #{shouldPayTotalTax},
- #{shopProductAmount}, #{singleShopFee}, #{shopFee}, #{singleOtherFee}, #{otherFee}, #{singleCmFee},
- #{cmFee},
- #{payStatus}, #{buyAgainFlag}, #{notOutStore}, #{actProduct}, #{productType}, #{svipPriceFlag},
- #{svipPriceType}, #{svipDiscount}, #{svipReduction},#{skuId}, #{organizeSkuId}, #{cmPercent}, #{organizePercent}, #{shopPercent})
- </insert>
- <insert id="insertOrderPromotions" keyColumn="id" keyProperty="id"
- parameterType="com.caimei365.order.model.vo.PromotionsVo" useGeneratedKeys="true">
- INSERT INTO cm_promotions_order (orderId, promotionsId, name, description, type, mode, touchPrice, reducedPrice,
- discount,status, beginTime, endTime)
- VALUES (#{orderId}, #{id}, #{name}, #{description}, #{type}, #{mode}, #{touchPrice}, #{reducedPrice}, #{discount},
- #{status}, #{beginTime}, #{endTime})
- </insert>
- <insert id="insertLadderPrices" keyColumn="id" keyProperty="id"
- parameterType="com.caimei365.order.model.vo.LadderPriceVo" useGeneratedKeys="true">
- INSERT INTO order_product_ladder_price (orderProductId, ladderNum, buyNum, buyPrice, createDate)
- VALUES (#{orderProductId}, #{ladderNum}, #{buyNum}, #{buyPrice}, #{createDate})
- </insert>
- <update id="updateShopOrderIds">
- UPDATE cm_order
- SET shopOrderIDs = #{shopOrderIds}
- WHERE orderID = #{orderId}
- </update>
- <insert id="insertOrderInvoice" parameterType="com.caimei365.order.model.po.InvoicePo">
- INSERT INTO bp_order_invoice (orderId, invoiceTitle, type, invoiceContent, invoiceTitleType, corporationTaxNum,
- registeredAddress, registeredPhone, bankAccountNo, openBank)
- VALUES (#{orderId}, #{invoiceTitle}, #{type}, #{invoiceContent}, #{headingType}, #{corporationTaxNum},
- #{registeredAddress}, #{registeredPhone}, #{bankAccountNo}, #{openBank})
- </insert>
- <insert id="insertOrderUserInfo" parameterType="com.caimei365.order.model.po.OrderUserInfoPo">
- INSERT INTO bp_order_userinfo (orderId, clubId, userId, name, shouHuoRen, mobile,
- townId, province, city, town, address)
- VALUES (#{orderId}, #{clubId}, #{userId}, #{name}, #{receiver}, #{mobile},
- #{townId}, #{province}, #{city}, #{town}, #{address})
- </insert>
- <insert id="insertCouponOrderRecord" parameterType="com.caimei365.order.model.po.CouponOrderRecordPo">
- INSERT INTO cm_coupon_order_record (orderId, clubCouponId, couponType, couponAmount, touchPrice, createDate)
- VALUES (#{orderId}, #{clubCouponId}, #{couponType}, #{couponAmount}, #{touchPrice}, #{createDate})
- </insert>
- <update id="updateUserMoney">
- UPDATE USER
- SET userMoney = #{userMoney},
- ableUserMoney = #{ableUserMoney}
- WHERE userID = #{userId}
- </update>
- <update id="updateOrderInvoice">
- UPDATE bp_order_invoice SET orderId=#{orderId},
- <set>
- <if test="invoiceTitle != null">
- invoiceTitle = #{invoiceTitle},
- </if>
- <if test="type != null">
- type = #{type,jdbcType=CHAR},
- </if>
- <if test="invoiceContent != null">
- invoiceContent = #{invoiceContent},
- </if>
- <if test="invoiceTitleType != null">
- invoiceTitleType = #{invoiceTitleType},
- </if>
- <if test="corporationTaxNum != null">
- corporationTaxNum = #{corporationTaxNum},
- </if>
- <if test="registeredAddress != null">
- registeredAddress = #{registeredAddress},
- </if>
- <if test="registeredPhone != null">
- registeredPhone = #{registeredPhone},
- </if>
- <if test="bankAccountNo != null">
- bankAccountNo = #{bankAccountNo},
- </if>
- <if test="openBank != null">
- openBank = #{openBank},
- </if>
- </set>
- WHERE id = #{id}
- </update>
- <update id="updateOnlinePayFlag">
- UPDATE cm_order
- SET onlinePayFlag = #{onlinePayFlag}
- WHERE orderID = #{orderId}
- </update>
- <update id="updateOnlinePayWays">
- UPDATE cm_shop_order
- SET onlinePayWays = #{onlinePayWays}
- WHERE orderID = #{orderId}
- </update>
- <select id="getOrganizeSkuInfo" resultType="com.caimei365.order.model.po.CmOrganizeSkuPo">
- SELECT
- skuId,
- productId,
- minBuyNumber,
- price,
- unit,
- stock,
- organizePercent,
- shopPercent,
- cmPercent
- FROM cm_sku
- where skuId = #{skuId} and organizeId = 4
- </select>
- <select id="getOrderInvoice" resultType="com.caimei365.order.model.po.InvoicePo">
- SELECT id,
- orderId,
- invoiceTitle,
- corporationTaxNum,
- registeredAddress,
- registeredPhone,
- bankAccountNo,
- openBank
- FROM bp_order_invoice
- WHERE orderId = #{orderId}
- </select>
- <select id="getOperationIdByUnionId" resultType="java.lang.Integer">
- SELECT `id`
- FROM cm_mall_operation_user
- WHERE unionId = #{unionId}
- AND userID = #{userId}
- AND delFlag = '0'
- </select>
- <select id="getServiceProviderUserId" resultType="java.lang.Integer">
- SELECT userID
- FROM serviceprovider
- WHERE serviceProviderID = #{serviceProviderId}
- </select>
- <select id="getOrderUserBoById" resultType="com.caimei365.order.model.bo.OrderParamBo">
- SELECT userID AS userId,
- clubID AS clubId,
- userName,
- bindMobile,
- userMoney,
- ableUserMoney,
- userBeans
- FROM user
- WHERE userID = #{userId}
- </select>
- <select id="getProductDetails" resultType="com.caimei365.order.model.po.OrderProductPo">
- SELECT cs.skuId AS skuId,
- p.productID AS productId,
- p.shopID AS shopId,
- p.`name` AS `name`,
- p.mainImage AS image,
- cs.price,
- cs.costPrice,
- IFNULL(cs.costCheckFlag, 1) AS costCheckFlag,
- cs.shopPercent as costProportional,
- p.productCategory,
- cs.ladderPriceFlag,
- p.includedTax,
- p.invoiceType,
- p.taxPoint AS taxRate,
- cs.unit AS productUnit,
- cs.normalPrice,
- p.supplierTaxPoint AS shopTaxRate,
- p.splitCode as splitCode
- FROM product p
- LEFT JOIN cm_sku cs on p.productID = cs.productId
- WHERE cs.skuId = #{skuId} and cs.organizeId = 0
- </select>
- <select id="getProductOrganizeDetails" resultType="com.caimei365.order.model.po.OrderProductPo">
- SELECT cs.skuId AS skuId,
- p.productID AS productId,
- p.shopID AS shopId,
- p.`name` AS `name`,
- p.mainImage AS image,
- cs.price,
- p.productCategory,
- cs.ladderPriceFlag,
- p.includedTax,
- p.invoiceType,
- p.taxPoint AS taxRate,
- cs.unit AS productUnit,
- p.supplierTaxPoint AS shopTaxRate,
- p.splitCode as splitCode
- FROM product p
- LEFT JOIN cm_sku cs ON cs.productId = p.productId
- WHERE cmps.id = #{skuId}
- </select>
- <select id="getClauseNameById" resultType="java.lang.String">
- SELECT `name`
- FROM bp_clause
- WHERE id = #{clauseId}
- </select>
- <select id="getAddressDetailById" resultType="com.caimei365.order.model.vo.AddressVo">
- SELECT a.addressID AS addressId,
- a.userID AS userId,
- a.shouHuoRen AS receiver,
- a.townID AS townId,
- a.address,
- a.mobile,
- a.defaultFlag,
- t.name AS town,
- c.name AS city,
- c.cityID AS cityId,
- p.name AS province,
- p.provinceID AS provinceId
- FROM address a
- LEFT JOIN town t ON t.townID = a.townID
- LEFT JOIN city c ON c.cityID = t.cityID
- LEFT JOIN province p ON p.provinceID = c.provinceID
- WHERE a.addressID = #{addressId}
- LIMIT 1
- </select>
- <select id="getSvipProductDetails" resultType="com.caimei365.order.model.po.SvipProductPo">
- select if(id is not null and csp.status = 0, 1, 0) as svipProductFlag,
- priceType as svipPriceType,
- discount as svipDiscount,
- discountPrice as svipDiscountPrice
- from cm_svip_product_sku
- left join cm_svip_product csp on cm_svip_product_sku.productId = csp.productId
- where skuId = #{skuId}
- and csp.status=0
- </select>
- <select id="findLowOrder" resultType="java.lang.Integer">
- select orderID
- from cm_order
- where status not in (6, 7)
- and payTotalFee <![CDATA[ < ]]> 1000
- and orderTime <![CDATA[ > ]]> #{orderTime}
- and userID = #{userId}
- </select>
- <select id="findShops" resultType="com.caimei365.order.model.po.OrderShopPo">
- SELECT DISTINCT
- s.shopID AS shopId,
- p.splitCode
- FROM shop s
- LEFT JOIN product p ON p.shopID = s.shopID
- WHERE p.productID IN
- <foreach collection="productIdList" open="(" separator="," close=")" item="productId">
- #{productId}
- </foreach>
- GROUP BY s.shopID,p.splitCode
- </select>
- <select id="findSplitResult" resultType="java.lang.Integer">
- SELECT COUNT(*) FROM product
- WHERE productId IN
- <foreach collection="productIdList" open="(" separator="," close=")" item="productId">
- #{productId}
- </foreach>
- AND (splitcode IS NULL OR splitcode ='')
- </select>
- <select id="getRechargeProductDetails" resultType="com.caimei365.order.model.po.OrderProductPo">
- SELECT cs.skuId AS skuId,
- p.productID AS productId,
- p.shopID AS shopId,
- p.`name` AS `name`,
- p.mainImage AS image,
- cs.price,
- cs.costPrice,
- IFNULL(cs.costCheckFlag, 1) AS costCheckFlag,
- cs.shopPercent as costProportional,
- p.productCategory,
- cs.ladderPriceFlag,
- p.includedTax,
- p.invoiceType,
- p.taxPoint AS taxRate,
- cs.unit AS productUnit,
- cs.normalPrice,
- p.supplierTaxPoint AS shopTaxRate,
- p.splitCode as splitCode
- FROM product p
- LEFT JOIN cm_sku cs on p.productID = cs.productId
- WHERE cs.productId = #{productId} and cs.organizeId = 0
- </select>
- </mapper>
|