PoolResidentLedgerMapper.xml
22 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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<?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.chinagas.modules.insight.mapper.PoolResidentLedgerMapper">
<resultMap type="com.chinagas.modules.insight.domian.PoolResidentLedger" id="PoolResidentLedgerResult">
<result property="id" column="id"/>
<result property="area" column="area"/>
<result property="areaName" column="area_name"/>
<result property="entity" column="entity"/>
<result property="entityName" column="entity_name"/>
<result property="accounting" column="accounting"/>
<result property="accountingName" column="accounting_name"/>
<result property="address" column="address"/>
<result property="administrativeVillage" column="administrative_village"/>
<result property="natureVillage" column="nature_village"/>
<result property="totalHousehold" column="total_household"/>
<result property="houseType" column="house_type"/>
<result property="coveredHousehold" column="covered_household"/>
<result property="signHousehold" column="sign_household"/>
<result property="marketType" column="market_type"/>
<result property="businessType" column="business_type"/>
<result property="signType" column="sign_type"/>
<result property="businessArea" column="business_area"/>
<result property="fullAmount" column="full_amount"/>
<result property="byStages" column="by_stages"/>
<result property="unpaid" column="unpaid"/>
<result property="actual" column="actual"/>
<result property="installCondition" column="install_condition"/>
<result property="noInstallCondition" column="no_install_condition"/>
<result property="financeConfirm" column="finance_confirm"/>
<result property="ventilation" column="ventilation"/>
<result property="actualFire" column="actual_fire"/>
<result property="intoRemodel" column="into_remodel"/>
<result property="currentConfirm" column="current_confirm"/>
<result property="afterConfirm" column="after_confirm"/>
<result property="lastConfirm" column="last_confirm"/>
<result property="distance" column="distance"/>
<result property="status" column="status"/>
<result property="statusName" column="status_name"/>
<result property="sysCtime" column="sys_ctime"/>
<result property="sysUtime" column="sys_utime"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
<result property="deleteFlag" column="delete_flag"/>
<result property="developStatus" column="develop_status"/>
</resultMap>
<resultMap type="com.chinagas.modules.insight.vo.PoolCountVO" id="PoolResidentLedgerResult1">
<result property="days" column="days"/>
<result property="count" column="count"/>
</resultMap>
<sql id="selectPoolResidentLedgerVo">
select id,
area,
area_name,
entity,
entity_name,
accounting,
accounting_name,
address,
administrative_village,
nature_village,
total_household,
house_type,
covered_household,
sign_household,
market_type,
business_type,
sign_type,
business_area,
full_amount,
by_stages,
unpaid,
actual,
install_condition,
no_install_condition,
finance_confirm,
ventilation,
actual_fire,
into_remodel,
current_confirm,
after_confirm,
last_confirm,
distance,
status,
status_name,
sys_ctime,
sys_utime,
create_by,
update_by,
delete_flag,
develop_status
from pool_resident_ledger
</sql>
<select id="selectPoolResidentLedgerList" parameterType="com.chinagas.modules.insight.domian.PoolResidentLedger"
resultMap="PoolResidentLedgerResult">
<include refid="selectPoolResidentLedgerVo"/>
<where>
<if test="id != null ">and id = #{id}</if>
<if test="area != null and area != ''">and area REGEXP #{area}</if>
<if test="areaName != null and areaName != ''">and area_name like concat('%', #{areaName}, '%')</if>
<if test="entity != null and entity != ''">and entity REGEXP #{entity}</if>
<if test="entityName != null and entityName != ''">and entity_name like concat('%', #{entityName}, '%')
</if>
<if test="accounting != null and accounting != ''">and accounting REGEXP #{accounting}</if>
<if test="accountingName != null and accountingName != ''">and accounting_name like concat('%',
#{accountingName}, '%')
</if>
<if test="address != null and address != ''">and address like concat ('%', #{address}, '%')</if>
<if test="administrativeVillage != null and administrativeVillage != ''">and administrative_village like
concat('%', #{administrativeVillage}, '%')
</if>
<if test="natureVillage != null and natureVillage != ''">and nature_village like concat('%',
#{natureVillage}, '%')
</if>
<if test="totalHousehold != null ">and total_household = #{totalHousehold}</if>
<if test="houseType != null ">and house_type = #{houseType}</if>
<if test="coveredHousehold != null ">and covered_household = #{coveredHousehold}</if>
<if test="signHousehold != null ">and sign_household = #{signHousehold}</if>
<if test="marketType != null ">and market_type = #{marketType}</if>
<if test="businessType != null ">and business_type = #{businessType}</if>
<if test="signType != null ">and sign_type = #{signType}</if>
<if test="businessArea != null ">and business_area = #{businessArea}</if>
<if test="fullAmount != null ">and full_amount = #{fullAmount}</if>
<if test="byStages != null ">and by_stages = #{byStages}</if>
<if test="unpaid != null ">and unpaid = #{unpaid}</if>
<if test="actual != null ">and actual = #{actual}</if>
<if test="installCondition != null ">and install_condition = #{installCondition}</if>
<if test="noInstallCondition != null ">and no_install_condition = #{noInstallCondition}</if>
<if test="financeConfirm != null ">and finance_confirm = #{financeConfirm}</if>
<if test="ventilation != null ">and ventilation = #{ventilation}</if>
<if test="actualFire != null ">and actual_fire = #{actualFire}</if>
<if test="intoRemodel != null ">and into_remodel = #{intoRemodel}</if>
<if test="currentConfirm != null ">and current_confirm = #{currentConfirm}</if>
<if test="afterConfirm != null ">and after_confirm = #{afterConfirm}</if>
<if test="lastConfirm != null ">and last_confirm = #{lastConfirm}</if>
<if test="distance != null ">and distance = #{distance}</if>
<if test="status != null ">and status = #{status}</if>
<if test="statusName != null and statusName != ''">and status_name REGEXP #{statusName}</if>
<if test="sysCtime != null ">and sys_ctime = #{sysCtime}</if>
<if test="sysUtime != null ">and sys_utime = #{sysUtime}</if>
<if test="developStatus != null ">and develop_status = #{developStatus}</if>
and delete_flag = 0 order by sys_ctime DESC
</where>
</select>
<select id="selectPoolResidentLedgerById" parameterType="Long" resultMap="PoolResidentLedgerResult">
<include refid="selectPoolResidentLedgerVo"/>
where id = #{id}
</select>
<insert id="insertPoolResidentLedger" parameterType="com.chinagas.modules.insight.domian.PoolResidentLedger">
insert into pool_resident_ledger
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="area != null and area != ''">area,</if>
<if test="areaName != null and areaName != ''">area_name,</if>
<if test="entity != null and entity != ''">entity,</if>
<if test="entityName != null and entityName != ''">entity_name,</if>
<if test="accounting != null and accounting != ''">accounting,</if>
<if test="accountingName != null and accountingName != ''">accounting_name,</if>
<if test="address != null and address != ''">address,</if>
<if test="administrativeVillage != null and administrativeVillage != ''">administrative_village,</if>
<if test="natureVillage != null and natureVillage != ''">nature_village,</if>
<if test="totalHousehold != null">total_household,</if>
<if test="houseType != null">house_type,</if>
<if test="coveredHousehold != null">covered_household,</if>
<if test="signHousehold != null">sign_household,</if>
<if test="marketType != null">market_type,</if>
<if test="businessType != null">business_type,</if>
<if test="signType != null">sign_type,</if>
<if test="businessArea != null">business_area,</if>
<if test="fullAmount != null">full_amount,</if>
<if test="byStages != null">by_stages,</if>
<if test="unpaid != null">unpaid,</if>
<if test="actual != null">actual,</if>
<if test="installCondition != null">install_condition,</if>
<if test="noInstallCondition != null">no_install_condition,</if>
<if test="financeConfirm != null">finance_confirm,</if>
<if test="ventilation != null">ventilation,</if>
<if test="actualFire != null">actual_fire,</if>
<if test="intoRemodel != null">into_remodel,</if>
<if test="currentConfirm != null">current_confirm,</if>
<if test="afterConfirm != null">after_confirm,</if>
<if test="lastConfirm != null">last_confirm,</if>
<if test="distance != null">distance,</if>
<if test="status != null">status,</if>
<if test="statusName != null and statusName != ''">status_name,</if>
<if test="sysCtime != null">sys_ctime,</if>
<if test="sysUtime != null">sys_utime,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="deleteFlag != null">delete_flag,</if>
<if test="developStatus != null">develop_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="area != null and area != ''">#{area},</if>
<if test="areaName != null and areaName != ''">#{areaName},</if>
<if test="entity != null and entity != ''">#{entity},</if>
<if test="entityName != null and entityName != ''">#{entityName},</if>
<if test="accounting != null and accounting != ''">#{accounting},</if>
<if test="accountingName != null and accountingName != ''">#{accountingName},</if>
<if test="address != null and address != ''">#{address},</if>
<if test="administrativeVillage != null and administrativeVillage != ''">#{administrativeVillage},</if>
<if test="natureVillage != null and natureVillage != ''">#{natureVillage},</if>
<if test="totalHousehold != null">#{totalHousehold},</if>
<if test="houseType != null">#{houseType},</if>
<if test="coveredHousehold != null">#{coveredHousehold},</if>
<if test="signHousehold != null">#{signHousehold},</if>
<if test="marketType != null">#{marketType},</if>
<if test="businessType != null">#{businessType},</if>
<if test="signType != null">#{signType},</if>
<if test="businessArea != null">#{businessArea},</if>
<if test="fullAmount != null">#{fullAmount},</if>
<if test="byStages != null">#{byStages},</if>
<if test="unpaid != null">#{unpaid},</if>
<if test="actual != null">#{actual},</if>
<if test="installCondition != null">#{installCondition},</if>
<if test="noInstallCondition != null">#{noInstallCondition},</if>
<if test="financeConfirm != null">#{financeConfirm},</if>
<if test="ventilation != null">#{ventilation},</if>
<if test="actualFire != null">#{actualFire},</if>
<if test="intoRemodel != null">#{intoRemodel},</if>
<if test="currentConfirm != null">#{currentConfirm},</if>
<if test="afterConfirm != null">#{afterConfirm},</if>
<if test="lastConfirm != null">#{lastConfirm},</if>
<if test="distance != null">#{distance},</if>
<if test="status != null">#{status},</if>
<if test="statusName != null and statusName != ''">#{statusName},</if>
<if test="sysCtime != null">#{sysCtime},</if>
<if test="sysUtime != null">#{sysUtime},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="deleteFlag != null">#{deleteFlag},</if>
<if test="developStatus != null">#{developStatus},</if>
</trim>
</insert>
<update id="updatePoolResidentLedger" parameterType="com.chinagas.modules.insight.domian.PoolResidentLedger">
update pool_resident_ledger
<trim prefix="SET" suffixOverrides=",">
<if test="area != null and area != ''">area = #{area},</if>
<if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
<if test="entity != null and entity != ''">entity = #{entity},</if>
<if test="entityName != null and entityName != ''">entity_name = #{entityName},</if>
<if test="accounting != null and accounting != ''">accounting = #{accounting},</if>
<if test="accountingName != null and accountingName != ''">accounting_name = #{accountingName},</if>
<if test="address != null and address != ''">address = #{address},</if>
<if test="administrativeVillage != null and administrativeVillage != ''">administrative_village =
#{administrativeVillage},
</if>
<if test="natureVillage != null and natureVillage != ''">nature_village = #{natureVillage},</if>
<if test="totalHousehold != null">total_household = #{totalHousehold},</if>
<if test="houseType != null">house_type = #{houseType},</if>
<if test="coveredHousehold != null">covered_household = #{coveredHousehold},</if>
<if test="signHousehold != null">sign_household = #{signHousehold},</if>
<if test="marketType != null">market_type = #{marketType},</if>
<if test="businessType != null">business_type = #{businessType},</if>
<if test="signType != null">sign_type = #{signType},</if>
<if test="businessArea != null">business_area = #{businessArea},</if>
<if test="fullAmount != null">full_amount = #{fullAmount},</if>
<if test="byStages != null">by_stages = #{byStages},</if>
<if test="unpaid != null">unpaid = #{unpaid},</if>
<if test="actual != null">actual = #{actual},</if>
<if test="installCondition != null">install_condition = #{installCondition},</if>
<if test="noInstallCondition != null">no_install_condition = #{noInstallCondition},</if>
<if test="financeConfirm != null">finance_confirm = #{financeConfirm},</if>
<if test="ventilation != null">ventilation = #{ventilation},</if>
<if test="actualFire != null">actual_fire = #{actualFire},</if>
<if test="intoRemodel != null">into_remodel = #{intoRemodel},</if>
<if test="currentConfirm != null">current_confirm = #{currentConfirm},</if>
<if test="afterConfirm != null">after_confirm = #{afterConfirm},</if>
<if test="lastConfirm != null">last_confirm = #{lastConfirm},</if>
<if test="distance != null">distance = #{distance},</if>
<if test="status != null">status = #{status},</if>
<if test="statusName != null and statusName != ''">status_name = #{statusName},</if>
<if test="sysCtime != null">sys_ctime = #{sysCtime},</if>
<if test="sysUtime != null">sys_utime = #{sysUtime},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="deleteFlag != null">delete_flag = #{deleteFlag},</if>
<if test="developStatus != null">develop_status = #{developStatus},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePoolResidentLedgerById" parameterType="Long">
delete
from pool_resident_ledger
where id = #{id}
</delete>
<delete id="deletePoolResidentLedgerByIds" parameterType="String">
delete from pool_resident_ledger
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectPoolResidentLedgerByIds" parameterType="Long" resultMap="PoolResidentLedgerResult">
<include refid="selectPoolResidentLedgerVo"/>
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="selectCount" resultType="java.lang.Integer">
select count(*)
from pool_resident_ledger
<where>
<if test="entity != null and entity != ''">and entity in
<foreach item="entity" collection="entity" open="(" separator="," close=")">
#{entity}
</foreach>
</if>
<if test="area != null and area != ''">and area = #{area}</if>
<if test="developStatus != null ">and develop_status = #{developStatus}</if>
</where>
</select>
<select id="selectCount1" resultType="java.lang.Integer">
select sum(case develop_status when '1' then (total_household-finance_confirm) else 0 end)+sum(case develop_status when '0' then install_condition else 0 end)
from pool_resident_ledger
<where>
<if test="area != null and area != ''">and area = #{area}</if>
</where>
</select>
<select id="selectCountForArea" resultType="java.lang.Integer">
select count(*)
from pool_resident_ledger
<where>
<if test="entity != null and entity != ''">and entity = #{entity}</if>
</where>
</select>
<select id="selectCountDays" resultMap="PoolResidentLedgerResult1">
select CURDATE() - INTERVAL 6 day AS days,if(bbb.count = 0,0,bbb.count) AS count
from (select count(1) as count from pool_resident_ledger where date(sys_ctime)=CURDATE() - INTERVAL 6 DAY AND entity = 1136) as bbb
UNION
select CURDATE() - INTERVAL 5 day AS days,if(bbb.count = 0,0,bbb.count) AS count
from (select count(1) as count from pool_resident_ledger where date(sys_ctime)=CURDATE() - INTERVAL 5 DAY AND entity = 1136) as bbb
UNION
select CURDATE() - INTERVAL 4 day AS days,if(bbb.count = 0,0,bbb.count) AS count
from (select count(1) as count from pool_resident_ledger where date(sys_ctime)=CURDATE() - INTERVAL 4 DAY AND entity = 1136) as bbb
UNION
select CURDATE() - INTERVAL 3 day AS days,if(bbb.count = 0,0,bbb.count) AS count
from (select count(1) as count from pool_resident_ledger where date(sys_ctime)=CURDATE() - INTERVAL 3 DAY AND entity = 1136) as bbb
UNION
select CURDATE() - INTERVAL 2 day AS days,if(bbb.count = 0,0,bbb.count) AS count
from (select count(1) as count from pool_resident_ledger where date(sys_ctime)=CURDATE() - INTERVAL 2 DAY AND entity = 1136) as bbb
UNION
select CURDATE() - INTERVAL 1 day AS days,if(bbb.count = 0,0,bbb.count) AS count
from (select count(1) as count from pool_resident_ledger where date(sys_ctime)=CURDATE() - INTERVAL 1 DAY AND entity = 1136) as bbb
UNION
select CURDATE() - INTERVAL 0 day AS days,if(bbb.count = 0,0,bbb.count) AS count
from (select count(1) as count from pool_resident_ledger where date(sys_ctime)=CURDATE() - INTERVAL 0 DAY AND entity = 1136) as bbb
</select>
<select id="selectCountUndeveloped" resultType="java.lang.Integer">
select SUM(install_condition)
from pool_resident_ledger
<where>
<if test="entity != null and entity != ''">and entity in
<foreach item="entity" collection="entity" open="(" separator="," close=")">
#{entity}
</foreach>
</if>
<if test="area != null and area != ''">and area = #{area}</if>
<if test="developStatus != null ">and develop_status = #{developStatus}</if>
</where>
</select>
<select id="selectCountDeveloped" resultType="java.lang.Integer">
select SUM(total_household) - SUM(finance_confirm)
from pool_resident_ledger
<where>
<if test="entity != null and entity != ''">and entity in
<foreach item="entity" collection="entity" open="(" separator="," close=")">
#{entity}
</foreach>
</if>
<if test="area != null and area != ''">and area = #{area}</if>
<if test="developStatus != null ">and develop_status = #{developStatus}</if>
</where>
</select>
</mapper>