|
@@ -678,4 +678,117 @@
|
|
|
note = #{note}
|
|
|
WHERE shopOrderID = #{shopOrderId}
|
|
|
</update>
|
|
|
+
|
|
|
+ <select id="FromUnionId" resultType="java.lang.String">
|
|
|
+ SELECT unionID
|
|
|
+ FROM `cm_order`
|
|
|
+ WHERE orderID = #{orderId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOpenidListByPermission" resultType="java.lang.String">
|
|
|
+ SELECT openid
|
|
|
+ FROM `wechat_user`
|
|
|
+ WHERE unionid = #{unionid}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getShopOrderMsgy" resultType="com.caimei365.order.model.vo.ShopOrderVo">
|
|
|
+ select
|
|
|
+ co.rebateFee as rebateFee,
|
|
|
+ co.userBeans as userBeans,
|
|
|
+ a.shopOrderID AS shopOrderID,
|
|
|
+ a.shopStatus AS status,
|
|
|
+ a.shopPostFlag AS shopPostFlag,
|
|
|
+ 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.isColdChina AS isColdChina,
|
|
|
+ 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.splitCode,
|
|
|
+ ifnull(a.realPay, a.needPayAmount) AS realPay,
|
|
|
+ a.eachDiscount AS eachDiscount,
|
|
|
+ IFNULL((SELECT SUM(cror.associateAmount)
|
|
|
+ FROM cm_receipt_order_relation cror
|
|
|
+ LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
|
|
|
+ WHERE cror.shopOrderId = a.shopOrderId
|
|
|
+ AND cror.relationType = '2'
|
|
|
+ AND cdr.receiptType = 1
|
|
|
+ AND cdr.delFlag = 0
|
|
|
+ AND cror.delFlag = 0
|
|
|
+ AND cdr.receiptStatus IN (2, 3)
|
|
|
+ AND cdr.payWay != 3)
|
|
|
+ , 0) AS receiptAmount,
|
|
|
+ (ifnull(a.realPay,a.needPayAmount) - ifnull(a.receiptAmount,0)) as restAmount,
|
|
|
+ a.receiptStatus as shopReceiptStatus,
|
|
|
+ a.receiptStatus as ReceiptStatus,
|
|
|
+ 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,
|
|
|
+ ifnull(a.shopPostFee, 0) AS shopPostFee,
|
|
|
+ ifnull(a.shopTaxFee,0) AS shopTaxFee,
|
|
|
+ a.shouldPayShopAmount AS shouldPayShopAmount,
|
|
|
+ a.payedShopAmount AS payedShopAmount,
|
|
|
+ ifnull(a.shopOtherFee, 0) AS shopOtherFee,
|
|
|
+ a.paying AS paying,
|
|
|
+ a.costType AS costType,
|
|
|
+ a.settleStatus AS settleStatus,
|
|
|
+ a.modifyShouldPayNote AS modifyShouldPayNote,
|
|
|
+ a.orderPromotionsId AS orderPromotionsId,
|
|
|
+ a.differenceType AS differenceType,
|
|
|
+ a.differencePrice AS differencePrice,
|
|
|
+ a.proportional AS proportional,
|
|
|
+ ifnull(a.promotionFullReduction, 0) As promotionFullReduction,
|
|
|
+ ifnull(a.couponAmount, 0) As couponAmount,
|
|
|
+ a.zeroCostFlag AS zeroCostFlag,
|
|
|
+ ifnull(a.cmAccountType,0) as cmAccountType,
|
|
|
+ ifnull(a.rebateOrder,0) as rebateOrder,
|
|
|
+ ifnull(a.supplierFreight,0) as supplierFreight
|
|
|
+ from cm_shop_order a
|
|
|
+ left join cm_order co on co.orderID = a.orderID
|
|
|
+ where a.shopOrderID = #{shopOrderID}
|
|
|
+ </select>
|
|
|
</mapper>
|