TdCBusinessAcctSMapper.xml
3.87 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?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.zteits.business.mapper.smapper.TdCBusinessAcctSMapper">
<!-- 分页查询商户账户余额充值与支出明细 -->
<select id="queryAccountInOutDetailsForPage"
resultType="com.zteits.clouds.api.dto.business.dto.BusinessAccountInOutDetailForPageDTO">
<if test="kind == 1">
select 1 as kind,b.examine_state as payState, b.rlt_payorder_id as payOrderId,
b.recharge_type as 'type', b.recharge_fee as changeFee,b.create_date as createDate,b.rlt_order_id as orderId
from td_c_business_acct_source b
where b.business_id = #{businessId}
and b.create_date >= #{beginDate}
and b.create_date < #{endDate}
<if test="queryType != null">
and b.recharge_type = #{queryType}
</if>
order by b.create_date desc
</if>
<if test="kind == 2">
select
2 as kind,
b.rlt_payorder_id as payOrderId,
b.trade_type as 'type',
b.trade_fee as changeFee,
b.create_date as createDate,
b.rlt_order_id as orderId,
b.car_number as carNumber
from
td_c_business_acct_payout b
where
b.business_id = #{businessId}
and b.create_date >= #{beginDate}
and b.create_date < #{endDate}
<if test="queryType != null">
and b.trade_type = #{queryType}
</if>
order by b.create_date desc
</if>
<if test="kind == null || kind == ''">
select * from
( select 2 as kind, 0 as payState, a.rlt_payorder_id as payOrderId,
a.trade_type as 'type', a.trade_fee as changeFee,a.create_date as createDate,a.rlt_order_id as orderId
from td_c_business_acct_payout a
where a.business_id = #{businessId}
and a.create_date >= #{beginDate}
and a.create_date < #{endDate}
union
select 1 as kind,b.examine_state as payState, b.rlt_payorder_id as payOrderId,
b.recharge_type as 'type', b.recharge_fee as changeFee,b.create_date as createDate,b.rlt_order_id as orderId
from td_c_business_acct_source b
where b.business_id = #{businessId}
and b.create_date >= #{beginDate}
and b.create_date < #{endDate}
)c
order by c.createDate desc
</if>
</select>
<!-- 余额明细总览 -->
<select id="detailSummary"
resultType="com.zteits.clouds.api.dto.business.dto.BusinessAccountDetailCountDTO">
<if test="kind == 1">
select
b.recharge_type as 'type',
count(b.id) as changeCount,
sum(b.recharge_fee) as totalFee
from td_c_business_acct_source b
where b.business_id = #{businessId}
and b.create_date >= #{beginDate}
and b.create_date < #{endDate}
<if test="type != null">
and b.recharge_type = #{type}
</if>
GROUP BY b.recharge_type
</if>
<if test="kind == 2">
select
b.trade_type as 'type',
count(b.id) as changeCount,
sum(b.trade_fee) as totalFee
from td_c_business_acct_payout b
where b.business_id = #{businessId}
and b.create_date >= #{beginDate}
and b.create_date < #{endDate}
<if test="type != null">
and b.trade_type = #{type}
</if>
GROUP BY b.trade_type
</if>
</select>
</mapper>