|
@@ -693,6 +693,90 @@
|
|
|
</update>
|
|
|
|
|
|
<select id="findPayOrderList" resultType="newShopOrder">
|
|
|
+ (select<include refid="shopOrderColumns"/>,
|
|
|
+ co.payTotalFee AS payTotalFee,
|
|
|
+
|
|
|
+ bou.name AS buyer,
|
|
|
+ s.name AS shopName,
|
|
|
+ c.name AS clubName,
|
|
|
+ cdr.payWay AS payWay
|
|
|
+ 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>
|
|
|
+ a.shopOrderId IN( SELECT DISTINCT cror.shopOrderId
|
|
|
+ FROM cm_discern_receipt cdr
|
|
|
+ LEFT JOIN cm_receipt_order_relation cror ON cdr.id=cror.receiptID
|
|
|
+ WHERE cdr.payway = 2
|
|
|
+ )
|
|
|
+ AND (s.shopId = 1161 OR s.AccountOwnership = 0 OR a.splitCode = 'E1807059160')
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
+ AND (a.orderTime > #{startTime} OR a.orderTime = #{startTime})
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
+ AND (a.orderTime < #{endTime} OR a.orderTime = #{endTime})
|
|
|
+ </if>
|
|
|
+ <if test="orderID != null and orderID != ''">
|
|
|
+ AND a.orderID = #{orderID}
|
|
|
+ </if>
|
|
|
+ <if test="organizeID != null and organizeID != 9999">
|
|
|
+ AND co.organizeID = #{organizeID}
|
|
|
+ </if>
|
|
|
+ <if test="organizeID == 9999 ">
|
|
|
+ AND co.orderType = 2
|
|
|
+ </if>
|
|
|
+ <if test="orderNo != null and orderNo != ''">
|
|
|
+ AND a.orderNo like concat('%', #{orderNo} ,'%')
|
|
|
+ </if>
|
|
|
+ <if test="ps != null and ps.length>0 ">
|
|
|
+ AND a.payStatus in
|
|
|
+ <foreach item="item" index="index" collection="ps" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="shopName != null and shopName != ''">
|
|
|
+ AND s.name like concat('%', #{shopName} ,'%')
|
|
|
+ </if>
|
|
|
+ <if test="buyer != null and buyer != ''">
|
|
|
+ AND bou.name like concat('%', #{buyer} ,'%')
|
|
|
+ </if>
|
|
|
+ <if test="clubName != null and clubName != ''">
|
|
|
+ AND c.name like concat('%', #{clubName} ,'%')
|
|
|
+ </if>
|
|
|
+ <if test="shopOrderID != null and shopOrderID != ''">
|
|
|
+ AND a.shopOrderID = #{shopOrderID}
|
|
|
+ </if>
|
|
|
+ <if test="shopOrderNo != null and shopOrderNo != ''">
|
|
|
+ AND a.shopOrderNo like concat('%', #{shopOrderNo} ,'%')
|
|
|
+ </if>
|
|
|
+ and (co.confirmFlag = '1' or co.confirmFlag = '2')
|
|
|
+ <if test="operatingMode != null and operatingMode == '1'.toString()">
|
|
|
+ and a.payStatus != 3 and co.status NOT IN (6,7)
|
|
|
+ </if>
|
|
|
+ <if test="operatingMode != null and operatingMode == '2'.toString()">
|
|
|
+ and a.payStatus != 1 and co.status != 6
|
|
|
+ </if>
|
|
|
+ <if test="operatingMode != null and operatingMode == '3'.toString()">
|
|
|
+ and a.payStatus = 3 and co.status NOT IN (6,7)
|
|
|
+ </if>
|
|
|
+ and co.delFlag = 0
|
|
|
+ -- and not (co.secondHandOrderFlag=1 AND co.rebateFlag=1)
|
|
|
+ and a.delFlag = 0
|
|
|
+ and (a.organizeID!=4 or a.organizeID is null)
|
|
|
+ and a.shopID != 998
|
|
|
+ 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
|
|
|
+ )
|
|
|
+ </where>
|
|
|
+ group by a.shopOrderID)
|
|
|
+ union
|
|
|
+ (
|
|
|
select<include refid="shopOrderColumns"/>,
|
|
|
co.payTotalFee AS payTotalFee,
|
|
|
|
|
@@ -709,6 +793,7 @@
|
|
|
left join shop s on s.shopID = a.shopID
|
|
|
LEFT JOIN club c ON c.userID = a.userID
|
|
|
<where>
|
|
|
+ a.ordertype = 2
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
AND (a.orderTime > #{startTime} OR a.orderTime = #{startTime})
|
|
|
</if>
|
|
@@ -769,7 +854,8 @@
|
|
|
)
|
|
|
</where>
|
|
|
group by a.shopOrderID
|
|
|
- ORDER BY a.shopOrderID DESC
|
|
|
+ )
|
|
|
+ ORDER BY shopOrderID DESC
|
|
|
</select>
|
|
|
|
|
|
<select id="payThirdParties" resultType="newShopOrder">
|