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
DELETE
FROM cm_shop_order
WHERE orderID = #{orderID}
INSERT INTO cm_shop_order(orderID,
shopOrderNo,
orderNo,
userID,
shopID,
itemCount,
townID,
productAmount,
discountAmount,
accountAmount,
totalAmount,
payFlag,
payTime,
finishTime,
refundStatus,
needPayAmount,
canRefundAmount,
refundAmount,
clubID,
spID,
mainSpID,
orderBeanAmount,
useBeanAmount,
useBeanFlag,
canRefundFlag,
useBalanceFlag,
canRefundBeans,
freePostageFee,
freePostageTicketID,
brokerage,
delFlag,
refundsAmount,
orderStatusFlag,
buyStatus,
orderSubmitType,
orderType,
orderTime,
deliveryTimeMills,
presentNum,
preferential,
splitFlag,
autoReceiveTimeMills,
autoOverTimeMills,
totalAddedValueTax,
receiveGoodsTime,
sendOutStatus,
payStatus,
costType,
orderPromotionsId,
promotionFullReduction,
zeroCostFlag,
svipShopReduction)
VALUES (#{orderID},
#{shopOrderNo},
#{orderNo},
#{userID},
#{shopID},
#{itemCount},
#{townID},
#{productAmount},
#{discountAmount},
#{accountAmount},
#{totalAmount},
#{payFlag},
#{payTime},
#{finishTime},
#{refundStatus},
#{needPayAmount},
#{canRefundAmount},
#{refundAmount},
#{clubID},
#{spID},
#{mainSpID},
#{orderBeanAmount},
#{useBeanAmount},
#{useBeanFlag},
#{canRefundFlag},
#{useBalanceFlag},
#{canRefundBeans},
#{freePostageFee},
#{freePostageTicketID},
#{brokerage},
#{delFlag},
#{refundsAmount},
#{orderStatusFlag},
#{buyStatus},
#{orderSubmitType},
#{orderType},
#{orderTime},
#{deliveryTimeMills},
#{presentNum},
#{preferential},
#{splitFlag},
#{autoReceiveTimeMills},
#{autoOverTimeMills},
#{totalAddedValueTax},
#{receiveGoodsTime},
#{sendOutStatus},
#{payStatus},
#{costType},
#{orderPromotionsId},
#{promotionFullReduction},
#{zeroCostFlag},
#{svipShopReduction})
update cm_shop_order
shopOrderNo = #{shopOrderNo},
orderID = #{orderID},
orderNo = #{orderNo},
userID = #{userID},
shopID = #{shopID},
itemCount = #{itemCount},
townID = #{townID,jdbcType=INTEGER},
productAmount = #{productAmount},
discountAmount = #{discountAmount},
accountAmount = #{accountAmount},
totalAmount = #{totalAmount},
payFlag = #{payFlag},
payTime = #{payTime},
finishTime = #{finishTime},
refundStatus = #{refundStatus},
needPayAmount = #{needPayAmount},
canRefundAmount = #{canRefundAmount},
refundAmount = #{refundAmount},
clubID = #{clubID},
spID = #{spID,jdbcType=INTEGER},
mainSpID = #{mainSpID},
orderBeanAmount = #{orderBeanAmount},
useBeanAmount = #{useBeanAmount},
useBeanFlag = #{useBeanFlag},
canRefundFlag = #{canRefundFlag},
useBalanceFlag = #{useBalanceFlag},
canRefundBeans = #{canRefundBeans},
freePostageFee = #{freePostageFee},
freePostageTicketID = #{freePostageTicketID},
brokerage = #{brokerage},
delFlag = #{delFlag},
refundsAmount = #{refundsAmount},
orderStatusFlag = #{orderStatusFlag},
buyStatus = #{buyStatus},
deliveryTimeMills = #{deliveryTimeMills},
orderSubmitType = #{orderSubmitType},
orderType = #{orderType},
orderTime = #{orderTime},
presentNum = #{presentNum},
preferential = #{preferential},
outStoreNum = #{outStoreNum},
outStoreTimes = #{outStoreTimes},
splitFlag = #{splitFlag},
autoReceiveTimeMills = #{autoReceiveTimeMills},
autoOverTimeMills = #{autoOverTimeMills},
receiveGoodsTime = #{receiveGoodsTime},
totalAddedValueTax = #{totalAddedValueTax},
note = #{note},
sendOutStatus = #{sendOutStatus},
paying = #{paying},
shopProductAmount = #{shopProductAmount},
shopPostFee = #{shopPostFee},
shopTaxFee = #{shopTaxFee},
shouldPayShopAmount = #{shouldPayShopAmount},
payedShopAmount = #{payedShopAmount},
shopOtherFee = #{shopOtherFee},
payStatus = #{payStatus},
costType = #{costType},
proportional = #{proportional},
modifyShouldPayNote = #{modifyShouldPayNote},
modifyShouldPayUserID = #{modifyShouldPayUserID},
modifyShouldPayDate = #{modifyShouldPayDate},
orderPromotionsId = #{orderPromotionsId},
promotionFullReduction = #{promotionFullReduction},
zeroCostFlag = #{zeroCostFlag},
svipShopReduction = #{svipShopReduction}
AND shopOrderID = #{shopOrderID}
AND orderID = #{orderID}
DELETE
FROM cm_shop_order
WHERE shopOrderID = #{shopOrderID}
INSERT INTO cm_shop_order_bak(orderID,
shopOrderNo,
orderNo,
userID,
shopID,
itemCount,
townID,
productAmount,
discountAmount,
accountAmount,
totalAmount,
payFlag,
payTime,
finishTime,
refundStatus,
needPayAmount,
canRefundAmount,
refundAmount,
clubID,
spID,
mainSpID,
orderBeanAmount,
useBeanAmount,
useBeanFlag,
canRefundFlag,
useBalanceFlag,
canRefundBeans,
freePostageFee,
freePostageTicketID,
brokerage,
delFlag,
refundsAmount,
orderStatusFlag,
buyStatus,
orderSubmitType,
orderType,
orderTime,
deliveryTimeMills,
presentNum,
preferential)
VALUES (#{orderID},
#{shopOrderNo},
#{orderNo},
#{userID},
#{shopID},
#{itemCount},
#{townID},
#{productAmount},
#{discountAmount},
#{accountAmount},
#{totalAmount},
#{payFlag},
#{payTime},
#{finishTime},
#{refundStatus},
#{needPayAmount},
#{canRefundAmount},
#{refundAmount},
#{clubID},
#{spID},
#{mainSpID},
#{orderBeanAmount},
#{useBeanAmount},
#{useBeanFlag},
#{canRefundFlag},
#{useBalanceFlag},
#{canRefundBeans},
#{freePostageFee},
#{freePostageTicketID},
#{brokerage},
#{delFlag},
#{refundsAmount},
#{orderStatusFlag},
#{buyStatus},
#{orderSubmitType},
#{orderType},
#{orderTime},
#{deliveryTimeMills},
#{presentNum},
#{preferential})
UPDATE bp_order
SET status = #{orderStatus}
WHERE id = #{orderId}
UPDATE cm_shop_order
SET note = #{note}
WHERE shopOrderID = #{shopOrderID}
update cm_shop_order
shopOrderNo = #{shopOrderNo},
orderID = #{orderID},
orderNo = #{orderNo},
userID = #{userID},
shopID = #{shopID},
itemCount = #{itemCount},
townID = #{townID,jdbcType=INTEGER},
productAmount = #{productAmount},
discountAmount = #{discountAmount},
accountAmount = #{accountAmount},
totalAmount = #{totalAmount},
payFlag = #{payFlag},
payTime = #{payTime},
finishTime = #{finishTime},
refundStatus = #{refundStatus},
needPayAmount = #{needPayAmount},
canRefundAmount = #{canRefundAmount},
refundAmount = #{refundAmount},
clubID = #{clubID},
spID = #{spID,jdbcType=INTEGER},
mainSpID = #{mainSpID},
orderBeanAmount = #{orderBeanAmount},
useBeanAmount = #{useBeanAmount},
useBeanFlag = #{useBeanFlag},
canRefundFlag = #{canRefundFlag},
useBalanceFlag = #{useBalanceFlag},
canRefundBeans = #{canRefundBeans},
freePostageFee = #{freePostageFee},
freePostageTicketID = #{freePostageTicketID},
brokerage = #{brokerage},
delFlag = #{delFlag},
refundsAmount = #{refundsAmount},
orderStatusFlag = #{orderStatusFlag},
buyStatus = #{buyStatus},
deliveryTimeMills = #{deliveryTimeMills},
orderSubmitType = #{orderSubmitType},
orderType = #{orderType},
orderTime = #{orderTime},
presentNum = #{presentNum},
preferential = #{preferential},
outStoreNum = #{outStoreNum},
outStoreTimes = #{outStoreTimes},
splitFlag = #{splitFlag},
autoReceiveTimeMills = #{autoReceiveTimeMills},
autoOverTimeMills = #{autoOverTimeMills},
receiveGoodsTime = #{receiveGoodsTime},
totalAddedValueTax = #{totalAddedValueTax},
note = #{note},
sendOutStatus = #{sendOutStatus}
where shopOrderID = #{shopOrderID}
update cm_shop_order
set paying = #{paying}
where shopOrderID = #{shopOrderID}
update cm_shop_order
set paying = '0'
where shopOrderID in
(select cpsr.shopOrderID
from cm_pay_shop_record cpsr
left join cm_pay_shop cps on cps.id = cpsr.payShopID
where cps.id = #{payShopID}
and cps.delFlag = '0'
and cpsr.delFlag = '0'
and cpsr.shopOrderID is not null)
update cm_shop_order
set paying = '1'
where shopOrderID in
(select cpsr.shopOrderID
from cm_pay_shop_record cpsr
left join cm_pay_shop cps on cps.id = cpsr.payShopID
where cps.id = #{payShopID}
and cps.delFlag = '0'
and cpsr.delFlag = '0'
and cpsr.shopOrderID is not null)
update cm_shop_order
set payStatus = #{payStatus}
where shopOrderID = #{shopOrderID}
UPDATE cm_shop_order
SET shopOtherFee = #{shopOtherFee}
WHERE shopOrderID = #{shopOrderId}
UPDATE cm_shop_order
SET differenceType = #{type},
differencePrice = #{differencePrice}
WHERE shopOrderID = #{shopOrderId}