PaymentRelationMapper 支付关系表

This commit is contained in:
Hawking 2023-05-31 15:32:07 +08:00
parent d28e6a1b90
commit 05265ac17e
4 changed files with 51 additions and 7 deletions

View File

@ -133,7 +133,7 @@ public class PayCallbackService implements CallBackService {
// 保存一条支付记录
PaymentDTO payment = response.toJavaObject(PaymentDTO.class);
String status = payment.getStatus();
payment.setStatus(AdapayStatusEnum.pending.code);
financialMasterService.insertPayment(payment);
if (!AdapayStatusEnum.succeeded.code.equals(status)) {

View File

@ -0,0 +1,18 @@
package com.ghy.payment.mapper;
import com.ghy.payment.domain.PaymentRelation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface PaymentRelationMapper {
int insert(PaymentRelation record);
List<PaymentRelation> select(@Param("paymentId") String paymentId,
@Param("relationId") Long relationId,
@Param("relationIdType") String relationIdType);
List<PaymentRelation> selectByPaymentId(String paymentId);
}

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ghy.payment.mapper.PaymentRelationMapper">
<sql id="select_columns">
SELECT payment_id AS paymentId, relation_id AS relationId, relation_type AS relationIdType
FROM payment_relation
</sql>
<insert id="insert" parameterType="com.ghy.payment.domain.DrawCashRecord">
INSERT INTO payment_relation(payment_id, relation_id, relation_type)
VALUES (#{paymentId}, #{relationId}, #{relationIdType})
</insert>
<select id="selectByPaymentId" resultType="com.ghy.payment.domain.PaymentRelation">
<include refid="select_columns"/>
WHERE payment_id = #{paymentId}
</select>
<select id="select" resultType="com.ghy.payment.domain.PaymentRelation">
<include refid="select_columns"/>
<where>
<if test="paymentId != null and paymentId != ''">AND payment_id = #{paymentId}</if>
<if test="relationId != null">AND relation_id = #{relationId}</if>
<if test="relationIdType != null and relationIdType != ''">AND relation_type = #{relationIdType}</if>
</where>
</select>
</mapper>

View File

@ -86,8 +86,7 @@
<if test="partyOrderId != null">party_order_id,</if>
<if test="queryUrl != null">query_url,</if>
<if test="payTime != null">pay_time,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
create_time,update_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="paymentId != null">#{paymentId},</if>
@ -110,8 +109,7 @@
<if test="partyOrderId != null">#{partyOrderId},</if>
<if test="queryUrl != null">#{queryUrl},</if>
<if test="payTime != null">#{payTime},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
NOW(),NOW()
</trim>
</insert>
@ -137,8 +135,7 @@
<if test="partyOrderId != null">party_order_id = #{partyOrderId},</if>
<if test="queryUrl != null">query_url = #{queryUrl},</if>
<if test="payTime != null">pay_time = #{payTime},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
update_time = NOW()
</trim>
where payment_id = #{paymentId}
</update>