TdClCompanyAccInfoSMapper.xml
8.66 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<?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.pay.mapper.smapper.TdClCompanyAccInfoSMapper">
<resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdClCompanyAccInfo">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="acc_code" jdbcType="VARCHAR" property="accCode" />
<result column="customer_no" jdbcType="VARCHAR" property="customerNo" />
<result column="acct_balance" jdbcType="BIGINT" property="acctBalance" />
<result column="max_arrear" jdbcType="BIGINT" property="maxArrear" />
<result column="acc_status" jdbcType="CHAR" property="accStatus" />
<result column="create_empid" jdbcType="VARCHAR" property="createEmpid" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="modfiy_empid" jdbcType="VARCHAR" property="modfiyEmpid" />
<result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
<result column="num" jdbcType="VARCHAR" property="plNo" />
<result column="org_id" jdbcType="BIGINT" property="orgId" />
<result column="customer_name" jdbcType="VARCHAR" property="customerName" />
<collection property="parkRelationList"
select="com.zteits.pay.mapper.TdClCompanyAccInfoMapper.viewParkRelation"
column="{accCode=acc_code}">
</collection>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, acc_code, customer_no, acct_balance, max_arrear, acc_status, create_empid, create_date,
modfiy_empid, modfiy_date,org_id
</sql>
<!--
<select id="selectByDataExample" parameterType="com.zteits.clouds.api.dto.pay.param.QueryCompanyAccountRequest" resultMap="BaseResultMap">
select * from ( SELECT
a.acc_code,
a.customer_no,
a.acct_balance,
GROUP_CONCAT( p.pl_no ) as num,
m.customer_name,
a.acc_status
FROM
td_cl_company_acc_info a
LEFT JOIN td_cl_company_acc_park_relation p ON a.acc_code = p.acc_code
LEFT JOIN td_cl_customer_management m ON a.customer_no = m.customer_no
GROUP BY
a.acc_code
) h
where 1=1
<if test="plNo != null and plNo != ''">
and h.num like CONCAT('%',#{plNo},'%')
</if>
<if test="customerNo != null and customerNo != ''">
and h.customer_no = #{customerNo}
</if>
<if test="accStatus != null and accStatus != ''">
and h.acc_status = #{accStatus}
</if>
</select>-->
<select id="selectByDataDtoExample" parameterType="com.zteits.clouds.api.dto.pay.param.QueryCompanyAccountRequest"
resultMap="BaseResultMap">
select * from ( SELECT
a.id,
a.acc_code,
a.customer_no,
a.acct_balance,
a.max_arrear,
GROUP_CONCAT( p.pl_no ) as num,
m.customer_name,
a.acc_status,
a.modfiy_date
FROM
td_cl_company_acc_info a
LEFT JOIN td_cl_company_acc_park_relation p ON a.acc_code = p.acc_code
LEFT JOIN td_cl_customer_management m ON a.customer_no = m.customer_no
GROUP BY
a.acc_code
) h
where 1=1
<if test="plNo != null and plNo != ''">
and h.num like CONCAT('%',#{plNo},'%')
</if>
<if test="customerNo != null and customerNo != ''">
and h.customer_no = #{customerNo}
</if>
<if test="accStatus != null and accStatus != ''">
and h.acc_status = #{accStatus}
</if>
order by h.modfiy_date desc
</select>
<select id="viewCompanyAccount" parameterType="com.zteits.clouds.api.dto.pay.param.ViewCompanyAccountRequest" resultMap="BaseResultMap">
SELECT
a.id,
a.acc_code,
a.customer_no,
c.customer_name,
a.acct_balance,
a.max_arrear,
a.org_id
FROM
td_cl_company_acc_info a
LEFT JOIN td_cl_customer_management c on a.customer_no = c.customer_no
where 1=1
<if test="accCode != null and accCode != ''">
and a.acc_code = #{accCode}
</if>
</select>
<select id="viewParkRelation" parameterType="com.zteits.clouds.api.dto.pay.param.ViewCompanyAccountRequest"
resultType="com.zteits.pay.domain.TdClCompanyAccParkRelation">
SELECT
p.id,
p.acc_code accCode ,
p.pl_no plNo
FROM
td_cl_company_acc_park_relation p
where 1=1
<if test="accCode != null and accCode != ''">
and p.acc_code = #{accCode}
</if>
</select>
<!-- 更新余额 -->
<update id="updateAccountBalance">
update td_cl_company_acc_info
set
acct_balance = #{balance}
where
acc_code = #{accCode}
</update>
<!-- 根据停车场编号以及公司编号,获取对应的账户信息 -->
<select id="queryCompanyAccInfo"
resultType="com.zteits.pay.domain.TdClCompanyAccInfo">
SELECT
t.id,
t.acc_code as accCode,
t.customer_no as customerNo,
t.acct_balance as acctBalance,
t.acc_status as accStatus,
t.max_arrear as maxArrear
FROM
td_cl_company_acc_info t
LEFT JOIN td_cl_company_acc_park_relation r ON t.acc_code = r.acc_code
WHERE
t.acc_status = 1
AND t.customer_no = #{customerNo}
AND r.pl_no = #{plNo}
limit 1
</select>
</mapper>