|
@@ -203,14 +203,14 @@
|
|
|
|
|
|
<update id="backPayRecord">
|
|
|
update cm_pay_shop_record
|
|
|
- set status = 0,
|
|
|
+ set status = 0,
|
|
|
payTime = null
|
|
|
where payShopID = #{id}
|
|
|
</update>
|
|
|
|
|
|
<update id="backPayShop">
|
|
|
update cm_pay_shop
|
|
|
- set status = 0,
|
|
|
+ set status = 0,
|
|
|
payTime = null
|
|
|
where id = #{id}
|
|
|
</update>
|
|
@@ -324,9 +324,13 @@
|
|
|
a.payStatus AS payStatus,
|
|
|
a.shopProductAmount AS shopProductAmount,
|
|
|
a.shopPostFee AS shopPostFee,
|
|
|
- ifnull((select sum(payAmount) from cm_pay_shop_record where shopOrderId = a.shopOrderId and status = 1 and delFlag = 0),
|
|
|
+ ifnull((select sum(payAmount)
|
|
|
+ from cm_pay_shop_record
|
|
|
+ where shopOrderId = a.shopOrderId and status = 1 and delFlag = 0),
|
|
|
0) as payedShopAmount,
|
|
|
- ifnull((select sum(payCmAmount) from cm_pay_shop_record where shopOrderId = a.shopOrderId and status = 1 and delFlag = 0),
|
|
|
+ ifnull((select sum(payCmAmount)
|
|
|
+ from cm_pay_shop_record
|
|
|
+ where shopOrderId = a.shopOrderId and status = 1 and delFlag = 0),
|
|
|
0) as payCmAmount,
|
|
|
a.payedShopAmount AS payedShopAmount,
|
|
|
co.payTotalFee AS payTotalFee,
|
|
@@ -368,10 +372,10 @@
|
|
|
AND rp.status = '2'
|
|
|
AND rp.delFlag = '0') AS returnedNum
|
|
|
from cm_order_product cop
|
|
|
- left join cm_sku cs on cop.skuId = cs.skuId
|
|
|
- left join product p on p.productID = cop.productID
|
|
|
- left join cm_order co on co.orderID = cop.orderID
|
|
|
- left join user u on u.userID = co.userID
|
|
|
+ left join cm_sku cs on cop.skuId = cs.skuId
|
|
|
+ left join product p on p.productID = cop.productID
|
|
|
+ left join cm_order co on co.orderID = cop.orderID
|
|
|
+ left join user u on u.userID = co.userID
|
|
|
where cop.shopOrderID = #{shopOrderId}
|
|
|
</select>
|
|
|
|
|
@@ -426,7 +430,7 @@
|
|
|
<select id="findSettleSum" resultType="java.lang.Double">
|
|
|
SELECT IFNULL(SUM(settleAmount), 0)
|
|
|
FROM cm_settle_record
|
|
|
- WHERE settleType = 1
|
|
|
+ WHERE settleType = #{status}
|
|
|
AND shopOrderId = #{shopOrderId}
|
|
|
</select>
|
|
|
|
|
@@ -472,8 +476,10 @@
|
|
|
a.payStatus AS payStatus,
|
|
|
a.shopProductAmount AS shopProductAmount,
|
|
|
a.shopPostFee AS shopPostFee,
|
|
|
- ifnull((select sum(payAmount) from cm_pay_shop_record where shopOrderId = a.shopOrderId and status = 1 and delFlag = 0),0) as payedShopAmount,
|
|
|
- ifnull((select sum(payCmAmount) from cm_pay_shop_record where shopOrderId = a.shopOrderId and status = 1 and delFlag = 0),0) as payCmAmount,
|
|
|
+ ifnull((select sum(payAmount) from cm_pay_shop_record where shopOrderId = a.shopOrderId and status = 1 and
|
|
|
+ delFlag = 0),0) as payedShopAmount,
|
|
|
+ ifnull((select sum(payCmAmount) from cm_pay_shop_record where shopOrderId = a.shopOrderId and status = 1 and
|
|
|
+ delFlag = 0),0) as payCmAmount,
|
|
|
a.payedShopAmount AS payedShopAmount,
|
|
|
co.payTotalFee AS payTotalFee,
|
|
|
s.name AS shopName,
|
|
@@ -490,69 +496,18 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="findOnlinePayCm" resultType="java.lang.Double">
|
|
|
- SELECT SUM(splitAccount)
|
|
|
+ SELECT ifnull(SUM(splitAccount),0)
|
|
|
FROM cm_split_account
|
|
|
WHERE productType = #{status}
|
|
|
AND shoporderid = #{shopOrderId}
|
|
|
</select>
|
|
|
|
|
|
- <select id="findSplitRecord" resultType="com.caimei.modules.order.entity.NewShopOrder">
|
|
|
- SELECT a.payCmAmount AS payCmAmount,
|
|
|
- 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.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.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.orderTime AS orderTime,
|
|
|
- a.presentNum AS presentNum,
|
|
|
- IFNULL(a.outStoreTimes, 0) AS outStoreTimes,
|
|
|
- a.receiveGoodsTime AS receiveGoodsTime,
|
|
|
- a.note AS note,
|
|
|
- a.payStatus AS payStatus,
|
|
|
- a.shopProductAmount AS shopProductAmount,
|
|
|
- a.shopPostFee AS shopPostFee,
|
|
|
- a.shopTaxFee AS shopTaxFee,
|
|
|
- a.shouldPayShopAmount AS shouldPayShopAmount,
|
|
|
- a.payedShopAmount AS payedShopAmount,
|
|
|
- a.paying AS paying,
|
|
|
- b.name as shopName,
|
|
|
- ifnull((select sum(payAmount) from cm_pay_shop_record where shopOrderId = a.shopOrderId and delFlag = 0 and status = 1),
|
|
|
- 0) as payedShopAmount,
|
|
|
- ifnull((select sum(payCmAmount) from cm_pay_shop_record where shopOrderId = a.shopOrderId and delFlag = 0 and status = 1),
|
|
|
- 0) as payCmAmount,
|
|
|
- cps.payTime as splitTime
|
|
|
- FROM cm_pay_shop_record cps
|
|
|
- left join cm_shop_order a on a.shopOrderId = cps.shopOrderID
|
|
|
- left join shop b on a.shopId = b.shopId
|
|
|
- WHERE a.orderId = #{orderId}
|
|
|
- ORDER BY a.shopOrderNo DESC
|
|
|
+ <select id="findSplitRecord" resultType="com.caimei.modules.order.entity.SplitRecord">
|
|
|
+ select shopOrderId,
|
|
|
+ splitAccount,
|
|
|
+ productType,
|
|
|
+ splitTime
|
|
|
+ from cm_split_account
|
|
|
</select>
|
|
|
|
|
|
<select id="findPayShopRecordsByOrder" resultType="com.caimei.modules.order.entity.OrderPayShopRecord">
|
|
@@ -572,9 +527,14 @@
|
|
|
LEFT JOIN cm_offline_collection f ON a.payType = f.type
|
|
|
left join cm_pay_shop cps on a.shopID = cps.shopID
|
|
|
WHERE a.shopOrderID in (select shopOrderId from cm_shop_order where orderId = #{orderId})
|
|
|
- and a.delFlag = 0
|
|
|
- and cps.delFlag = 0
|
|
|
- and a.status = 1
|
|
|
- and cps.status = 1
|
|
|
+ and a.delFlag = 0
|
|
|
+ and cps.delFlag = 0
|
|
|
+ and a.status = 1
|
|
|
+ and cps.status = 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findSettleRecord" resultType="com.caimei.modules.order.entity.SettleRecord">
|
|
|
+ select settleAmount, settleType, shopOrderId, splitCode, settleTime
|
|
|
+ from cm_settle_record
|
|
|
</select>
|
|
|
</mapper>
|