TASK:查询交易记录 添加显示总金额和付款者邮箱

This commit is contained in:
2025-06-23 10:53:30 +08:00
parent 301a62a563
commit d6c5d0e95d
5 changed files with 69 additions and 2 deletions

View File

@@ -48,6 +48,7 @@
SELECT
p.id,
a.user_name payer,
a.user_email email,
p.payment_type platform,
p.payer_total,
p.type,
@@ -149,6 +150,44 @@
AND p.transaction_id NOT LIKE 'cs_test%'
</select>
<select id="queryTotalPaymentAmount" resultType="java.math.BigDecimal">
SELECT SUM(p.payer_total)
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>
<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'
ELSE 'Pending'
END = #{status}
</if>
<if test="country != null and country != ''">
AND p.country = #{country}
</if>
<if test="city != null and city != ''">
AND p.city = #{city}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND p.create_time BETWEEN #{startTime} AND #{endTime}
</if>
<if test="payer != null and payer != ''">
AND a.user_name = #{payer}
</if>
AND p.transaction_id NOT LIKE 'cs_test%'
</select>
<select id="getCities" resultType="java.util.Map">
SELECT DISTINCT city
FROM t_payment_info