wlzboy
12 小时以前 5f2ee03958a1a16dc27195c76ea7cffb422c95d1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?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.ruoyi.payment.infrastructure.persistence.mapper.PaymentOrderMapper">
 
    <resultMap id="PaymentOrderResult" type="com.ruoyi.payment.domain.model.PaymentOrder">
        <id property="id" column="id"/>
        <result property="bizOrderId" column="biz_order_id"/>
        <result property="amount" column="amount"/>
        <result property="currency" column="currency"/>
        <result property="channel" column="channel"/>
        <result property="status" column="status"/>
        <result property="subject" column="subject"/>
        <result property="description" column="description"/>
        <result property="callbackUrl" column="callback_url"/>
        <result property="expireAt" column="expire_at"/>
        <result property="latestTransactionId" column="latest_transaction_id"/>
        <result property="channelTradeNo" column="channel_trade_no"/>
        <result property="paidAt" column="paid_at"/>
        <result property="version" column="version"/>
        <result property="createdAt" column="created_at"/>
        <result property="updatedAt" column="updated_at"/>
    </resultMap>
 
    <insert id="insert" parameterType="com.ruoyi.payment.domain.model.PaymentOrder">
        INSERT INTO pay_order (
            id, biz_order_id, amount, currency, channel, status,
            subject, description, callback_url, expire_at,
            latest_transaction_id, channel_trade_no, paid_at,
            version, created_at, updated_at
        ) VALUES (
            #{id}, #{bizOrderId}, #{amount}, #{currency}, #{channel}, #{status},
            #{subject}, #{description}, #{callbackUrl}, #{expireAt},
            #{latestTransactionId}, #{channelTradeNo}, #{paidAt},
            #{version}, #{createdAt}, #{updatedAt}
        )
    </insert>
 
    <update id="update" parameterType="com.ruoyi.payment.domain.model.PaymentOrder">
        UPDATE pay_order
        <set>
            <if test="bizOrderId != null">biz_order_id = #{bizOrderId},</if>
            <if test="amount != null">amount = #{amount},</if>
            <if test="currency != null">currency = #{currency},</if>
            <if test="channel != null">channel = #{channel},</if>
            <if test="status != null">status = #{status},</if>
            <if test="subject != null">subject = #{subject},</if>
            <if test="description != null">description = #{description},</if>
            <if test="callbackUrl != null">callback_url = #{callbackUrl},</if>
            <if test="expireAt != null">expire_at = #{expireAt},</if>
            <if test="latestTransactionId != null">latest_transaction_id = #{latestTransactionId},</if>
            <if test="channelTradeNo != null">channel_trade_no = #{channelTradeNo},</if>
            <if test="paidAt != null">paid_at = #{paidAt},</if>
            <if test="version != null">version = #{version},</if>
            <if test="updatedAt != null">updated_at = #{updatedAt},</if>
        </set>
        WHERE id = #{id}
    </update>
 
    <select id="selectById" resultMap="PaymentOrderResult">
        SELECT * FROM pay_order
        WHERE id = #{id}
    </select>
 
    <select id="selectByBizOrderIdAndChannel" resultMap="PaymentOrderResult">
        SELECT * FROM pay_order
        WHERE biz_order_id = #{bizOrderId}
        AND channel = #{channel}
        LIMIT 1
    </select>
 
    <select id="selectByChannelTradeNo" resultMap="PaymentOrderResult">
        SELECT * FROM pay_order
        WHERE channel_trade_no = #{channelTradeNo}
        LIMIT 1
    </select>
 
</mapper>