查询各平台交易记录

This commit is contained in:
2025-01-10 13:27:27 +08:00
parent 2f86090f21
commit 698fca8787
14 changed files with 240 additions and 39 deletions

View File

@@ -44,5 +44,91 @@
AND p.create_time BETWEEN #{startTime} AND #{endTime};
</select>
<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,
CASE
WHEN trade_state IN ('paid', 'COMPLETED', 'complete', 'liquidated') THEN 'Success'
WHEN trade_state IN ('failed', 'expired', 'VOIDED', 'void', 'uncollectible') THEN 'Fail'
ELSE 'Pending'
END AS status
FROM
t_payment_info
WHERE
1 = 1
<if test="paymentType != null and paymentType != ''">
AND payment_type = #{paymentType}
</if>
<if test="payerTotal != null and payerTotal != ''">
AND payer_total = #{payerTotal}
</if>
<if test="type != null and type != ''">
AND 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'
ELSE 'Pending'
END = #{status}
</if>
<if test="country != null and country != ''">
AND country = #{country}
</if>
<if test="city != null and city != ''">
AND city = #{city}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND create_time BETWEEN #{startTime} AND #{endTime}
</if>
ORDER BY
id DESC
LIMIT ${limit} OFFSET ${offset}
</select>
<select id="queryPaymentInfoCount" resultType="java.lang.Long">
SELECT
COUNT(*)
FROM
t_payment_info
WHERE
1 = 1
<if test="paymentType != null and paymentType != ''">
AND payment_type = #{paymentType}
</if>
<if test="payerTotal != null and payerTotal != ''">
AND payer_total = #{payerTotal}
</if>
<if test="type != null and type != ''">
AND 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'
ELSE 'Pending'
END = #{status}
</if>
<if test="country != null and country != ''">
AND country = #{country}
</if>
<if test="city != null and city != ''">
AND city = #{city}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND create_time BETWEEN #{startTime} AND #{endTime}
</if>
</select>
</mapper>