|
@@ -237,21 +237,34 @@
|
|
|
<select id="getUserOrderByPaymentNoOrTransNo" resultType="com.yonge.cooleshow.biz.dal.vo.UserOrderVo">
|
|
|
SELECT
|
|
|
<include refid="baseColumns"/>,
|
|
|
- p1.open_type_ as openType,
|
|
|
- p1.payment_client_ as paymentClient,
|
|
|
- p1.pay_channel_ as payChannel,
|
|
|
- p1.trans_no_ as transNo,
|
|
|
- p1.payment_no_ as paymentNo
|
|
|
+ p.open_type_ as openType,
|
|
|
+ p.payment_client_ as paymentClient,
|
|
|
+ p.pay_channel_ as payChannel,
|
|
|
+ p.trans_no_ as transNo,
|
|
|
+ p.payment_no_ as paymentNo
|
|
|
FROM user_order t
|
|
|
- left join user_order_payment p on t.order_no_ = p.order_no_
|
|
|
- left join user_order_payment p1 on t.order_no_ = p1.order_no_ and (p1.status_ = 'pending' or p1.status_ = 'succeeded')
|
|
|
+ left join user_order_payment p on t.order_no_ = p.order_no_ and (p.status_ = 'pending' or p.status_ = 'succeeded')
|
|
|
<where>
|
|
|
<choose>
|
|
|
<when test="paymentNo != null and paymentNo != ''">
|
|
|
- and p.payment_no_ = #{paymentNo}
|
|
|
+ and (
|
|
|
+ exists (select 1 from user_order_payment p1 where t.order_no_ = p1.order_no_ and p1.payment_no_ = #{paymentNo}) or
|
|
|
+ exists (
|
|
|
+ select 1 from user_order_refund b1
|
|
|
+ left join user_order_refund_bill b2 on b1.id_ = b2.refund_id_
|
|
|
+ where t.order_no_ = b1.order_no_ and b2.bill_no_ = #{paymentNo}
|
|
|
+ )
|
|
|
+ )
|
|
|
</when>
|
|
|
<otherwise>
|
|
|
- and p.trans_no_ = #{transNo}
|
|
|
+ and (
|
|
|
+ exists (select 1 from user_order_payment p1 where p1.trans_no_ = #{transNo}) or
|
|
|
+ exists (
|
|
|
+ select 1 from user_order_refund b1
|
|
|
+ left join user_order_refund_bill b2 on b1.id_ = b2.refund_id_
|
|
|
+ where t.order_no_ = b1.order_no_ and b2.trans_no_ = #{transNo}
|
|
|
+ )
|
|
|
+ )
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
</where>
|