查询交易记录 添加付款人字段

This commit is contained in:
2025-01-15 10:45:51 +08:00
parent 51e2c9af02
commit b6a66bed41
6 changed files with 56 additions and 38 deletions

View File

@@ -46,52 +46,62 @@
<select id="queryPaymentInfo" resultType="com.ai.da.model.vo.PaymentInfoVO">
SELECT
id,
payment_type platform,
payer_total,
type,
payment_method,
last4,
country,
city,
create_time,
p.id,
a.user_name payer,
p.payment_type platform,
p.payer_total,
p.type,
p.payment_method,
p.last4,
p.country,
p.city,
p.create_time,
CASE
WHEN trade_state IN ('paid', 'COMPLETED', 'complete', 'liquidated') THEN 'Success'
WHEN trade_state IN ('failed', 'expired', 'VOIDED', 'void', 'uncollectible') THEN 'Fail'
ELSE 'Pending'
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 AS status
FROM
t_payment_info
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 payment_type = #{paymentType}
AND p.payment_type = #{paymentType}
</if>
<if test="payerTotal != null and payerTotal != ''">
AND payer_total = #{payerTotal}
AND p.payer_total = #{payerTotal}
</if>
<if test="type != null and type != ''">
AND type = #{type}
AND p.type = #{type}
</if>
<if test="status != null and status != ''">
AND
CASE
WHEN trade_state IN ('paid', 'COMPLETED', 'complete', 'liquidated') THEN 'Success'
WHEN trade_state IN ('failed', 'expired', 'VOIDED', 'void', 'uncollectible') THEN 'Fail'
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 country = #{country}
AND p.country = #{country}
</if>
<if test="city != null and city != ''">
AND city = #{city}
AND p.city = #{city}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND create_time BETWEEN #{startTime} AND #{endTime}
AND p.create_time BETWEEN #{startTime} AND #{endTime}
</if>
<if test="payer != null and payer != ''">
AND a.user_name = #{payer}
</if>
ORDER BY
id ${order}
p.id ${order}
LIMIT ${limit} OFFSET ${offset}
</select>
@@ -99,34 +109,41 @@
SELECT
COUNT(*)
FROM
t_payment_info
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 payment_type = #{paymentType}
AND p.payment_type = #{paymentType}
</if>
<if test="payerTotal != null and payerTotal != ''">
AND payer_total = #{payerTotal}
AND p.payer_total = #{payerTotal}
</if>
<if test="type != null and type != ''">
AND type = #{type}
AND p.type = #{type}
</if>
<if test="status != null and status != ''">
AND
CASE
WHEN trade_state IN ('paid', 'COMPLETED', 'complete', 'liquidated') THEN 'Success'
WHEN trade_state IN ('failed', 'expired', 'VOIDED', 'void', 'uncollectible') THEN 'Fail'
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 country = #{country}
AND p.country = #{country}
</if>
<if test="city != null and city != ''">
AND city = #{city}
AND p.city = #{city}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND create_time BETWEEN #{startTime} AND #{endTime}
AND p.create_time BETWEEN #{startTime} AND #{endTime}
</if>
<if test="payer != null and payer != ''">
AND a.user_name = #{payer}
</if>
</select>