McBasicCmtyMapper.xml
22.4 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
<?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.schsf.mapper.McBasicCmtyMapper">
<resultMap type="com.chinagas.modules.schsf.domain.McBasicCmty" id="McBasicCmtyResult">
<result property="id" column="id" />
<result property="fiscalYear" column="fiscal_year" />
<result property="regionName" column="region_name" />
<result property="groupName" column="group_name" />
<result property="companyName" column="company_name" />
<result property="companyCode" column="company_code" />
<result property="province" column="province" />
<result property="city" column="city" />
<result property="district" column="district" />
<result property="street" column="street" />
<result property="vlgOrCmty" column="vlg_or_cmty" />
<result property="respPerson" column="resp_person" />
<result property="urbRurCls" column="urb_rur_cls" />
<result property="projectTypeName" column="project_type_name" />
<result property="commHh" column="comm_hh" />
<result property="acctFyStartConf" column="acct_fy_start_conf" />
<result property="acctPrevRecov" column="acct_prev_recov" />
<result property="acctPrevCharged" column="acct_prev_charged" />
<result property="currFyNewRecovered" column="curr_fy_new_recovered" />
<result property="totalCharged" column="total_charged" />
<result property="qtrTargetCompany" column="qtr_target_company" />
<result property="hhGsgCharged" column="hh_gsg_charged" />
<result property="hhGsgUncharged" column="hh_gsg_uncharged" />
<result property="hhGsgTotal" column="hh_gsg_total" />
<result property="hhNewFull" column="hh_new_full" />
<result property="hhNewInstall" column="hh_new_install" />
<result property="hhPrevFull" column="hh_prev_full" />
<result property="hhPrevInstDp" column="hh_prev_inst_dp" />
<result property="hhUnchg" column="hh_unchg" />
<result property="hhUnchgConf" column="hh_unchg_conf" />
<result property="hhUnchgScan" column="hh_unchg_scan" />
<result property="hhEvCumPaid" column="hh_ev_cum_paid" />
<result property="hhEvInst" column="hh_ev_inst" />
<result property="hhEvFull" column="hh_ev_full" />
<result property="hhEvIgnite" column="hh_ev_ignite" />
<result property="hhEvCumSetup" column="hh_ev_cum_setup" />
<result property="hhEvCumGas" column="hh_ev_cum_gas" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="defFlag" column="def_flag" />
</resultMap>
<sql id="selectMcBasicCmtyVo">
select m.id, m.fiscal_year, m.region_name, m.group_name, m.company_name, m.company_code, m.province, m.city, m.district, m.street, m.vlg_or_cmty, m.resp_person, m.urb_rur_cls, m.project_type_name, m.comm_hh, m.acct_fy_start_conf, m.acct_prev_recov, m.acct_prev_charged, m.curr_fy_new_recovered, m.total_charged, m.qtr_target_company, m.hh_gsg_charged, m.hh_gsg_uncharged, m.hh_gsg_total, m.hh_new_full, m.hh_new_install, m.hh_prev_full, m.hh_prev_inst_dp, m.hh_unchg, m.hh_unchg_conf,
m.hh_unchg_scan, m.hh_ev_cum_paid, m.hh_ev_inst, m.hh_ev_full, m.hh_ev_ignite, m.hh_ev_cum_setup, m.hh_ev_cum_gas, m.remark, m.create_time, m.create_by, m.update_time, m.update_by, m.def_flag
FROM mc_basic_cmty m
left join sys_user u on u.user_id = m.create_by
left join sys_dept d on d.dept_id = m.company_code
</sql>
<select id="selectMcBasicCmtyList" parameterType="com.chinagas.modules.schsf.domain.vo.McBasicCmtyVo" resultMap="McBasicCmtyResult">
<include refid="selectMcBasicCmtyVo"/>
where 1=1
<if test="fiscalYear != null "> and fiscal_year = #{fiscalYear}</if>
<if test="regionName != null and regionName != ''"> and region_name like concat('%', #{regionName}, '%')</if>
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
<if test="companyCode != null and companyCode != ''"> and company_code = #{companyCode}</if>
<if test="province != null and province != ''"> and province = #{province}</if>
<if test="city != null and city != ''"> and city = #{city}</if>
<if test="district != null and district != ''"> and district = #{district}</if>
<if test="street != null and street != ''"> and street = #{street}</if>
<if test="vlgOrCmty != null and vlgOrCmty != ''"> and vlg_or_cmty = #{vlgOrCmty}</if>
<if test="respPerson != null and respPerson != ''"> and resp_person = #{respPerson}</if>
<if test="urbRurCls != null and urbRurCls != ''"> and urb_rur_cls = #{urbRurCls}</if>
<if test="projectTypeName != null and projectTypeName != ''"> and project_type_name like concat('%', #{projectTypeName}, '%')</if>
<if test="commHh != null "> and comm_hh = #{commHh}</if>
<if test="acctFyStartConf != null "> and acct_fy_start_conf = #{acctFyStartConf}</if>
<if test="acctPrevRecov != null "> and acct_prev_recov = #{acctPrevRecov}</if>
<if test="acctPrevCharged != null "> and acct_prev_charged = #{acctPrevCharged}</if>
<if test="currFyNewRecovered != null "> and curr_fy_new_recovered = #{currFyNewRecovered}</if>
<if test="totalCharged != null "> and total_charged = #{totalCharged}</if>
<if test="qtrTargetCompany != null "> and qtr_target_company = #{qtrTargetCompany}</if>
<if test="hhGsgCharged != null "> and hh_gsg_charged = #{hhGsgCharged}</if>
<if test="hhGsgUncharged != null "> and hh_gsg_uncharged = #{hhGsgUncharged}</if>
<if test="hhGsgTotal != null "> and hh_gsg_total = #{hhGsgTotal}</if>
<if test="hhNewFull != null "> and hh_new_full = #{hhNewFull}</if>
<if test="hhNewInstall != null "> and hh_new_install = #{hhNewInstall}</if>
<if test="hhPrevFull != null "> and hh_prev_full = #{hhPrevFull}</if>
<if test="hhPrevInstDp != null "> and hh_prev_inst_dp = #{hhPrevInstDp}</if>
<if test="hhUnchg != null "> and hh_unchg = #{hhUnchg}</if>
<if test="hhUnchgConf != null "> and hh_unchg_conf = #{hhUnchgConf}</if>
<if test="hhUnchgScan != null "> and hh_unchg_scan = #{hhUnchgScan}</if>
<if test="hhEvCumPaid != null "> and hh_ev_cum_paid = #{hhEvCumPaid}</if>
<if test="hhEvInst != null "> and hh_ev_inst = #{hhEvInst}</if>
<if test="hhEvFull != null "> and hh_ev_full = #{hhEvFull}</if>
<if test="hhEvIgnite != null "> and hh_ev_ignite = #{hhEvIgnite}</if>
<if test="hhEvCumSetup != null "> and hh_ev_cum_setup = #{hhEvCumSetup}</if>
<if test="hhEvCumGas != null "> and hh_ev_cum_gas = #{hhEvCumGas}</if>
<if test="defFlag != null and defFlag != ''"> and m.def_flag = #{defFlag}</if>
<if test="startFiscalYear != null and startFiscalYear != ''"> and m.fiscal_year >= #{startFiscalYear}</if>
<if test="finishFiscalYear != null and finishFiscalYear != ''"> and m.fiscal_year <= #{finishFiscalYear}</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by m.update_time desc
</select>
<select id="selectMcBasicCmtyById" parameterType="Long" resultMap="McBasicCmtyResult">
<include refid="selectMcBasicCmtyVo"/>
where id = #{id}
</select>
<insert id="insertMcBasicCmty" parameterType="com.chinagas.modules.schsf.domain.McBasicCmty" useGeneratedKeys="true" keyProperty="id">
insert into mc_basic_cmty
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="fiscalYear != null">fiscal_year,</if>
<if test="regionName != null and regionName != ''">region_name,</if>
<if test="groupName != null and groupName != ''">group_name,</if>
<if test="companyName != null and companyName != ''">company_name,</if>
<if test="companyCode != null and companyCode != ''">company_code,</if>
<if test="province != null">province,</if>
<if test="city != null">city,</if>
<if test="district != null">district,</if>
<if test="street != null">street,</if>
<if test="vlgOrCmty != null">vlg_or_cmty,</if>
<if test="respPerson != null">resp_person,</if>
<if test="urbRurCls != null">urb_rur_cls,</if>
<if test="projectTypeName != null">project_type_name,</if>
<if test="commHh != null">comm_hh,</if>
<if test="acctFyStartConf != null">acct_fy_start_conf,</if>
<if test="acctPrevRecov != null">acct_prev_recov,</if>
<if test="acctPrevCharged != null">acct_prev_charged,</if>
<if test="currFyNewRecovered != null">curr_fy_new_recovered,</if>
<if test="totalCharged != null">total_charged,</if>
<if test="qtrTargetCompany != null">qtr_target_company,</if>
<if test="hhGsgCharged != null">hh_gsg_charged,</if>
<if test="hhGsgUncharged != null">hh_gsg_uncharged,</if>
<if test="hhGsgTotal != null">hh_gsg_total,</if>
<if test="hhNewFull != null">hh_new_full,</if>
<if test="hhNewInstall != null">hh_new_install,</if>
<if test="hhPrevFull != null">hh_prev_full,</if>
<if test="hhPrevInstDp != null">hh_prev_inst_dp,</if>
<if test="hhUnchg != null">hh_unchg,</if>
<if test="hhUnchgConf != null">hh_unchg_conf,</if>
<if test="hhUnchgScan != null">hh_unchg_scan,</if>
<if test="hhEvCumPaid != null">hh_ev_cum_paid,</if>
<if test="hhEvInst != null">hh_ev_inst,</if>
<if test="hhEvFull != null">hh_ev_full,</if>
<if test="hhEvIgnite != null">hh_ev_ignite,</if>
<if test="hhEvCumSetup != null">hh_ev_cum_setup,</if>
<if test="hhEvCumGas != null">hh_ev_cum_gas,</if>
<if test="remark != null">remark,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="defFlag != null and defFlag != ''">def_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="fiscalYear != null">#{fiscalYear},</if>
<if test="regionName != null and regionName != ''">#{regionName},</if>
<if test="groupName != null and groupName != ''">#{groupName},</if>
<if test="companyName != null and companyName != ''">#{companyName},</if>
<if test="companyCode != null and companyCode != ''">#{companyCode},</if>
<if test="province != null">#{province},</if>
<if test="city != null">#{city},</if>
<if test="district != null">#{district},</if>
<if test="street != null">#{street},</if>
<if test="vlgOrCmty != null">#{vlgOrCmty},</if>
<if test="respPerson != null">#{respPerson},</if>
<if test="urbRurCls != null">#{urbRurCls},</if>
<if test="projectTypeName != null">#{projectTypeName},</if>
<if test="commHh != null">#{commHh},</if>
<if test="acctFyStartConf != null">#{acctFyStartConf},</if>
<if test="acctPrevRecov != null">#{acctPrevRecov},</if>
<if test="acctPrevCharged != null">#{acctPrevCharged},</if>
<if test="currFyNewRecovered != null">#{currFyNewRecovered},</if>
<if test="totalCharged != null">#{totalCharged},</if>
<if test="qtrTargetCompany != null">#{qtrTargetCompany},</if>
<if test="hhGsgCharged != null">#{hhGsgCharged},</if>
<if test="hhGsgUncharged != null">#{hhGsgUncharged},</if>
<if test="hhGsgTotal != null">#{hhGsgTotal},</if>
<if test="hhNewFull != null">#{hhNewFull},</if>
<if test="hhNewInstall != null">#{hhNewInstall},</if>
<if test="hhPrevFull != null">#{hhPrevFull},</if>
<if test="hhPrevInstDp != null">#{hhPrevInstDp},</if>
<if test="hhUnchg != null">#{hhUnchg},</if>
<if test="hhUnchgConf != null">#{hhUnchgConf},</if>
<if test="hhUnchgScan != null">#{hhUnchgScan},</if>
<if test="hhEvCumPaid != null">#{hhEvCumPaid},</if>
<if test="hhEvInst != null">#{hhEvInst},</if>
<if test="hhEvFull != null">#{hhEvFull},</if>
<if test="hhEvIgnite != null">#{hhEvIgnite},</if>
<if test="hhEvCumSetup != null">#{hhEvCumSetup},</if>
<if test="hhEvCumGas != null">#{hhEvCumGas},</if>
<if test="remark != null">#{remark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="defFlag != null and defFlag != ''">#{defFlag},</if>
</trim>
</insert>
<update id="updateMcBasicCmty" parameterType="com.chinagas.modules.schsf.domain.McBasicCmty">
update mc_basic_cmty
<trim prefix="SET" suffixOverrides=",">
<if test="fiscalYear != null">fiscal_year = #{fiscalYear},</if>
<if test="regionName != null and regionName != ''">region_name = #{regionName},</if>
<if test="groupName != null and groupName != ''">group_name = #{groupName},</if>
<if test="companyName != null and companyName != ''">company_name = #{companyName},</if>
<if test="companyCode != null and companyCode != ''">company_code = #{companyCode},</if>
<if test="province != null">province = #{province},</if>
<if test="city != null">city = #{city},</if>
<if test="district != null">district = #{district},</if>
<if test="street != null">street = #{street},</if>
<if test="vlgOrCmty != null">vlg_or_cmty = #{vlgOrCmty},</if>
<if test="respPerson != null">resp_person = #{respPerson},</if>
<if test="urbRurCls != null">urb_rur_cls = #{urbRurCls},</if>
<if test="projectTypeName != null">project_type_name = #{projectTypeName},</if>
<if test="commHh != null">comm_hh = #{commHh},</if>
<if test="acctFyStartConf != null">acct_fy_start_conf = #{acctFyStartConf},</if>
<if test="acctPrevRecov != null">acct_prev_recov = #{acctPrevRecov},</if>
<if test="acctPrevCharged != null">acct_prev_charged = #{acctPrevCharged},</if>
<if test="currFyNewRecovered != null">curr_fy_new_recovered = #{currFyNewRecovered},</if>
<if test="totalCharged != null">total_charged = #{totalCharged},</if>
<if test="qtrTargetCompany != null">qtr_target_company = #{qtrTargetCompany},</if>
<if test="hhGsgCharged != null">hh_gsg_charged = #{hhGsgCharged},</if>
<if test="hhGsgUncharged != null">hh_gsg_uncharged = #{hhGsgUncharged},</if>
<if test="hhGsgTotal != null">hh_gsg_total = #{hhGsgTotal},</if>
<if test="hhNewFull != null">hh_new_full = #{hhNewFull},</if>
<if test="hhNewInstall != null">hh_new_install = #{hhNewInstall},</if>
<if test="hhPrevFull != null">hh_prev_full = #{hhPrevFull},</if>
<if test="hhPrevInstDp != null">hh_prev_inst_dp = #{hhPrevInstDp},</if>
<if test="hhUnchg != null">hh_unchg = #{hhUnchg},</if>
<if test="hhUnchgConf != null">hh_unchg_conf = #{hhUnchgConf},</if>
<if test="hhUnchgScan != null">hh_unchg_scan = #{hhUnchgScan},</if>
<if test="hhEvCumPaid != null">hh_ev_cum_paid = #{hhEvCumPaid},</if>
<if test="hhEvInst != null">hh_ev_inst = #{hhEvInst},</if>
<if test="hhEvFull != null">hh_ev_full = #{hhEvFull},</if>
<if test="hhEvIgnite != null">hh_ev_ignite = #{hhEvIgnite},</if>
<if test="hhEvCumSetup != null">hh_ev_cum_setup = #{hhEvCumSetup},</if>
<if test="hhEvCumGas != null">hh_ev_cum_gas = #{hhEvCumGas},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="defFlag != null and defFlag != ''">def_flag = #{defFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMcBasicCmtyById" parameterType="Long">
delete from mc_basic_cmty where id = #{id}
</delete>
<delete id="deleteMcBasicCmtyByIds" parameterType="String">
delete from mc_basic_cmty where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getDistinctRegionList" resultType="com.chinagas.modules.schsf.domain.dto.CompanyDto"
parameterType="com.chinagas.modules.schsf.domain.vo.McBasicCmtyVo">
SELECT DISTINCT t.region_name as 'value',t.region_name as 'label'
FROM mc_basic_cmty t
left join sys_user u on u.user_id = t.create_by
left join sys_dept d on d.dept_id = t.company_code
WHERE 1=1
<if test="defFlag != null and defFlag != ''"> and t.def_flag = #{defFlag}</if>
<if test="fiscalYear != null "> and t.fiscal_year = #{fiscalYear}</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="getDistinctGroupList" resultType="com.chinagas.modules.schsf.domain.dto.CompanyDto"
parameterType="com.chinagas.modules.schsf.domain.vo.McBasicCmtyVo">
SELECT DISTINCT t.group_name as 'value',t.group_name as 'label'
FROM mc_basic_cmty t
left join sys_user u on u.user_id = t.create_by
left join sys_dept d on d.dept_id = t.company_code
WHERE 1=1
<if test="regionName != null and regionName != ''"> and t.region_name = #{regionName}</if>
<if test="defFlag != null and defFlag != ''"> and t.def_flag = #{defFlag}</if>
<if test="fiscalYear != null "> and t.fiscal_year = #{fiscalYear}</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="getDistinctCompanyList" resultType="com.chinagas.modules.schsf.domain.McBasicCmty"
parameterType="com.chinagas.modules.schsf.domain.vo.McBasicCmtyVo">
SELECT DISTINCT
t.company_code as 'companyCode',
t.company_name as 'companyName'
FROM mc_basic_cmty t
left join sys_user u on u.user_id = t.create_by
left join sys_dept d on d.dept_id = t.company_code
WHERE 1 = 1
<if test="groupName != null and groupName != ''">
and t.group_name = #{groupName}
</if>
<if test="regionName != null and regionName != ''">
and t.region_name = #{regionName}
</if>
<if test="defFlag != null and defFlag != ''">
and t.def_flag = #{defFlag}
</if>
<if test="fiscalYear != null">
and t.fiscal_year = #{fiscalYear}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectVlgOrCmtyList" resultMap="McBasicCmtyResult" parameterType="com.chinagas.modules.schsf.domain.vo.McBasicCmtyVo">
SELECT DISTINCT t.vlg_or_cmty,t.urb_rur_cls,t.province,t.city,t.district,t.street
FROM mc_basic_cmty t
left join sys_user u on u.user_id = t.create_by
left join sys_dept d on d.dept_id = t.company_code
WHERE 1 = 1
<if test="groupName != null and groupName != ''">
and t.group_name = #{groupName}
</if>
<if test="regionName != null and regionName != ''">
and t.region_name = #{regionName}
</if>
<if test="defFlag != null and defFlag != ''">
and t.def_flag = #{defFlag}
</if>
<if test="fiscalYear != null">
and t.fiscal_year = #{fiscalYear}
</if>
<if test="companyName != null and companyName != ''">
and t.company_name = #{companyName}
</if>
<if test="companyCode != null and companyCode != ''">
and t.company_code = #{companyCode}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectMcBasicCmtyByData" resultMap="McBasicCmtyResult" parameterType="com.chinagas.modules.schsf.domain.vo.McBasicCmtyVo">
<include refid="selectMcBasicCmtyVo"/>
where 1=1
and m.fiscal_year = #{fiscalYear}
and m.region_name = #{regionName}
and m.group_name = #{groupName}
and m.company_name = #{companyName}
and m.company_code = #{companyCode}
and m.province = #{province}
and m.city = #{city}
and m.district = #{district}
and m.street = #{street}
and m.vlg_or_cmty = #{vlgOrCmty}
</select>
<select id="selectVisitDeptList" resultMap="McBasicCmtyResult" parameterType="com.chinagas.modules.schsf.domain.vo.McBasicCmtyVo">
<include refid="selectMcBasicCmtyVo"/>
WHERE 1 = 1
and m.group_name = #{groupName}
and m.region_name = #{regionName}
and m.company_name = #{companyName}
and m.company_code = #{companyCode}
and m.vlg_or_cmty = #{vlgOrCmty}
</select>
</mapper>