RegBusSlsqDao.xml
12.6 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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
<?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.thinkgem.jeesite.modules.reg.dao.bus.RegBusSlsqDao">
<sql id="regBusSlsqColumns">
a.id AS "id",
a.ysdm AS "ysdm",
a.ywh AS "ywh",
a.djdl AS "djdl",
a.djxl AS "djxl",
a.sqzsbs AS "sqzsbs",
a.sqfbcz AS "sqfbcz",
a.qxdm AS "qxdm",
a.slry AS "slry",
a.slsj AS "slsj",
a.zl AS "zl",
a.tzrxm AS "tzrxm",
a.tzfs AS "tzfs",
a.tzrdh AS "tzrdh",
a.tzryddh AS "tzryddh",
a.tzrdzyj AS "tzrdzyj",
a.sfwtaj AS "sfwtaj",
a.jssj AS "jssj",
a.ajzt AS "ajzt",
a.bz AS "bz",
a.proc_ins_id AS "procInsId",
a.taskdefkey AS "taskdefkey",
a.fjinfo AS "fjinfo",
a.str AS "str",
a.isgs AS "isgs",
a.islock AS "islock",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.remarks AS "remarks",
a.bdcqzh AS "bdcqzh",
a.proid,
a.fybh,
a.sllx,
a.del_flag AS "delFlag"
</sql>
<resultMap type="java.util.Map" id="allInfo">
<result column = "COUNT(*)" property="count" jdbcType="INTEGER"/>
<result column = "SUM(b.MJ)" property="mj" jdbcType="NUMERIC"/>
</resultMap>
<select id="getBsst" resultMap="allInfo">
SELECT
COUNT(*),SUM(b.MJ)
FROM reg_bus_slsq a,reg_bus_bdcqzsdjxx b
<where>
to_char(a.update_date,'yyyymm') >= #{qssj1}
AND to_char(a.update_date,'yyyymm') <= #{jssj1}
AND a.taskdefkey in
<if test="taskdefkeyList !=null and taskdefkeyList.size() != 0">
(
<foreach collection="taskdefkeyList" item="value" index="index">
<if test="(index+1)==taskdefkeyList.size()">
#{value,jdbcType=VARCHAR}
</if>
<if test="(index+1)!=taskdefkeyList.size()">
#{value,jdbcType=VARCHAR},
</if>
</foreach>
)
</if>
<if test= "status != null and status != ''">
<if test= "status == 1">
AND (b.status != '98' AND b.status != '99' or b.status is null)
AND b.djlx = #{djlx}
</if>
<if test= "status == 9899">
AND (b.status = '98' or b.status = '99')
</if>
</if>
AND a.djxl = #{djlx}
AND a.ywh = b.YWH
</where>
</select>
<select id="getBsst1" resultType="RegBusSlsq">
SELECT
<include refid="regBusSlsqColumns"/>
FROM reg_bus_slsq a,reg_bus_bdcqzsdjxx b
<where>
REPLACE(substr(a.update_date,1,7),'-','') >= #{qssj1}
AND REPLACE(substr(a.update_date,1,7),'-','') <= #{jssj1}
AND a.taskdefkey in
<if test="taskdefkeyList !=null and taskdefkeyList.size() != 0">
(
<foreach collection="taskdefkeyList" item="value" index="index">
<if test="(index+1)==taskdefkeyList.size()">
#{value,jdbcType=VARCHAR}
</if>
<if test="(index+1)!=taskdefkeyList.size()">
#{value,jdbcType=VARCHAR},
</if>
</foreach>
)
</if>
<if test= "status != null and status != ''">
<if test= "status == 1">
AND (b.status != '98' AND b.status != '99' or b.status is null)
AND b.djlx = #{djlx}
</if>
<if test= "status == 9899">
AND (b.status = '98' or b.status = '99')
</if>
</if>
<if test= "rights != null and rights != ''">
<if test= "rights == 25">
AND (b.rights = '2' or b.rights = '5')
</if>
</if>
AND a.djxl = #{djlx}
AND a.ywh = b.YWH
GROUP BY a.YWH
</where>
</select>
<select id="OracleGetBsst1" resultType="RegBusSlsq">
SELECT ywh
from ( select b.ywh ,
row_number() over(partition by b.ywh order by b.ywh desc) rn
from reg_bus_slsq a,reg_bus_bdcqzsdjxx b
where to_char(a.update_date,'yyyymm') >= #{qssj1}
AND to_char(a.update_date,'yyyymm') <= #{jssj1}
AND a.taskdefkey in
<if test="taskdefkeyList !=null and taskdefkeyList.size() != 0">
(
<foreach collection="taskdefkeyList" item="value" index="index">
<if test="(index+1)==taskdefkeyList.size()">
#{value,jdbcType=VARCHAR}
</if>
<if test="(index+1)!=taskdefkeyList.size()">
#{value,jdbcType=VARCHAR},
</if>
</foreach>
)
</if>
<if test= "status != null and status != ''">
<if test= "status == 1">
AND (b.status != '98' AND b.status != '99' or b.status is null)
</if>
<if test= "status == 9899">
AND (b.status = '98' or b.status = '99')
</if>
</if>
<if test= "rights != null and rights != ''">
<if test= "rights == 25">
AND (b.rights = '2' or b.rights = '5')
</if>
</if>
AND a.djxl = #{djlx}
AND a.ywh = b.YWH
)
where rn = 1
</select>
<sql id="regBusSlsqJoins">
</sql>
<select id="get" resultType="RegBusSlsq">
SELECT
<include refid="regBusSlsqColumns"/>
FROM reg_bus_slsq a
<include refid="regBusSlsqJoins"/>
WHERE a.id = #{id}
</select>
<!--通过业务号获取一条申请受理信息 -->
<select id="getByYwh" resultType="RegBusSlsq">
SELECT
<include refid="regBusSlsqColumns"/>
FROM reg_bus_slsq a
<include refid="regBusSlsqJoins"/>
WHERE a.ywh = #{ywh} AND del_flag = '0'
</select>
<select id="getByProcInsId" resultType="RegBusSlsq">
SELECT
<include refid="regBusSlsqColumns"/>
FROM reg_bus_slsq a
<include refid="regBusSlsqJoins"/>
WHERE a.proc_ins_id = #{procInsId}
</select>
<update id="updateInsId">
UPDATE reg_bus_slsq SET
proc_ins_id = #{procInsId},
update_by = #{updateBy.id},
update_date = #{updateDate}
WHERE id = #{id}
</update>
<update id="updateTaskDefKey">
UPDATE reg_bus_slsq SET
taskdefkey = #{taskdefkey},
fjinfo = #{fjinfo},
slsj = #{slsj},
jssj = #{jssj},
update_by = #{updateBy.id},
update_date = #{updateDate}
WHERE id = #{id}
</update>
<update id="updateFjinfo">
UPDATE reg_bus_slsq SET
fjinfo = #{fjinfo},
update_by = #{updateBy.id},
update_date = #{updateDate}
WHERE id = #{id}
</update>
<select id="findMaxYwh" resultType="string">
SELECT MAX(ywh) from reg_bus_slsq
</select>
<select id="findList" resultType="RegBusSlsq">
SELECT
<include refid="regBusSlsqColumns"/>
FROM reg_bus_slsq a
<include refid="regBusSlsqJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
<if test="ywh != null and ywh != ''">
AND a.ywh LIKE
<if test="dbName == 'oracle'">'%'||#{ywh}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{ywh}+'%'</if>
<if test="dbName == 'mysql'">concat('%',#{ywh},'%')</if>
</if>
<if test="djxl != null and djxl != ''">
AND a.djxl = #{djxl}
</if>
<if test="djdl != null and djdl != ''">
AND a.djdl = #{djdl}
</if>
<if test="sllx != null and sllx != ''">
AND a.sllx = #{sllx}
</if>
<if test="tzrxm != null and tzrxm != ''">
AND a.tzrxm LIKE
<if test="dbName == 'oracle'">'%'||#{tzrxm}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{tzrxm}+'%'</if>
<if test="dbName == 'mysql'">concat('%',#{tzrxm},'%')</if>
</if>
<if test="slry != null and slry != ''">
AND a.slry LIKE
<if test="dbName == 'oracle'">'%'||#{slry}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{slry}+'%'</if>
<if test="dbName == 'mysql'">concat('%',#{slry},'%')</if>
</if>
<if test="proid != null and proid != ''">
AND a.proid = #{proid}
</if>
<if test="slsj != null and slsj != ''">
<![CDATA[ AND DATE_FORMAT(a.slsj, '%Y-%m-%d') = DATE_FORMAT(#{slsj}, '%Y-%m-%d') ]]>
</if>
<if test="taskdefkey != null and taskdefkey != ''">
AND a.taskdefkey = #{taskdefkey}
</if>
<if test="create_by != null and create_by != ''">
AND a.create_by = #{create_by}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<select id="findAllList" resultType="RegBusSlsq">
SELECT
<include refid="regBusSlsqColumns"/>
FROM reg_bus_slsq a
<include refid="regBusSlsqJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<!-- 自动启动流程 -->
<update id="updateidentity">
UPDATE ACT_RU_IDENTITYLINK SET
group_id_ = #{groupid},
task_id_ = #{taskid},
proc_inst_id_ = null
WHERE proc_inst_id_ = #{procInsId}
</update>
<!-- 自动启动流程 -->
<update id="updatetask">
UPDATE ACT_RU_TASK SET
assignee_ = #{assignee}
WHERE proc_inst_id_ = #{procInsId}
</update>
<!-- 自动启动流程 -->
<select id="taskidinfo" resultType="string">
select id_ from ACT_RU_TASK where proc_inst_id_ = #{procInsId}
</select>
<!-- 自动启动流程,签收任务时为提交受理申请业务-->
<update id="updateslsqidentity">
UPDATE ACT_RU_IDENTITYLINK SET
group_id_ = null,
task_id_ = null,
proc_inst_id_ = #{procinstid}
WHERE task_id_ = #{taskid}
</update>
<!-- 自动启动流程,签收任务时为提交受理申请业务-->
<update id="updateslsqtask">
UPDATE ACT_RU_TASK SET
assignee_ = #{assignee}
WHERE id_ = #{taskid}
</update>
<!-- 自动启动流程,审核环节-->
<select id="taskactinfo" resultType="java.util.HashMap">
select ID_,NAME_,TASK_DEF_KEY_,PROC_DEF_ID_ from ACT_RU_TASK where proc_inst_id_ = #{procInsId}
</select>
<insert id="insert">
INSERT INTO reg_bus_slsq(
id,
ysdm,
ywh,
djdl,
djxl,
sqzsbs,
sqfbcz,
qxdm,
slry,
slsj,
zl,
tzrxm,
tzfs,
tzrdh,
tzryddh,
tzrdzyj,
sfwtaj,
jssj,
ajzt,
bz,
proc_ins_id,
taskdefkey,
fjinfo,
str,
isgs,
islock,
create_by,
create_date,
update_by,
update_date,
remarks,
bdcqzh,
<if test="sllx != null and sllx != ''">
sllx,
</if>
<if test="proid != null and proid != ''">
proid,
</if>
fybh,
del_flag
) VALUES (
#{id},
#{ysdm},
#{ywh},
#{djdl},
#{djxl},
#{sqzsbs},
#{sqfbcz},
#{qxdm},
#{slry},
#{slsj},
#{zl},
#{tzrxm},
#{tzfs},
#{tzrdh},
#{tzryddh},
#{tzrdzyj},
#{sfwtaj},
#{jssj},
#{ajzt},
#{bz},
#{procInsId},
#{taskdefkey},
#{fjinfo},
#{str},
#{isgs},
#{islock},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{bdcqzh},
<if test="sllx != null and sllx != ''">
#{sllx},
</if>
<if test="proid != null and proid != ''">
#{proid},
</if>
#{fybh},
#{delFlag}
)
</insert>
<update id="update">
UPDATE reg_bus_slsq SET
ysdm = #{ysdm},
ywh = #{ywh},
djdl = #{djdl},
djxl = #{djxl},
sqzsbs = #{sqzsbs},
sqfbcz = #{sqfbcz},
qxdm = #{qxdm},
slry = #{slry},
slsj = #{slsj},
zl = #{zl},
tzrxm = #{tzrxm},
tzfs = #{tzfs},
tzrdh = #{tzrdh},
tzryddh = #{tzryddh},
tzrdzyj = #{tzrdzyj},
sfwtaj = #{sfwtaj},
jssj = #{jssj},
ajzt = #{ajzt},
bz = #{bz},
proc_ins_id = #{procInsId},
taskdefkey = #{taskdefkey},
fjinfo = #{fjinfo},
str = #{str},
isgs = #{isgs},
islock = #{islock},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks},
bdcqzh = #{bdcqzh},
fybh = #{fybh},
proid= #{proid},
sllx = #{sllx}
WHERE id = #{id}
</update>
<update id="delete">
UPDATE reg_bus_slsq SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<!-- 获取流量 -->
<select id="getYflow" resultType="java.util.HashMap">
select f.sj as sj,nvl(count(s.ywh),0) sl
from reg_bus_slsq s right join wx_flow f
on to_char(s.create_date,'yyyy-MM-dd') = #{0}
and trunc(to_number(to_char(s.create_date, 'hh24')) / 1) = f.sj
group by f.sj
order by to_number(f.sj) asc
</select>
<select id="getWflow" resultType="java.util.HashMap">
select to_char(b.sj,'yyyy/MM/dd') sj,count(a.ywh) sl from reg_bus_slsq a right join
(select trunc(to_date(#{0},'yyyy/MM/dd'),'dd')+(level-1) sj,level from dual connect by level <6) b
on to_char(a.create_date,'yyyy/MM/dd')=to_char(b.sj,'yyyy/MM/dd') group by b.sj order by b.sj asc
</select>
<select id="progress" resultType="Map">
select s.taskdefkey from reg_bus_slsq s where s.ywh = #{0}
</select>
<select id="getCreateYwh" resultType="java.lang.String">
select CREATE_YWH() ywh from dual
</select>
<insert id="saveRecord" flushCache="true">
INSERT INTO REG_BUS_YWH_RECORD (
id,
rq,
ywh,
userid,
createdate
) VALUES (
#{id},
#{rq},
#{ywh},
#{userid},
sysdate
)
</insert>
</mapper>