|
@@ -1,62 +1,96 @@
|
|
|
<?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 id="insertMainOrder" keyColumn="orderID" keyProperty="orderId"
|
|
|
+ parameterType="com.caimei365.order.model.po.OrderPo" useGeneratedKeys="true">
|
|
|
INSERT INTO cm_order (orderSource, orderNo, userID, clubID, 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,clauseID, clauseName)
|
|
|
- VALUES (#{orderSource},#{orderNo},#{userId},#{clubId},#{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},
|
|
|
- #{clauseId},#{clauseName})
|
|
|
+ svipFullReduction, secondHandOrderFlag, invoiceFlag, freePostFlag, freight,
|
|
|
+ productTotalFee,
|
|
|
+ orderTotalFee, payTotalFee, payableAmount, balancePayFee, couponAmount, status,
|
|
|
+ confirmTime,
|
|
|
+ payTime, rebateFlag, clauseID, clauseName)
|
|
|
+ VALUES (#{orderSource}, #{orderNo}, #{userId}, #{clubId}, #{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},
|
|
|
+ #{clauseId}, #{clauseName})
|
|
|
</insert>
|
|
|
- <insert id="insertShopOrder" keyColumn="shopOrderID" keyProperty="shopOrderId" parameterType="com.caimei365.order.model.po.OrderShopPo" useGeneratedKeys="true">
|
|
|
+ <insert id="insertShopOrder" keyColumn="shopOrderID" keyProperty="shopOrderId"
|
|
|
+ parameterType="com.caimei365.order.model.po.OrderShopPo" useGeneratedKeys="true">
|
|
|
INSERT INTO cm_shop_order (shopOrderNo, orderID, orderNo, shopID, note, userID, clubID, orderType,
|
|
|
- spID, orderPromotionsId, promotionFullReduction, svipShopReduction, brokerage, canRefundAmount, itemCount,
|
|
|
- totalAmount, productAmount, needPayAmount, shopProductAmount, shopPostFee, shopTaxFee,
|
|
|
- shouldPayShopAmount, orderTime, orderSubmitType, splitFlag, payStatus, payedShopAmount)
|
|
|
- VALUES (#{shopOrderNo},#{orderId},#{orderNo},#{shopId}, #{note},#{userId},#{clubId},#{orderType},
|
|
|
- #{spId},#{orderPromotionsId},#{promotionFullReduction},#{svipShopReduction},#{brokerage},#{canRefundAmount},#{itemCount},
|
|
|
- #{totalAmount},#{productAmount},#{needPayAmount},#{shopProductAmount},#{shopPostFee},#{shopTaxFee},
|
|
|
- #{shouldPayShopAmount},#{orderTime},#{orderSubmitType},#{splitFlag},#{payStatus},#{payedShopAmount})
|
|
|
+ spID, orderPromotionsId, promotionFullReduction, svipShopReduction, brokerage,
|
|
|
+ canRefundAmount, itemCount,
|
|
|
+ totalAmount, productAmount, needPayAmount, shopProductAmount, shopPostFee,
|
|
|
+ shopTaxFee,
|
|
|
+ shouldPayShopAmount, orderTime, orderSubmitType, splitFlag, payStatus,
|
|
|
+ payedShopAmount)
|
|
|
+ VALUES (#{shopOrderNo}, #{orderId}, #{orderNo}, #{shopId}, #{note}, #{userId}, #{clubId}, #{orderType},
|
|
|
+ #{spId}, #{orderPromotionsId}, #{promotionFullReduction}, #{svipShopReduction}, #{brokerage},
|
|
|
+ #{canRefundAmount}, #{itemCount},
|
|
|
+ #{totalAmount}, #{productAmount}, #{needPayAmount}, #{shopProductAmount}, #{shopPostFee}, #{shopTaxFee},
|
|
|
+ #{shouldPayShopAmount}, #{orderTime}, #{orderSubmitType}, #{splitFlag}, #{payStatus},
|
|
|
+ #{payedShopAmount})
|
|
|
</insert>
|
|
|
- <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, orderPromotionsId, productId, shopId, name,
|
|
|
- productImage, price, price1, 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)
|
|
|
- VALUES (#{orderId},#{orderNo},#{shopOrderId},#{shopOrderNo},#{orderPromotionsId},#{productId},#{shopId},#{name},
|
|
|
- #{image},#{price},#{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})
|
|
|
+ <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, orderPromotionsId, productId, shopId,
|
|
|
+ name,
|
|
|
+ productImage, price, price1, 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)
|
|
|
+ VALUES (#{orderId}, #{orderNo}, #{shopOrderId}, #{shopOrderNo}, #{orderPromotionsId}, #{productId}, #{shopId},
|
|
|
+ #{name},
|
|
|
+ #{image}, #{price}, #{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})
|
|
|
</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, status, beginTime, endTime)
|
|
|
- VALUES (#{orderId},#{id},#{name},#{description},#{type},#{mode},#{touchPrice},#{reducedPrice},#{status},#{beginTime},#{endTime})
|
|
|
+ <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,
|
|
|
+ status, beginTime, endTime)
|
|
|
+ VALUES (#{orderId}, #{id}, #{name}, #{description}, #{type}, #{mode}, #{touchPrice}, #{reducedPrice}, #{status},
|
|
|
+ #{beginTime}, #{endTime})
|
|
|
</insert>
|
|
|
- <insert id="insertLadderPrices" keyColumn="id" keyProperty="id" parameterType="com.caimei365.order.model.vo.LadderPriceVo" useGeneratedKeys="true">
|
|
|
+ <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})
|
|
|
+ VALUES (#{orderProductId}, #{ladderNum}, #{buyNum}, #{buyPrice}, #{createDate})
|
|
|
</insert>
|
|
|
<update id="updateShopOrderIds">
|
|
|
- UPDATE cm_order SET shopOrderIDs = #{shopOrderIds}
|
|
|
+ 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},#{invoiceTitleType},#{corporationTaxNum}, #{registeredAddress}, #{registeredPhone}, #{bankAccountNo}, #{openBank})
|
|
|
+ INSERT INTO bp_order_invoice (orderId, invoiceTitle, type, invoiceContent, invoiceTitleType, corporationTaxNum,
|
|
|
+ registeredAddress, registeredPhone, bankAccountNo, openBank)
|
|
|
+ VALUES (#{orderId}, #{invoiceTitle}, #{type}, #{invoiceContent}, #{invoiceTitleType}, #{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,
|
|
@@ -69,7 +103,9 @@
|
|
|
VALUES (#{orderId}, #{clubCouponId}, #{couponType}, #{couponAmount}, #{touchPrice}, #{createDate})
|
|
|
</insert>
|
|
|
<update id="updateUserMoney">
|
|
|
- UPDATE USER SET userMoney = #{userMoney}, ableUserMoney = #{ableUserMoney}
|
|
|
+ UPDATE USER
|
|
|
+ SET userMoney = #{userMoney},
|
|
|
+ ableUserMoney = #{ableUserMoney}
|
|
|
WHERE userID = #{userId}
|
|
|
</update>
|
|
|
<update id="updateOrderInvoice">
|
|
@@ -106,80 +142,98 @@
|
|
|
WHERE id = #{id}
|
|
|
</update>
|
|
|
<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 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 `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 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
|
|
|
+ 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
|
|
|
- p.productID AS productId,
|
|
|
- p.shopID AS shopId,
|
|
|
- p.`name` AS `name`,
|
|
|
- p.mainImage AS image,
|
|
|
- p.price1 AS price,
|
|
|
- p.costPrice,
|
|
|
- p.costCheckFlag,
|
|
|
- p.costProportional,
|
|
|
- p.productCategory,
|
|
|
- p.ladderPriceFlag,
|
|
|
- p.includedTax,
|
|
|
- p.invoiceType,
|
|
|
- p.taxPoint AS taxRate,
|
|
|
- p.unit AS productUnit,
|
|
|
- p.normalPrice,
|
|
|
- p.supplierTaxPoint AS shopTaxRate
|
|
|
+ SELECT p.productID AS productId,
|
|
|
+ p.shopID AS shopId,
|
|
|
+ p.`name` AS `name`,
|
|
|
+ p.mainImage AS image,
|
|
|
+ p.price1 AS price,
|
|
|
+ p.costPrice,
|
|
|
+ p.costCheckFlag,
|
|
|
+ p.costProportional,
|
|
|
+ p.productCategory,
|
|
|
+ p.ladderPriceFlag,
|
|
|
+ p.includedTax,
|
|
|
+ p.invoiceType,
|
|
|
+ p.taxPoint AS taxRate,
|
|
|
+ p.unit AS productUnit,
|
|
|
+ p.normalPrice,
|
|
|
+ p.supplierTaxPoint AS shopTaxRate
|
|
|
FROM product p
|
|
|
WHERE p.productId = #{productId}
|
|
|
</select>
|
|
|
<select id="getClauseNameById" resultType="java.lang.String">
|
|
|
- SELECT `name` FROM bp_clause WHERE id = #{clauseId}
|
|
|
+ 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
|
|
|
+ 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
|
|
|
+ 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,1,0) as svipProductFlag,
|
|
|
- priceType as svipPriceType,
|
|
|
- discount as svipDiscount,
|
|
|
- discountPrice as svipDiscountPrice
|
|
|
+ select if(id is not null, 1, 0) as svipProductFlag,
|
|
|
+ priceType as svipPriceType,
|
|
|
+ discount as svipDiscount,
|
|
|
+ discountPrice as svipDiscountPrice
|
|
|
from cm_svip_product
|
|
|
where productId = #{productId}
|
|
|
</select>
|
|
|
+ <select id="findLowOrder" resultType="java.lang.Integer">
|
|
|
+ select orderID
|
|
|
+ from cm_order
|
|
|
+ where status = '4'
|
|
|
+ and payTotalFee <![CDATA[ < ]]> 1000
|
|
|
+ and orderTime <![CDATA[ > ]]> #{orderTime}
|
|
|
+ </select>
|
|
|
</mapper>
|