|
@@ -806,6 +806,7 @@
|
|
|
<select id="findPayOrderListByIDs" resultType="newShopOrder">
|
|
|
select distinct<include refid="shopOrderColumns"/>,
|
|
|
co.payTotalFee AS payTotalFee,
|
|
|
+ co.promotionFullReduction,
|
|
|
bou.name AS buyer,
|
|
|
s.name AS shopName
|
|
|
from cm_shop_order a
|
|
@@ -874,6 +875,7 @@
|
|
|
<select id="findByShopOrderIDs" resultType="newShopOrder">
|
|
|
select distinct<include refid="shopOrderColumns"/>,
|
|
|
co.payTotalFee AS payTotalFee,
|
|
|
+ co.promotionFullReduction AS promotionFullReduction,
|
|
|
bou.name AS buyer,
|
|
|
s.name AS shopName,
|
|
|
c.name AS clubName
|
|
@@ -959,7 +961,7 @@
|
|
|
SELECT CONCAT(shopOrderNo, '(', shopOrderID, ')') AS result
|
|
|
FROM cm_shop_order
|
|
|
WHERE orderID = #{orderID}
|
|
|
- and shopId != 998
|
|
|
+ and shopId != 998
|
|
|
</select>
|
|
|
<select id="findIncome" resultType="java.lang.Double">
|
|
|
SELECT ROUND(IFNULL((
|
|
@@ -1005,92 +1007,90 @@
|
|
|
WHERE shopOrderID = #{shopOrderId}
|
|
|
</update>
|
|
|
|
|
|
- <select id="findSplitList" resultType="newShopOrder">
|
|
|
- SELECT
|
|
|
- co.couponAmount AS couponAmount,
|
|
|
- co.userBeans AS userBeans,
|
|
|
- a.shopOrderID AS shopOrderID,
|
|
|
- a.orderID AS orderID,
|
|
|
- a.organizeID AS organizeID,
|
|
|
- a.shopOrderNo AS shopOrderNo,
|
|
|
- a.orderNo AS orderNo,
|
|
|
- a.userID AS userID,
|
|
|
- a.shopID AS shopID,
|
|
|
- a.itemCount AS itemCount,
|
|
|
- a.townID AS townID,
|
|
|
- a.productAmount AS productAmount,
|
|
|
- a.discountAmount AS discountAmount,
|
|
|
- a.accountAmount AS accountAmount,
|
|
|
- a.totalAmount AS totalAmount,
|
|
|
- a.payFlag AS payFlag,
|
|
|
- a.payTime AS payTime,
|
|
|
- a.finishTime AS finishTime,
|
|
|
- a.refundStatus AS refundStatus,
|
|
|
- a.needPayAmount AS needPayAmount,
|
|
|
- a.canRefundAmount AS canRefundAmount,
|
|
|
- a.refundAmount AS refundAmount,
|
|
|
- a.clubID AS clubID,
|
|
|
- a.spID AS spID,
|
|
|
- a.mainSpID AS mainSpID,
|
|
|
- a.orderBeanAmount AS orderBeanAmount,
|
|
|
- a.useBeanAmount AS useBeanAmount,
|
|
|
- a.useBeanFlag AS useBeanFlag,
|
|
|
- a.canRefundFlag AS canRefundFlag,
|
|
|
- a.useBalanceFlag AS useBalanceFlag,
|
|
|
- a.canRefundBeans AS canRefundBeans,
|
|
|
- a.freePostageFee AS freePostageFee,
|
|
|
- a.freePostageTicketID AS freePostageTicketID,
|
|
|
- a.brokerage AS brokerage,
|
|
|
- a.delFlag AS delFlag,
|
|
|
- a.refundsAmount AS refundsAmount,
|
|
|
- a.orderStatusFlag AS orderStatusFlag,
|
|
|
- a.buyStatus AS buyStatus,
|
|
|
- a.orderSubmitType AS orderSubmitType,
|
|
|
- a.orderType AS orderType,
|
|
|
- a.orderTime AS orderTime,
|
|
|
- a.deliveryTimeMills AS deliveryTimeMills,
|
|
|
- a.presentNum AS presentNum,
|
|
|
- a.preferential AS preferential,
|
|
|
- a.outStoreNum AS outStoreNum,
|
|
|
- IFNULL(a.outStoreTimes, 0) AS outStoreTimes,
|
|
|
- a.splitFlag AS splitFlag,
|
|
|
- a.autoReceiveTimeMills AS autoReceiveTimeMills,
|
|
|
- a.autoOverTimeMills AS autoOverTimeMills,
|
|
|
- a.receiveGoodsTime AS receiveGoodsTime,
|
|
|
- a.totalAddedValueTax AS totalAddedValueTax,
|
|
|
- a.note AS note,
|
|
|
- a.payStatus AS payStatus,
|
|
|
- a.sendOutStatus AS sendOutStatus,
|
|
|
- a.shopProductAmount AS shopProductAmount,
|
|
|
- a.shopPostFee AS shopPostFee,
|
|
|
- a.shopTaxFee AS shopTaxFee,
|
|
|
- a.shouldPayShopAmount AS shouldPayShopAmount,
|
|
|
- a.payedShopAmount AS payedShopAmount,
|
|
|
- a.shopOtherFee AS shopOtherFee,
|
|
|
- a.paying AS paying,
|
|
|
- a.costType AS costType,
|
|
|
- a.modifyShouldPayNote AS modifyShouldPayNote,
|
|
|
- a.orderPromotionsId AS orderPromotionsId,
|
|
|
- a.differenceType AS differenceType,
|
|
|
- a.differencePrice AS differencePrice,
|
|
|
- a.proportional AS proportional,
|
|
|
- a.promotionFullReduction AS promotionFullReduction,
|
|
|
- a.zeroCostFlag AS zeroCostFlag,
|
|
|
- co.payTotalFee AS payTotalFee,
|
|
|
- co.status AS STATUS,
|
|
|
- bou.name AS buyer,
|
|
|
- s.name AS shopName,
|
|
|
- c.name AS clubName
|
|
|
+ <select id="findSplitList" resultType="newShopOrder">
|
|
|
+ SELECT co.couponAmount AS couponAmount,
|
|
|
+ co.userBeans AS userBeans,
|
|
|
+ a.shopOrderID AS shopOrderID,
|
|
|
+ a.orderID AS orderID,
|
|
|
+ a.organizeID AS organizeID,
|
|
|
+ a.shopOrderNo AS shopOrderNo,
|
|
|
+ a.orderNo AS orderNo,
|
|
|
+ a.userID AS userID,
|
|
|
+ a.shopID AS shopID,
|
|
|
+ a.itemCount AS itemCount,
|
|
|
+ a.townID AS townID,
|
|
|
+ a.productAmount AS productAmount,
|
|
|
+ a.discountAmount AS discountAmount,
|
|
|
+ a.accountAmount AS accountAmount,
|
|
|
+ a.totalAmount AS totalAmount,
|
|
|
+ a.payFlag AS payFlag,
|
|
|
+ a.payTime AS payTime,
|
|
|
+ a.finishTime AS finishTime,
|
|
|
+ a.refundStatus AS refundStatus,
|
|
|
+ a.needPayAmount AS needPayAmount,
|
|
|
+ a.canRefundAmount AS canRefundAmount,
|
|
|
+ a.refundAmount AS refundAmount,
|
|
|
+ a.clubID AS clubID,
|
|
|
+ a.spID AS spID,
|
|
|
+ a.mainSpID AS mainSpID,
|
|
|
+ a.orderBeanAmount AS orderBeanAmount,
|
|
|
+ a.useBeanAmount AS useBeanAmount,
|
|
|
+ a.useBeanFlag AS useBeanFlag,
|
|
|
+ a.canRefundFlag AS canRefundFlag,
|
|
|
+ a.useBalanceFlag AS useBalanceFlag,
|
|
|
+ a.canRefundBeans AS canRefundBeans,
|
|
|
+ a.freePostageFee AS freePostageFee,
|
|
|
+ a.freePostageTicketID AS freePostageTicketID,
|
|
|
+ a.brokerage AS brokerage,
|
|
|
+ a.delFlag AS delFlag,
|
|
|
+ a.refundsAmount AS refundsAmount,
|
|
|
+ a.orderStatusFlag AS orderStatusFlag,
|
|
|
+ a.buyStatus AS buyStatus,
|
|
|
+ a.orderSubmitType AS orderSubmitType,
|
|
|
+ a.orderType AS orderType,
|
|
|
+ a.orderTime AS orderTime,
|
|
|
+ a.deliveryTimeMills AS deliveryTimeMills,
|
|
|
+ a.presentNum AS presentNum,
|
|
|
+ a.preferential AS preferential,
|
|
|
+ a.outStoreNum AS outStoreNum,
|
|
|
+ IFNULL(a.outStoreTimes, 0) AS outStoreTimes,
|
|
|
+ a.splitFlag AS splitFlag,
|
|
|
+ a.autoReceiveTimeMills AS autoReceiveTimeMills,
|
|
|
+ a.autoOverTimeMills AS autoOverTimeMills,
|
|
|
+ a.receiveGoodsTime AS receiveGoodsTime,
|
|
|
+ a.totalAddedValueTax AS totalAddedValueTax,
|
|
|
+ a.note AS note,
|
|
|
+ a.payStatus AS payStatus,
|
|
|
+ a.sendOutStatus AS sendOutStatus,
|
|
|
+ a.shopProductAmount AS shopProductAmount,
|
|
|
+ a.shopPostFee AS shopPostFee,
|
|
|
+ a.shopTaxFee AS shopTaxFee,
|
|
|
+ a.shouldPayShopAmount AS shouldPayShopAmount,
|
|
|
+ a.payedShopAmount AS payedShopAmount,
|
|
|
+ a.shopOtherFee AS shopOtherFee,
|
|
|
+ a.paying AS paying,
|
|
|
+ a.costType AS costType,
|
|
|
+ a.modifyShouldPayNote AS modifyShouldPayNote,
|
|
|
+ a.orderPromotionsId AS orderPromotionsId,
|
|
|
+ a.differenceType AS differenceType,
|
|
|
+ a.differencePrice AS differencePrice,
|
|
|
+ a.proportional AS proportional,
|
|
|
+ a.promotionFullReduction AS promotionFullReduction,
|
|
|
+ a.zeroCostFlag AS zeroCostFlag,
|
|
|
+ co.payTotalFee AS payTotalFee,
|
|
|
+ co.status AS STATUS,
|
|
|
+ bou.name AS buyer,
|
|
|
+ s.name AS shopName,
|
|
|
+ c.name AS clubName
|
|
|
FROM cm_shop_order a
|
|
|
- LEFT JOIN cm_pay_shop_record cpsr ON a.shopOrderID = cpsr.shopOrderID
|
|
|
- LEFT JOIN bp_order_userinfo bou ON bou.orderId = a.orderID
|
|
|
- LEFT JOIN cm_order co ON co.orderID = a.orderID
|
|
|
- LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
|
|
|
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
|
|
|
- LEFT JOIN shop s ON s.shopID = a.shopID
|
|
|
- LEFT JOIN club c ON c.userID = a.userID
|
|
|
- WHERE
|
|
|
- co.organizeID = 0
|
|
|
+ LEFT JOIN cm_pay_shop_record cpsr ON a.shopOrderID = cpsr.shopOrderID
|
|
|
+ LEFT JOIN bp_order_userinfo bou ON bou.orderId = a.orderID
|
|
|
+ LEFT JOIN cm_order co ON co.orderID = a.orderID
|
|
|
+ LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
|
|
|
+ LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
|
|
|
+ LEFT JOIN shop s ON s.shopID = a.shopID
|
|
|
+ LEFT JOIN club c ON c.userID = a.userID
|
|
|
+ WHERE co.organizeID = 0
|
|
|
AND co.orderType != 2
|
|
|
AND co.refundType != 2
|
|
|
AND co.delFlag = 0
|
|
@@ -1103,25 +1103,41 @@
|
|
|
AND cror.mbOrderId IS NOT NULL
|
|
|
AND cror.splitStatus = 0
|
|
|
AND co.orderID NOT IN (
|
|
|
- SELECT orderID FROM cm_order_product WHERE productID IN
|
|
|
- (6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069) GROUP BY orderID
|
|
|
+ SELECT orderID
|
|
|
+ FROM cm_order_product
|
|
|
+ WHERE productID IN
|
|
|
+ (6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069)
|
|
|
+ GROUP BY orderID
|
|
|
)
|
|
|
GROUP BY a.shopOrderID
|
|
|
ORDER BY a.shopOrderID DESC
|
|
|
</select>
|
|
|
<select id="getOpenidListByPermission" resultType="java.lang.String">
|
|
|
- SELECT DISTINCT cm.crmopenid FROM `cm_mall_operation_user` cm
|
|
|
- LEFT JOIN `user` u ON u.userID = cm.userID
|
|
|
- WHERE u.userID=#{userid} AND cm.unionId= #{unionid}
|
|
|
+ SELECT DISTINCT cm.crmopenid
|
|
|
+ FROM `cm_mall_operation_user` cm
|
|
|
+ LEFT JOIN `user` u ON u.userID = cm.userID
|
|
|
+ WHERE u.userID = #{userid}
|
|
|
+ AND cm.unionId = #{unionid}
|
|
|
</select>
|
|
|
|
|
|
<select id="getOpenidunionId" resultType="java.lang.String">
|
|
|
- SELECT DISTINCT cm.unionId FROM `cm_mall_operation_user` cm
|
|
|
- LEFT JOIN `user` u ON u.userID = cm.userID
|
|
|
- WHERE u.userID=#{userid} AND cm.id=1068
|
|
|
+ SELECT DISTINCT cm.unionId
|
|
|
+ FROM `cm_mall_operation_user` cm
|
|
|
+ LEFT JOIN `user` u ON u.userID = cm.userID
|
|
|
+ WHERE u.userID = #{userid}
|
|
|
+ AND cm.id = 1068
|
|
|
</select>
|
|
|
<select id="getProductOrder" resultType="java.lang.String">
|
|
|
- SELECT productID FROM `cm_order_product` WHERE orderId=#{orderid}
|
|
|
+ SELECT productID
|
|
|
+ FROM `cm_order_product`
|
|
|
+ WHERE orderId = #{orderid}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="promotionFull" resultMap="java.lang.Double">
|
|
|
+ SELECT promotionFullReduction
|
|
|
+ FROM `cm_order`
|
|
|
+ WHERE orderId = #{orderid}
|
|
|
+
|
|
|
</select>
|
|
|
|
|
|
</mapper>
|