TASK:优化订阅收件人列表创建方式
This commit is contained in:
@@ -51,47 +51,41 @@
|
||||
a.user_email email,
|
||||
p.payment_type platform,
|
||||
p.payer_total,
|
||||
p.type,
|
||||
CASE
|
||||
WHEN o.title LIKE '%Subscription' THEN 'Subscription'
|
||||
ELSE 'Credits'
|
||||
END AS type,
|
||||
p.payment_method,
|
||||
p.last4,
|
||||
p.country,
|
||||
p.city,
|
||||
p.create_time,
|
||||
CASE
|
||||
|
||||
WHEN p.trade_state IN ( 'paid', 'COMPLETED', 'complete', 'liquidated' ) THEN
|
||||
'Success'
|
||||
WHEN p.trade_state IN ( 'failed', 'expired', 'VOIDED', 'void', 'uncollectible' ) THEN
|
||||
'Fail'
|
||||
WHEN p.trade_state IN ( 'Refunded' ) THEN
|
||||
'Refunded'
|
||||
WHEN p.trade_state IN ('paid', 'COMPLETED', 'complete', 'liquidated') THEN 'Success'
|
||||
WHEN p.trade_state IN ('failed', 'expired', 'VOIDED', 'void', 'uncollectible') THEN 'Fail'
|
||||
WHEN p.trade_state IN ('Refunded') THEN 'Refunded'
|
||||
ELSE 'Pending'
|
||||
END AS status
|
||||
FROM
|
||||
t_payment_info p
|
||||
LEFT JOIN
|
||||
t_order_info o ON p.order_no = o.order_no
|
||||
LEFT JOIN
|
||||
t_account a ON a.id = o.account_id
|
||||
WHERE
|
||||
1 = 1
|
||||
FROM t_payment_info p
|
||||
LEFT JOIN t_order_info o ON p.order_no = o.order_no
|
||||
LEFT JOIN t_account a ON a.id = o.account_id
|
||||
WHERE 1 = 1
|
||||
<if test="paymentType != null and paymentType != ''">
|
||||
AND p.payment_type = #{paymentType}
|
||||
</if>
|
||||
<if test="payerTotal != null and payerTotal != ''">
|
||||
AND p.payer_total = #{payerTotal}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
AND p.type = #{type}
|
||||
</if>
|
||||
<!-- 修复1:删除 type 过滤条件,因为 type 是计算字段 -->
|
||||
<if test="status != null and status != ''">
|
||||
AND
|
||||
CASE
|
||||
WHEN p.trade_state IN ('paid', 'COMPLETED', 'complete', 'liquidated') THEN 'Success'
|
||||
WHEN p.trade_state IN ('failed', 'expired', 'VOIDED', 'void', 'uncollectible') THEN 'Fail'
|
||||
WHEN p.trade_state IN ('Refunded') THEN 'Refunded'
|
||||
ELSE 'Pending'
|
||||
END = #{status}
|
||||
AND (
|
||||
(p.trade_state IN ('paid', 'COMPLETED', 'complete', 'liquidated') AND #{status} = 'Success')
|
||||
OR (p.trade_state IN ('failed', 'expired', 'VOIDED', 'void', 'uncollectible') AND #{status} = 'Fail')
|
||||
OR (p.trade_state IN ('Refunded') AND #{status} = 'Refunded')
|
||||
OR (p.trade_state NOT IN ('paid', 'COMPLETED', 'complete', 'liquidated',
|
||||
'failed', 'expired', 'VOIDED', 'void', 'uncollectible', 'Refunded')
|
||||
AND #{status} = 'Pending')
|
||||
)
|
||||
</if>
|
||||
<if test="country != null and country != ''">
|
||||
AND p.country = #{country}
|
||||
@@ -106,9 +100,8 @@
|
||||
AND a.user_name = #{payer}
|
||||
</if>
|
||||
AND p.transaction_id NOT LIKE 'cs_test%'
|
||||
ORDER BY
|
||||
p.id ${order}
|
||||
LIMIT ${limit} OFFSET ${offset}
|
||||
ORDER BY p.id ${order} <!-- 建议使用白名单校验 -->
|
||||
LIMIT #{limit} OFFSET #{offset} <!-- 修复:改为 #{} -->
|
||||
</select>
|
||||
|
||||
<select id="queryPaymentInfoCount" resultType="java.lang.Long">
|
||||
|
||||
Reference in New Issue
Block a user