IOnlinePaymentDao.xml
3.62 KB
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
78
79
80
81
<?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.diligrp.cashier.trade.dao.IOnlinePaymentDao">
<resultMap id="OnlinePaymentMap" type="com.diligrp.cashier.trade.model.OnlinePayment">
<id column="id" property="id"/>
<result column="out_mch_id" property="outMchId"/>
<result column="trade_id" property="tradeId"/>
<result column="type" property="type"/>
<result column="payment_id" property="paymentId"/>
<result column="channel_id" property="channelId"/>
<result column="pay_type" property="payType"/>
<result column="pipeline_id" property="pipelineId"/>
<result column="goods" property="goods"/>
<result column="amount" property="amount"/>
<result column="object_id" property="objectId"/>
<result column="payer_id" property="payerId"/>
<result column="finish_time" property="finishTime"/>
<result column="out_trade_no" property="outTradeNo"/>
<result column="out_pay_type" property="outPayType"/>
<result column="state" property="state"/>
<result column="notify_url" property="notifyUrl"/>
<result column="description" property="description"/>
<result column="version" property="version"/>
<result column="created_time" property="createdTime"/>
<result column="modified_time" property="modifiedTime"/>
</resultMap>
<insert id="insertOnlinePayment" parameterType="com.diligrp.cashier.trade.model.OnlinePayment">
INSERT INTO upay_online_payment(out_mch_id, trade_id, type, payment_id, channel_id, pay_type, pipeline_id,
goods, amount, object_id, payer_id, finish_time, out_trade_no, out_pay_type,
state, notify_url, description, version, created_time, modified_time)
VALUES
(#{outMchId}, #{tradeId}, #{type}, #{paymentId}, #{channelId}, #{payType}, #{pipelineId},
#{goods}, #{amount}, #{objectId}, #{payerId}, #{finishTime}, #{outTradeNo}, #{outPayType}
#{state}, #{notifyUrl}, #{description}, #{version}, #{createdTime}, #{modifiedTime})
</insert>
<select id="findByPaymentId" parameterType="string" resultMap="OnlinePaymentMap">
SELECT * FROM upay_online_payment WHERE payment_id = #{paymentId}
</select>
<update id="compareAndSetState" parameterType="com.diligrp.cashier.trade.domain.PaymentStateDTO">
UPDATE upay_online_payment SET version = version + 1
<if test="outTradeNo != null">
, out_trade_no = #{outTradeNo}
</if>
<if test="outPayType != null">
, out_pay_type = #{outPayType}
</if>
<if test="payerId != null">
, payer_id = #{payerId}
</if>
<if test="finishTime != null">
, finish_time = #{finishTime}
</if>
<if test="state != null">
, state = #{state}
</if>
<if test="description != null">
, description = #{description}
</if>
<if test="modifiedTime != null">
, modified_time = #{modifiedTime}
</if>
WHERE
payment_id = #{paymentId} AND version = #{version}
</update>
<select id="listOnlinePayments" resultMap="OnlinePaymentMap">
SELECT * FROM upay_online_payment WHERE trade_id = #{tradeId}
<if test="type != null">
AND type = #{type}
</if>
<if test="state != null">
AND state = #{state}
</if>
ORDER BY id
</select>
</mapper>