TdBCheckDaySMapper.xml
16 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
<?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.order.mapper.smapper.TdBCheckDaySMapper">
<resultMap id="BaseResultMap" type="com.zteits.order.domain.TdBCheckDay">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="check_date" jdbcType="DATE" property="checkDate" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="pl_name" jdbcType="VARCHAR" property="plName" />
<result column="area_id" jdbcType="VARCHAR" property="areaId" />
<result column="area_name" jdbcType="VARCHAR" property="areaName" />
<result column="check_fee_type" jdbcType="INTEGER" property="checkFeeType" />
<result column="dicount_fee" jdbcType="BIGINT" property="dicountFee" />
<result column="act_fee" jdbcType="BIGINT" property="actFee" />
<result column="total_fee" jdbcType="BIGINT" property="totalFee" />
<result column="arrearage_fee" jdbcType="BIGINT" property="arrearageFee" />
<result column="ali_fee" jdbcType="BIGINT" property="aliFee" />
<result column="ali_charge_num" jdbcType="INTEGER" property="aliChargeNum" />
<result column="wx_fee" jdbcType="BIGINT" property="wxFee" />
<result column="wx_charge_num" jdbcType="INTEGER" property="wxChargeNum" />
<result column="cash_fee" jdbcType="BIGINT" property="cashFee" />
<result column="cash_charge_num" jdbcType="INTEGER" property="cashChargeNum" />
<result column="balance_fee" jdbcType="BIGINT" property="balanceFee" />
<result column="balance_charge_num" jdbcType="INTEGER" property="balanceChargeNum" />
<result column="data_state" jdbcType="INTEGER" property="dataState" />
<result column="create_emp_id" jdbcType="VARCHAR" property="createEmpId" />
<result column="create_emp_name" jdbcType="VARCHAR" property="createEmpName" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="modfiy_emp_id" jdbcType="VARCHAR" property="modfiyEmpId" />
<result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" />
<result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap>
<sql id="Base_Column_List">
id, check_date, pl_no, pl_name, area_id, area_name, check_fee_type, dicount_fee,
act_fee, total_fee, arrearage_fee, ali_fee, ali_charge_num, wx_fee, wx_charge_num,
cash_fee, cash_charge_num, balance_fee, balance_charge_num, data_state, create_emp_id,
create_emp_name, create_date, modfiy_emp_id, modfiy_emp_name, modfiy_date, remark
</sql>
<select id="querySummaryFeeByType" parameterType="com.zteits.clouds.api.dto.clouds.param.CheckDayRequest"
resultType="com.zteits.clouds.api.dto.clouds.dto.CheckDayForSummaryDTO">
select
/**100 停车收入 **/
sum( CASE when check_fee_type=100 THEN dicount_fee ELSE 0 END) as dicountFee,
sum(CASE when check_fee_type=100 THEN act_fee ELSE 0 END) as actFee,
sum(CASE when check_fee_type=100 THEN total_fee ELSE 0 END) as totalFee,
sum(CASE when check_fee_type=100 THEN arrearage_fee ELSE 0 END) as arrearageFee,
/**200 充值收入 **/
sum( CASE when check_fee_type=200 THEN dicount_fee ELSE 0 END) as dicountFeeForRecharge,
sum(CASE when check_fee_type=200 THEN act_fee ELSE 0 END) as actFeeForRecharge,
sum(CASE when check_fee_type=200 THEN total_fee ELSE 0 END) as totalFeeForRecharge,
sum(CASE when check_fee_type=200 THEN arrearage_fee ELSE 0 END) as arrearageFeeForRecharge,
/**300 301 会员卡收入 **/
sum( CASE when check_fee_type in(300,301) THEN dicount_fee ELSE 0 END) as dicountFeeForVIP,
sum(CASE when check_fee_type in(300,301) THEN act_fee ELSE 0 END) as actFeeForVIP,
sum(CASE when check_fee_type in(300,301) THEN total_fee ELSE 0 END) as totalFeeForVIP,
sum(CASE when check_fee_type in(300,301) THEN arrearage_fee ELSE 0 END) as arrearageFeeForVIP,
/**103 补缴收入 **/
sum( CASE when check_fee_type=103 THEN dicount_fee ELSE 0 END) as dicountFeeForBack,
sum(CASE when check_fee_type=103 THEN act_fee ELSE 0 END) as actFeeForBack,
sum(CASE when check_fee_type=103 THEN total_fee ELSE 0 END) as totalFeeForBack,
sum(CASE when check_fee_type=103 THEN arrearage_fee ELSE 0 END) as arrearageFeeForBack,
/**-100 -200 -300 退费收入 **/
sum(CASE when check_fee_type=-100 THEN act_fee ELSE 0 END) as orderRefund,
sum(CASE when check_fee_type=-200 THEN act_fee ELSE 0 END) as rechargeRefund,
sum(CASE when check_fee_type=-300 THEN act_fee ELSE 0 END) as vipRefund
from td_b_check_day
where data_state = 1
<if test="plNos != null and plNos.size >0">
and pl_no in
<foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
#{plNo}
</foreach>
</if>
<if test="beginTime != null ">
<![CDATA[ and check_date >= #{beginTime} ]]>
</if>
<if test="endTime != null ">
<![CDATA[ and check_date <= #{endTime} ]]>
</if>
</select>
<select id="queryDetailForAreaByType" parameterType="com.zteits.clouds.api.dto.clouds.param.CheckDayRequest"
resultType="com.zteits.clouds.api.dto.clouds.dto.CheckDayForDetailDTO">
select
<if test="timeType == 1">
DATE_FORMAT(check_date,'%Y-%m-%d') as checkDate,
</if>
<if test="timeType == 2">
DATE_FORMAT(check_date,'%Y-%m') as checkDate,
</if>
area_id as areaId,
area_name as areaName,
sum(IFNULL(ali_fee,0)) as aliFee,
sum(IFNULL(ali_charge_num,0)) as aliChargeNum,
sum(IFNULL(wx_fee,0)) as wxFee,
sum(IFNULL(wx_charge_num,0)) as wxChargeNum,
sum(IFNULL(cash_fee,0)) as cashFee,
sum(IFNULL(cash_charge_num,0)) as cashChargeNum,
sum(IFNULL(balance_fee,0)) as balanceFee,
sum(IFNULL(balance_charge_num,0)) as balanceChargeNum,
sum(IFNULL(dicount_fee,0)) as dicountFee,
sum(IFNULL(act_fee,0)) as actFee,
sum(IFNULL(total_fee,0)) as totalFee,
sum(IFNULL(arrearage_fee,0)) as arrearageFee
from td_b_check_day
where data_state = 1
<if test="plNos != null and plNos.size >0">
and pl_no in
<foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
#{plNo}
</foreach>
</if>
<if test="areaId != null and areaId !=''">
and area_id = #{areaId}
</if>
<if test="beginTime != null ">
<![CDATA[ and check_date >= #{beginTime} ]]>
</if>
<if test="endTime != null ">
<![CDATA[ and check_date <= #{endTime} ]]>
</if>
<if test="checkFeeTypes != null and checkFeeTypes.size >0">
and check_fee_type in
<foreach collection="checkFeeTypes" open="(" close=")" item="checkFeeType" separator=",">
#{checkFeeType}
</foreach>
</if>
GROUP BY checkDate,areaId,areaName
ORDER BY checkDate DESC
</select>
<select id="queryDetailForParkByType" parameterType="com.zteits.clouds.api.dto.clouds.param.CheckDayRequest"
resultType="com.zteits.clouds.api.dto.clouds.dto.CheckDayForDetailDTO">
select
<if test="timeType == 1">
DATE_FORMAT(check_date,'%Y-%m-%d') as checkDate,
</if>
<if test="timeType == 2">
DATE_FORMAT(check_date,'%Y-%m') as checkDate,
</if>
area_id as areaId,
area_name as areaName,
pl_no as plNo,
pl_name as plName,
sum(IFNULL(ali_fee,0)) as aliFee,
sum(IFNULL(ali_charge_num,0)) as aliChargeNum,
sum(IFNULL(wx_fee,0)) as wxFee,
sum(IFNULL(wx_charge_num,0)) as wxChargeNum,
sum(IFNULL(cash_fee,0)) as cashFee,
sum(IFNULL(cash_charge_num,0)) as cashChargeNum,
sum(IFNULL(balance_fee,0)) as balanceFee,
sum(IFNULL(balance_charge_num,0)) as balanceChargeNum,
sum(IFNULL(dicount_fee,0)) as dicountFee,
sum(IFNULL(act_fee,0)) as actFee,
sum(IFNULL(total_fee,0)) as totalFee,
sum(IFNULL(arrearage_fee,0)) as arrearageFee
from td_b_check_day
where data_state = 1
<if test="plNos != null and plNos.size >0">
and pl_no in
<foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
#{plNo}
</foreach>
</if>
<if test="areaId != null and areaId !=''">
and area_id = #{areaId}
</if>
<if test="beginTime != null ">
<![CDATA[ and check_date >= #{beginTime} ]]>
</if>
<if test="endTime != null ">
<![CDATA[ and check_date <= #{endTime} ]]>
</if>
<if test="checkFeeTypes != null and checkFeeTypes.size >0">
and check_fee_type in
<foreach collection="checkFeeTypes" open="(" close=")" item="checkFeeType" separator=",">
#{checkFeeType}
</foreach>
</if>
GROUP BY checkDate,plNo,plName,areaId,areaName
ORDER BY checkDate DESC
</select>
<select id="queryDetailForAreaSummaryByType" parameterType="com.zteits.clouds.api.dto.clouds.param.CheckDayRequest"
resultType="com.zteits.clouds.api.dto.clouds.dto.CheckDayForDetailDTO">
select
sum(IFNULL(ali_fee,0)) as aliFee,
sum(IFNULL(ali_charge_num,0)) as aliChargeNum,
sum(IFNULL(wx_fee,0)) as wxFee,
sum(IFNULL(wx_charge_num,0)) as wxChargeNum,
sum(IFNULL(cash_fee,0)) as cashFee,
sum(IFNULL(cash_charge_num,0)) as cashChargeNum,
sum(IFNULL(balance_fee,0)) as balanceFee,
sum(IFNULL(balance_charge_num,0)) as balanceChargeNum,
sum(IFNULL(dicount_fee,0)) as dicountFee,
sum(IFNULL(act_fee,0)) as actFee,
sum(IFNULL(total_fee,0)) as totalFee,
sum(IFNULL(arrearage_fee,0)) as arrearageFee
from td_b_check_day
where data_state = 1
<if test="plNos != null and plNos.size >0">
and pl_no in
<foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
#{plNo}
</foreach>
</if>
<if test="areaId != null and areaId !=''">
and area_id = #{areaId}
</if>
<if test="beginTime != null ">
<![CDATA[ and check_date >= #{beginTime} ]]>
</if>
<if test="endTime != null ">
<![CDATA[ and check_date <= #{endTime} ]]>
</if>
<if test="checkFeeTypes != null and checkFeeTypes.size >0">
and check_fee_type in
<foreach collection="checkFeeTypes" open="(" close=")" item="checkFeeType" separator=",">
#{checkFeeType}
</foreach>
</if>
</select>
<select id="queryDetailForParkSummaryByType" parameterType="com.zteits.clouds.api.dto.clouds.param.CheckDayRequest"
resultType="com.zteits.clouds.api.dto.clouds.dto.CheckDayForDetailDTO">
select
sum(IFNULL(ali_fee,0)) as aliFee,
sum(IFNULL(ali_charge_num,0)) as aliChargeNum,
sum(IFNULL(wx_fee,0)) as wxFee,
sum(IFNULL(wx_charge_num,0)) as wxChargeNum,
sum(IFNULL(cash_fee,0)) as cashFee,
sum(IFNULL(cash_charge_num,0)) as cashChargeNum,
sum(IFNULL(balance_fee,0)) as balanceFee,
sum(IFNULL(balance_charge_num,0)) as balanceChargeNum,
sum(IFNULL(dicount_fee,0)) as dicountFee,
sum(IFNULL(act_fee,0)) as actFee,
sum(IFNULL(total_fee,0)) as totalFee,
sum(IFNULL(arrearage_fee,0)) as arrearageFee
from td_b_check_day
where data_state = 1
<if test="plNos != null and plNos.size >0">
and pl_no in
<foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
#{plNo}
</foreach>
</if>
<if test="areaId != null and areaId !=''">
and area_id = #{areaId}
</if>
<if test="beginTime != null ">
<![CDATA[ and check_date >= #{beginTime} ]]>
</if>
<if test="endTime != null ">
<![CDATA[ and check_date <= #{endTime} ]]>
</if>
<if test="checkFeeTypes != null and checkFeeTypes.size >0">
and check_fee_type in
<foreach collection="checkFeeTypes" open="(" close=")" item="checkFeeType" separator=",">
#{checkFeeType}
</foreach>
</if>
</select>
<select id="queryDetailForParkRefundByType"
resultType="com.zteits.clouds.api.dto.clouds.dto.CheckDayForDetailDTO">
select
sum(IFNULL(ali_fee,0)) as aliFeeForRefund,
sum(IFNULL(ali_charge_num,0)) as aliChargeNumForRefund,
sum(IFNULL(wx_fee,0)) as wxFeeForRefund,
sum(IFNULL(wx_charge_num,0)) as wxChargeNumForRefund,
sum(IFNULL(cash_fee,0)) as cashFeeForRefund,
sum(IFNULL(cash_charge_num,0)) as cashChargeNumForRefund,
sum(IFNULL(balance_fee,0)) as balanceFeeForRefund,
sum(IFNULL(balance_charge_num,0)) as balanceChargeNumForRefund,
sum(IFNULL(act_fee,0)) as actFeeForRefund
from td_b_check_day
where data_state = 1
<if test="plNo != null ">
and pl_no =#{plNo}
</if>
<if test="areaId != null ">
and area_id =#{areaId}
</if>
<if test="timeType == 1">
and DATE_FORMAT(check_date,'%Y-%m-%d') = #{checkDate}
</if>
<if test="timeType == 2">
and DATE_FORMAT(check_date,'%Y-%m') = #{checkDate}
</if>
<if test="checkFeeTypes != null and checkFeeTypes.size >0">
and check_fee_type in
<foreach collection="checkFeeTypes" open="(" close=")" item="checkFeeType" separator=",">
#{checkFeeType}
</foreach>
</if>
</select>
<!-- 根据制定日期删除表数据 -->
<delete id="deleteCheckDayByDateTime" >
delete from td_b_check_day
where 1=1
<![CDATA[and check_date >= #{beginTime}]]>
<![CDATA[and check_date <= #{endTime}]]>
</delete>
<!-- 批量插入数据 -->
<insert id="batchInsertCheckDay" >
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into td_b_check_day (check_date, pl_no, pl_name,
area_id, area_name, check_fee_type,
dicount_fee, act_fee, total_fee,
arrearage_fee, ali_fee, ali_charge_num,
wx_fee, wx_charge_num, cash_fee,
cash_charge_num, balance_fee, balance_charge_num,
data_state, create_emp_id, create_emp_name,
create_date, modfiy_emp_id, modfiy_emp_name,
modfiy_date, remark
)
values <foreach collection="list" item="item" separator=",">
(#{item.checkDate,jdbcType=DATE}, #{item.plNo,jdbcType=VARCHAR}, #{item.plName,jdbcType=VARCHAR},
#{item.areaId,jdbcType=VARCHAR}, #{item.areaName,jdbcType=VARCHAR}, #{item.checkFeeType,jdbcType=INTEGER},
#{item.dicountFee,jdbcType=BIGINT}, #{item.actFee,jdbcType=BIGINT}, #{item.totalFee,jdbcType=BIGINT},
#{item.arrearageFee,jdbcType=BIGINT}, #{item.aliFee,jdbcType=BIGINT}, #{item.aliChargeNum,jdbcType=INTEGER},
#{item.wxFee,jdbcType=BIGINT}, #{item.wxChargeNum,jdbcType=INTEGER}, #{item.cashFee,jdbcType=BIGINT},
#{item.cashChargeNum,jdbcType=INTEGER}, #{item.balanceFee,jdbcType=BIGINT}, #{item.balanceChargeNum,jdbcType=INTEGER},
1, #{item.createEmpId,jdbcType=VARCHAR}, #{item.createEmpName,jdbcType=VARCHAR},
#{item.createDate,jdbcType=TIMESTAMP}, #{item.modfiyEmpId,jdbcType=VARCHAR}, #{item.modfiyEmpName,jdbcType=VARCHAR},
#{item.modfiyDate,jdbcType=TIMESTAMP}, #{item.remark,jdbcType=VARCHAR}
)
</foreach>
</insert>
</mapper>