|
@@ -4,7 +4,7 @@
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.caimei.modules.order.dao.NewOrderDao">
|
|
|
<sql id="columns">
|
|
|
- a.orderId AS orderId,
|
|
|
+ a.orderId AS orderId,
|
|
|
a.orderNo AS orderNo,
|
|
|
a.organizeId AS organizeId,
|
|
|
a.userId AS userId,
|
|
@@ -41,175 +41,184 @@
|
|
|
a.sendOutStatus as sendOutStatus,
|
|
|
a.refundType as refundType,
|
|
|
a.postageOrderFlag AS postageOrderFlag
|
|
|
- </sql>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <insert id="insertSplitAccount">
|
|
|
+ INSERT INTO cm_split_account (orderId, productId, orderProductId, shopId, couponRecordId, vipRecordId,
|
|
|
+ authVipRecordId, type, subUserNo, splitAccount,
|
|
|
+ mbOrderId, orderRequestNo, payStatus, productType, shopOrderId, splitTime)
|
|
|
+ VALUES (#{orderId}, #{productId}, #{orderProductId}, #{shopId}, #{couponRecordId}, #{vipRecordId},
|
|
|
+ #{authVipRecordId}, #{type}, #{subUserNo}, #{splitAccount},
|
|
|
+ #{mbOrderId}, #{orderRequestNo}, #{payStatus}, #{productType}, #{shopOrderId}, NOW());
|
|
|
+ </insert>
|
|
|
|
|
|
<update id="update">
|
|
|
- update cm_order
|
|
|
- <set>
|
|
|
- <if test="orderSeen != null">
|
|
|
- orderSeen = #{orderSeen},
|
|
|
- </if>
|
|
|
- <if test="orderNo != null">
|
|
|
- orderNo = #{orderNo,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="userID != null">
|
|
|
- userID = #{userID,jdbcType=BIGINT},
|
|
|
- </if>
|
|
|
- <if test="organizeID != null">
|
|
|
- organizeID = #{organizeID,jdbcType=INTEGER},
|
|
|
- </if>
|
|
|
- <if test="buyUserID != null">
|
|
|
- buyUserID = #{buyUserID,jdbcType=INTEGER},
|
|
|
- </if>
|
|
|
- <if test="shopOrderIDs != null">
|
|
|
- shopOrderIDs = #{shopOrderIDs,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="orderSubmitType != null">
|
|
|
- orderSubmitType = #{orderSubmitType,jdbcType=CHAR},
|
|
|
- </if>
|
|
|
- <if test="orderType != null">
|
|
|
- orderType = #{orderType,jdbcType=CHAR},
|
|
|
- </if>
|
|
|
- <if test="secondHandOrderFlag != null">
|
|
|
- secondHandOrderFlag = #{secondHandOrderFlag,jdbcType=CHAR},
|
|
|
- </if>
|
|
|
- <if test="status != null">
|
|
|
- status = #{status,jdbcType=CHAR},
|
|
|
- </if>
|
|
|
- <if test="productTotalFee != null">
|
|
|
- productTotalFee = #{productTotalFee,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="orderTotalFee != null">
|
|
|
- orderTotalFee = #{orderTotalFee,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="payTotalFee != null">
|
|
|
- payTotalFee = #{payTotalFee,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="payableAmount != null">
|
|
|
- payableAmount = #{payableAmount,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="balancePayFee != null">
|
|
|
- balancePayFee = #{balancePayFee,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="discountFee != null">
|
|
|
- discountFee = #{discountFee,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="spID != null">
|
|
|
- spID = #{spID,jdbcType=BIGINT},
|
|
|
- </if>
|
|
|
- <if test="mainSpID != null">
|
|
|
- mainSpID = #{mainSpID,jdbcType=BIGINT},
|
|
|
- </if>
|
|
|
- <if test="clubID != null">
|
|
|
- clubID = #{clubID,jdbcType=BIGINT},
|
|
|
- </if>
|
|
|
- <if test="clubScanTime != null">
|
|
|
- clubScanTime = #{clubScanTime,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="orderSource != null">
|
|
|
- orderSource = #{orderSource,jdbcType=CHAR},
|
|
|
- </if>
|
|
|
- <if test="orderTime != null">
|
|
|
- orderTime = #{orderTime,jdbcType=TIMESTAMP},
|
|
|
- </if>
|
|
|
- <if test="productCount != null">
|
|
|
- productCount = #{productCount,jdbcType=INTEGER},
|
|
|
- </if>
|
|
|
- <if test="presentCount != null">
|
|
|
- presentCount = #{presentCount,jdbcType=INTEGER},
|
|
|
- </if>
|
|
|
- <if test="confirmFlag != null">
|
|
|
- confirmFlag = #{confirmFlag,jdbcType=CHAR},
|
|
|
- </if>
|
|
|
- <if test="clauseID != null">
|
|
|
- clauseID = #{clauseID,jdbcType=BIGINT},
|
|
|
- </if>
|
|
|
- <if test="clauseName != null">
|
|
|
- clauseName = #{clauseName,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="freePostFlag != null">
|
|
|
- freePostFlag = #{freePostFlag,jdbcType=CHAR},
|
|
|
- </if>
|
|
|
- <if test="freight != null">
|
|
|
- freight = #{freight,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="delFlag != null">
|
|
|
- delFlag = #{delFlag,jdbcType=CHAR},
|
|
|
- </if>
|
|
|
- <if test="note != null">
|
|
|
- note = #{note,jdbcType=LONGVARCHAR},
|
|
|
- </if>
|
|
|
- <if test="clauseContent != null">
|
|
|
- clauseContent = #{clauseContent,jdbcType=LONGVARCHAR},
|
|
|
- </if>
|
|
|
- <if test="payTime != null">
|
|
|
- payTime = #{payTime,jdbcType=LONGVARCHAR},
|
|
|
- </if>
|
|
|
- <if test="preferential != null">
|
|
|
- preferential = #{preferential ,jdbcType=DECIMAL},
|
|
|
- </if>
|
|
|
- <if test="discountFee != null">
|
|
|
- discountFee = #{discountFee},
|
|
|
- </if>
|
|
|
- <if test="payFlag != null">
|
|
|
- payFlag = #{payFlag},
|
|
|
- </if>
|
|
|
- <if test="onlinePayFlag != null">
|
|
|
- onlinePayFlag = #{onlinePayFlag},
|
|
|
- </if>
|
|
|
- <if test="splitFlag != null">
|
|
|
- splitFlag = #{splitFlag},
|
|
|
- </if>
|
|
|
- <if test="closeReason != null">
|
|
|
- closeReason = #{closeReason},
|
|
|
- </if>
|
|
|
- <if test="confirmTime != null">
|
|
|
- confirmTime = #{confirmTime},
|
|
|
- </if>
|
|
|
- <if test="invoiceFlag != null">
|
|
|
- invoiceFlag = #{invoiceFlag},
|
|
|
- </if>
|
|
|
- <if test="postageOrderFlag != null">
|
|
|
- postageOrderFlag = #{postageOrderFlag},
|
|
|
- </if>
|
|
|
- <if test="sendOutStatus != null">
|
|
|
- sendOutStatus = #{sendOutStatus},
|
|
|
- </if>
|
|
|
- <if test="receiptStatus != null">
|
|
|
- receiptStatus = #{receiptStatus},
|
|
|
- </if>
|
|
|
- <if test="payStatus != null">
|
|
|
- payStatus = #{payStatus},
|
|
|
- </if>
|
|
|
- <if test="refundType != null">
|
|
|
- refundType = #{refundType},
|
|
|
- </if>
|
|
|
- <if test="promotionFullReduction != null">
|
|
|
- promotionFullReduction = #{promotionFullReduction},
|
|
|
- </if>
|
|
|
- <if test="promotionalGiftsCount != null">
|
|
|
- promotionalGiftsCount = #{promotionalGiftsCount},
|
|
|
- </if>
|
|
|
- <if test="affirmPaymentFlag != null">
|
|
|
- affirmPaymentFlag = #{affirmPaymentFlag},
|
|
|
- </if>
|
|
|
- <if test="rebateFlag != null">
|
|
|
- rebateFlag = #{rebateFlag},
|
|
|
- </if>
|
|
|
- <if test="rebateFee != null">
|
|
|
- rebateFee = #{rebateFee},
|
|
|
- </if>
|
|
|
- <if test="zeroCostFlag != null">
|
|
|
- zeroCostFlag = #{zeroCostFlag},
|
|
|
- </if>
|
|
|
- <if test="couponAmount != null">
|
|
|
- couponAmount = #{couponAmount},
|
|
|
- </if>
|
|
|
- <if test="svipFullReduction != null">
|
|
|
- svipFullReduction = #{svipFullReduction}
|
|
|
- </if>
|
|
|
- </set>
|
|
|
- where orderID = #{orderId}
|
|
|
+ update cm_order
|
|
|
+ <set>
|
|
|
+ <if test="orderSeen != null">
|
|
|
+ orderSeen = #{orderSeen},
|
|
|
+ </if>
|
|
|
+ <if test="orderNo != null">
|
|
|
+ orderNo = #{orderNo,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="userID != null">
|
|
|
+ userID = #{userID,jdbcType=BIGINT},
|
|
|
+ </if>
|
|
|
+ <if test="organizeID != null">
|
|
|
+ organizeID = #{organizeID,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="buyUserID != null">
|
|
|
+ buyUserID = #{buyUserID,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="shopOrderIDs != null">
|
|
|
+ shopOrderIDs = #{shopOrderIDs,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="orderSubmitType != null">
|
|
|
+ orderSubmitType = #{orderSubmitType,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="orderType != null">
|
|
|
+ orderType = #{orderType,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="secondHandOrderFlag != null">
|
|
|
+ secondHandOrderFlag = #{secondHandOrderFlag,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ status = #{status,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="productTotalFee != null">
|
|
|
+ productTotalFee = #{productTotalFee,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="orderTotalFee != null">
|
|
|
+ orderTotalFee = #{orderTotalFee,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="payTotalFee != null">
|
|
|
+ payTotalFee = #{payTotalFee,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="payableAmount != null">
|
|
|
+ payableAmount = #{payableAmount,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="balancePayFee != null">
|
|
|
+ balancePayFee = #{balancePayFee,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="discountFee != null">
|
|
|
+ discountFee = #{discountFee,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="spID != null">
|
|
|
+ spID = #{spID,jdbcType=BIGINT},
|
|
|
+ </if>
|
|
|
+ <if test="mainSpID != null">
|
|
|
+ mainSpID = #{mainSpID,jdbcType=BIGINT},
|
|
|
+ </if>
|
|
|
+ <if test="clubID != null">
|
|
|
+ clubID = #{clubID,jdbcType=BIGINT},
|
|
|
+ </if>
|
|
|
+ <if test="clubScanTime != null">
|
|
|
+ clubScanTime = #{clubScanTime,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="orderSource != null">
|
|
|
+ orderSource = #{orderSource,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="orderTime != null">
|
|
|
+ orderTime = #{orderTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="productCount != null">
|
|
|
+ productCount = #{productCount,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="presentCount != null">
|
|
|
+ presentCount = #{presentCount,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="confirmFlag != null">
|
|
|
+ confirmFlag = #{confirmFlag,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="clauseID != null">
|
|
|
+ clauseID = #{clauseID,jdbcType=BIGINT},
|
|
|
+ </if>
|
|
|
+ <if test="clauseName != null">
|
|
|
+ clauseName = #{clauseName,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="freePostFlag != null">
|
|
|
+ freePostFlag = #{freePostFlag,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="freight != null">
|
|
|
+ freight = #{freight,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="delFlag != null">
|
|
|
+ delFlag = #{delFlag,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="note != null">
|
|
|
+ note = #{note,jdbcType=LONGVARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="clauseContent != null">
|
|
|
+ clauseContent = #{clauseContent,jdbcType=LONGVARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="payTime != null">
|
|
|
+ payTime = #{payTime,jdbcType=LONGVARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="preferential != null">
|
|
|
+ preferential = #{preferential ,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="discountFee != null">
|
|
|
+ discountFee = #{discountFee},
|
|
|
+ </if>
|
|
|
+ <if test="payFlag != null">
|
|
|
+ payFlag = #{payFlag},
|
|
|
+ </if>
|
|
|
+ <if test="onlinePayFlag != null">
|
|
|
+ onlinePayFlag = #{onlinePayFlag},
|
|
|
+ </if>
|
|
|
+ <if test="splitFlag != null">
|
|
|
+ splitFlag = #{splitFlag},
|
|
|
+ </if>
|
|
|
+ <if test="closeReason != null">
|
|
|
+ closeReason = #{closeReason},
|
|
|
+ </if>
|
|
|
+ <if test="confirmTime != null">
|
|
|
+ confirmTime = #{confirmTime},
|
|
|
+ </if>
|
|
|
+ <if test="invoiceFlag != null">
|
|
|
+ invoiceFlag = #{invoiceFlag},
|
|
|
+ </if>
|
|
|
+ <if test="postageOrderFlag != null">
|
|
|
+ postageOrderFlag = #{postageOrderFlag},
|
|
|
+ </if>
|
|
|
+ <if test="sendOutStatus != null">
|
|
|
+ sendOutStatus = #{sendOutStatus},
|
|
|
+ </if>
|
|
|
+ <if test="receiptStatus != null">
|
|
|
+ receiptStatus = #{receiptStatus},
|
|
|
+ </if>
|
|
|
+ <if test="payStatus != null">
|
|
|
+ payStatus = #{payStatus},
|
|
|
+ </if>
|
|
|
+ <if test="refundType != null">
|
|
|
+ refundType = #{refundType},
|
|
|
+ </if>
|
|
|
+ <if test="promotionFullReduction != null">
|
|
|
+ promotionFullReduction = #{promotionFullReduction},
|
|
|
+ </if>
|
|
|
+ <if test="promotionalGiftsCount != null">
|
|
|
+ promotionalGiftsCount = #{promotionalGiftsCount},
|
|
|
+ </if>
|
|
|
+ <if test="affirmPaymentFlag != null">
|
|
|
+ affirmPaymentFlag = #{affirmPaymentFlag},
|
|
|
+ </if>
|
|
|
+ <if test="rebateFlag != null">
|
|
|
+ rebateFlag = #{rebateFlag},
|
|
|
+ </if>
|
|
|
+ <if test="rebateFee != null">
|
|
|
+ rebateFee = #{rebateFee},
|
|
|
+ </if>
|
|
|
+ <if test="zeroCostFlag != null">
|
|
|
+ zeroCostFlag = #{zeroCostFlag},
|
|
|
+ </if>
|
|
|
+ <if test="couponAmount != null">
|
|
|
+ couponAmount = #{couponAmount},
|
|
|
+ </if>
|
|
|
+ <if test="svipFullReduction != null">
|
|
|
+ svipFullReduction = #{svipFullReduction}
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where orderID = #{orderId}
|
|
|
</update>
|
|
|
|
|
|
<update id="updatePayStatus">
|
|
@@ -218,6 +227,19 @@
|
|
|
where orderID = #{orderId}
|
|
|
</update>
|
|
|
|
|
|
+ <update id="updateShopOrderByPayStatus">
|
|
|
+ UPDATE cm_shop_order
|
|
|
+ SET payStatus = #{payStatus},
|
|
|
+ payedShopAmount = #{paidShop}
|
|
|
+ WHERE shopOrderID = #{shopOrderId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="updateBySplitStatus">
|
|
|
+ UPDATE cm_receipt_order_relation
|
|
|
+ SET splitStatus = 1
|
|
|
+ WHERE mbOrderId = #{mbOrderId}
|
|
|
+ </update>
|
|
|
+
|
|
|
<resultMap id="orderDisplayList" type="com.caimei.modules.order.entity.NewOrder">
|
|
|
<id column="orderId" property="orderId"/>
|
|
|
<result column="orderNo" property="orderNo"/>
|
|
@@ -251,7 +273,8 @@
|
|
|
co.sendOutStatus AS sendOutStatus,
|
|
|
co.receiptStatus AS receiptStatus,
|
|
|
co.productCount AS productCount,
|
|
|
- (SELECT IFNULL(sum(cop.shouldPayFee),0) FROM cm_order_product cop WHERE cop.orderId=co.orderId) AS "shouldPayProduct",
|
|
|
+ (SELECT IFNULL(sum(cop.shouldPayFee),0) FROM cm_order_product cop WHERE cop.orderId=co.orderId) AS
|
|
|
+ "shouldPayProduct",
|
|
|
co.status AS status,
|
|
|
co.postageOrderFlag AS postageOrderFlag
|
|
|
FROM cm_order co
|
|
@@ -315,7 +338,8 @@
|
|
|
<if test="returnedPurchaseStatus == 0">
|
|
|
not exists
|
|
|
</if>
|
|
|
- (select 1 from cm_returned_purchase c3 where c3.status = '1' and c3.orderId = co.orderId and c3.delFlag = 0)
|
|
|
+ (select 1 from cm_returned_purchase c3 where c3.status = '1' and c3.orderId = co.orderId and c3.delFlag
|
|
|
+ = 0)
|
|
|
</if>
|
|
|
<if test="refundType != null and refundType != ''">
|
|
|
AND
|
|
@@ -331,16 +355,20 @@
|
|
|
</if>
|
|
|
<if test="orderRefundType != null and orderRefundType != ''">
|
|
|
<if test="orderRefundType == 0">
|
|
|
- AND (select count(1) from cm_returned_purchase crp where co.orderId = crp.orderId and crp.delFlag = 0) = 0
|
|
|
+ AND (select count(1) from cm_returned_purchase crp where co.orderId = crp.orderId and crp.delFlag =
|
|
|
+ 0) = 0
|
|
|
</if>
|
|
|
<if test="orderRefundType == 1">
|
|
|
- AND (select count(1) from cm_returned_purchase crp where co.orderId = crp.orderId and crp.delFlag = 0) > 0
|
|
|
+ AND (select count(1) from cm_returned_purchase crp where co.orderId = crp.orderId and crp.delFlag =
|
|
|
+ 0) > 0
|
|
|
</if>
|
|
|
<if test="orderRefundType == 11">
|
|
|
- AND (select count(1) from cm_returned_purchase crp where co.orderId = crp.orderId and crp.status = 1 and crp.delFlag = 0) > 0
|
|
|
+ AND (select count(1) from cm_returned_purchase crp where co.orderId = crp.orderId and crp.status = 1
|
|
|
+ and crp.delFlag = 0) > 0
|
|
|
</if>
|
|
|
<if test="orderRefundType == 12">
|
|
|
- AND (select count(1) from cm_returned_purchase crp where co.orderId = crp.orderId and crp.status = 2 and crp.delFlag = 0
|
|
|
+ AND (select count(1) from cm_returned_purchase crp where co.orderId = crp.orderId and crp.status = 2
|
|
|
+ and crp.delFlag = 0
|
|
|
<if test="startRefundTime != null and startRefundTime != ''">
|
|
|
AND crp.confirmReturnTime <![CDATA[ >= ]]> #{startRefundTime}
|
|
|
</if>
|
|
@@ -350,31 +378,201 @@
|
|
|
) > 0
|
|
|
</if>
|
|
|
<if test="orderRefundType == 13">
|
|
|
- AND (select count(1) from cm_returned_purchase crp where co.orderId = crp.orderId and crp.status = 3 and crp.delFlag = 0) > 0
|
|
|
+ AND (select count(1) from cm_returned_purchase crp where co.orderId = crp.orderId and crp.status = 3
|
|
|
+ and crp.delFlag = 0) > 0
|
|
|
</if>
|
|
|
</if>
|
|
|
AND co.delFlag = 0
|
|
|
</where>
|
|
|
- ORDER BY co.orderId DESC, co.orderTime DESC
|
|
|
+ ORDER BY co.orderId DESC, co.orderTime DESC
|
|
|
</select>
|
|
|
|
|
|
<select id="loadShopOrders" parameterType="string" resultType="com.caimei.modules.order.entity.NewShopOrder">
|
|
|
- SELECT
|
|
|
- cs.shopOrderId AS shopOrderId,
|
|
|
- cs.shopOrderNo AS shopOrderNo,
|
|
|
- cs.shopOrderNo AS shopOrderNo,
|
|
|
- cs.itemCount AS itemCount,
|
|
|
- cs.needPayAmount AS needPayAmount,
|
|
|
- s.name AS shopName,
|
|
|
- cs.shopId AS shopId
|
|
|
- FROM cm_shop_order cs
|
|
|
- LEFT JOIN shop s ON cs.shopId = s.shopId
|
|
|
- WHERE cs.orderNo = #{orderNo} AND cs.delFlag = 0
|
|
|
- </select>
|
|
|
+ SELECT cs.shopOrderId AS shopOrderId,
|
|
|
+ cs.shopOrderNo AS shopOrderNo,
|
|
|
+ cs.shopOrderNo AS shopOrderNo,
|
|
|
+ cs.itemCount AS itemCount,
|
|
|
+ cs.needPayAmount AS needPayAmount,
|
|
|
+ s.name AS shopName,
|
|
|
+ cs.shopId AS shopId
|
|
|
+ FROM cm_shop_order cs
|
|
|
+ LEFT JOIN shop s ON cs.shopId = s.shopId
|
|
|
+ WHERE cs.orderNo = #{orderNo}
|
|
|
+ AND cs.delFlag = 0
|
|
|
+ </select>
|
|
|
|
|
|
<select id="get" resultType="com.caimei.modules.order.entity.NewOrder">
|
|
|
- SELECT <include refid="columns"/>
|
|
|
+ SELECT
|
|
|
+ <include refid="columns"/>
|
|
|
FROM cm_order a
|
|
|
WHERE a.orderId = #{id}
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getUndividedPaidReceipt" resultType="com.caimei.modules.order.entity.CmReceiptOrderRelation">
|
|
|
+ SELECT cror.id,
|
|
|
+ cror.relationType,
|
|
|
+ cror.receiptId,
|
|
|
+ cror.associateAmount,
|
|
|
+ cror.orderId,
|
|
|
+ cror.delFlag,
|
|
|
+ cror.mbOrderId,
|
|
|
+ cror.orderRequestNo,
|
|
|
+ cror.splitStatus,
|
|
|
+ cror.shopOrderId,
|
|
|
+ cdr.payType
|
|
|
+ FROM cm_receipt_order_relation cror
|
|
|
+ LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
|
|
|
+ LEFT JOIN cm_order co ON cror.orderID = co.orderID
|
|
|
+ left join cm_shop_order cso on cso.orderId = cror.orderID
|
|
|
+ LEFT JOIN cm_order_product cop ON co.shopOrderIDs = cop.shopOrderID
|
|
|
+ LEFT JOIN product p ON cop.productID = p.productID
|
|
|
+ WHERE cror.relationType = 2
|
|
|
+ and cror.shopOrderId = #{shopOrderId}
|
|
|
+ AND cso.receiptStatus = 3
|
|
|
+ AND cror.delFlag = 0
|
|
|
+ AND cror.mbOrderId IS NOT NULL
|
|
|
+ AND cror.splitStatus = 0
|
|
|
+ AND cdr.payWay = 1
|
|
|
+ AND cdr.receiptDate <![CDATA[ <= ]]> #{currentTime}
|
|
|
+ AND co.organizeID = 0
|
|
|
+ AND co.orderType != 2
|
|
|
+ AND co.refundType != 2
|
|
|
+ AND p.splitCode != 'E1807059160'
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getShopOrderListByOrderId" resultType="com.caimei.modules.order.entity.NewShopOrder">
|
|
|
+ SELECT shopOrderID AS shopOrderId,
|
|
|
+ shopOrderNo,
|
|
|
+ orderID AS orderId,
|
|
|
+ orderNo,
|
|
|
+ shopID AS shopId,
|
|
|
+ note,
|
|
|
+ userID AS userId,
|
|
|
+ clubID AS clubId,
|
|
|
+ spID AS spId,
|
|
|
+ brokerage,
|
|
|
+ itemCount,
|
|
|
+ totalAmount,
|
|
|
+ productAmount,
|
|
|
+ needPayAmount,
|
|
|
+ shopProductAmount,
|
|
|
+ shopPostFee,
|
|
|
+ shouldPayShopAmount,
|
|
|
+ orderTime,
|
|
|
+ payStatus,
|
|
|
+ splitCode
|
|
|
+ FROM cm_shop_order
|
|
|
+ WHERE delFlag = 0
|
|
|
+ AND shopOrderID = #{shopOrderId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getSplitAccountList" resultType="com.caimei.modules.order.entity.SplitAccountPo">
|
|
|
+ SELECT id,
|
|
|
+ orderId,
|
|
|
+ productId,
|
|
|
+ orderProductId,
|
|
|
+ shopId,
|
|
|
+ type,
|
|
|
+ subUserNo,
|
|
|
+ SUM(splitAccount) AS splitAccount,
|
|
|
+ mbOrderId,
|
|
|
+ orderRequestNo,
|
|
|
+ payStatus,
|
|
|
+ productType
|
|
|
+ FROM cm_split_account
|
|
|
+ WHERE type = 4
|
|
|
+ AND payStatus = 1
|
|
|
+ AND splitAccount > 0
|
|
|
+ AND mbOrderId = #{mbOrderId}
|
|
|
+ GROUP BY shopId
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getShopOrderByOrderId" resultType="com.caimei.modules.order.entity.NewShopOrder">
|
|
|
+ SELECT shopOrderID AS shopOrderId,
|
|
|
+ shopOrderNo,
|
|
|
+ orderID AS orderId,
|
|
|
+ orderNo,
|
|
|
+ shopID AS shopId,
|
|
|
+ note,
|
|
|
+ userID AS userId,
|
|
|
+ clubID AS clubId,
|
|
|
+ spID AS spId,
|
|
|
+ orderPromotionsId,
|
|
|
+ promotionFullReduction,
|
|
|
+ brokerage,
|
|
|
+ canRefundAmount,
|
|
|
+ itemCount,
|
|
|
+ totalAmount,
|
|
|
+ productAmount,
|
|
|
+ needPayAmount,
|
|
|
+ shopProductAmount,
|
|
|
+ shopPostFee,
|
|
|
+ shopTaxFee,
|
|
|
+ shouldPayShopAmount,
|
|
|
+ orderTime,
|
|
|
+ orderSubmitType,
|
|
|
+ payStatus,
|
|
|
+ sendOutStatus,
|
|
|
+ splitFlag,
|
|
|
+ splitCode
|
|
|
+ FROM cm_shop_order
|
|
|
+ WHERE delFlag = 0
|
|
|
+ AND orderID = #{orderId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getPaidShopAmount" resultType="java.lang.Double">
|
|
|
+ SELECT SUM(payAmount)
|
|
|
+ FROM cm_pay_shop_record
|
|
|
+ WHERE STATUS = 1
|
|
|
+ AND delFlag = 0
|
|
|
+ AND shopOrderID = #{shopOrderId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOrderProductByShopOrderId" resultType="com.caimei.modules.order.entity.NewOrderProduct">
|
|
|
+ SELECT cop.orderProductID AS orderProductId,
|
|
|
+ cop.orderID AS orderId,
|
|
|
+ cop.orderNo,
|
|
|
+ cop.shopOrderID AS shopOrderId,
|
|
|
+ cop.shopOrderNo,
|
|
|
+ cop.productId,
|
|
|
+ cop.shopId,
|
|
|
+ cop.name,
|
|
|
+ cop.productImage AS image,
|
|
|
+ cop.price,
|
|
|
+ cop.shopName,
|
|
|
+ IF(cop.shopid = 998 AND co.freight > 0, co.freight, cop.costPrice) AS costPrice,
|
|
|
+ cop.normalPrice,
|
|
|
+ cop.totalAmount,
|
|
|
+ cop.totalFee,
|
|
|
+ cop.shouldPayFee,
|
|
|
+ cop.productUnit,
|
|
|
+ cop.num,
|
|
|
+ cop.presentNum,
|
|
|
+ cop.discountFee,
|
|
|
+ cop.shopProductAmount,
|
|
|
+ cop.singleShopFee,
|
|
|
+ cop.shopFee,
|
|
|
+ cop.singleCmFee,
|
|
|
+ cop.cmFee,
|
|
|
+ p.productCategory as productCategory,
|
|
|
+ p.splitCode,
|
|
|
+ cmp.cmPercent,
|
|
|
+ cmp.organizePercent,
|
|
|
+ cmp.shopPercent
|
|
|
+ FROM cm_order_product cop
|
|
|
+ LEFT JOIN product p ON cop.productID = p.productID
|
|
|
+ left join cm_order co on co.orderID = cop.orderID
|
|
|
+ left join cm_mall_product_sku cmp on cop.organizeSkuId = cmp.id
|
|
|
+ WHERE cop.shopOrderID = #{shopOrderId}
|
|
|
+ AND IF(co.userBeans = 0, 1 = 1, cop.shopid != 998)
|
|
|
+ ORDER BY cop.discountPrice DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOrderProductPaidAmount" resultType="java.lang.Double">
|
|
|
+ SELECT SUM(splitAccount)
|
|
|
+ FROM cm_split_account
|
|
|
+ WHERE orderProductId = #{orderProductId}
|
|
|
+ AND payStatus = 1
|
|
|
+ AND productType = 1
|
|
|
+ </select>
|
|
|
</mapper>
|