8dc487b1
함상기
Init Version - 20...
|
1
2
3
4
5
6
7
8
9
10
11
|
<?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.batch.mapper.primary.MatchingInnerDelingMapper">
<!-- 작업리스트 -->
<select id="getCustomItemReadData" parameterType="map" resultType="map">
SELECT
sys_se
, accnut_ym
, cpr_code
, partn_cpr
|
8dc487b1
함상기
Init Version - 20...
|
12
13
14
15
16
17
18
|
FROM
(
SELECT
sys_se
, accnut_ym
, cpr_code
, partn_cpr
|
8dc487b1
함상기
Init Version - 20...
|
19
20
21
22
23
24
25
26
|
, case when count(*) > 0 then 1 else 0 end as cnt
FROM
public.batch_tbcr_inner_delng
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
and mtch_ty is null
and dta_ty in ('11','21','31','33','35','37','41')
|
30bbef42
함상기
ai sub Matching 추가
|
27
28
29
30
31
32
|
<if test='cpr_code != null and !cpr_code.equals("")'>
and cpr_code = #{cpr_code}
</if>
<if test='partn_cpr != null and !partn_cpr.equals("")'>
and partn_cpr = #{partn_cpr}
</if>
|
8dc487b1
함상기
Init Version - 20...
|
33
34
35
36
37
|
GROUP BY
sys_se
, accnut_ym
, cpr_code
, partn_cpr
|
8dc487b1
함상기
Init Version - 20...
|
38
39
40
41
42
43
|
union all
SELECT
sys_se
, accnut_ym
, partn_cpr as cpr_code
, cpr_code as partn_cpr
|
8dc487b1
함상기
Init Version - 20...
|
44
45
46
47
48
49
50
51
|
, case when count(*) > 0 then 1 else 0 end as cnt
FROM
public.batch_tbcr_inner_delng
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
and mtch_ty is null
and dta_ty in ('12','22','32','34','36','38','42')
|
30bbef42
함상기
ai sub Matching 추가
|
52
|
<if test='partn_cpr != null and !partn_cpr.equals("")'>
|
415842d2
함상기
20240408
|
53
54
55
56
|
and cpr_code = #{partn_cpr}
</if>
<if test='cpr_code != null and !cpr_code.equals("")'>
and partn_cpr = #{cpr_code}
|
30bbef42
함상기
ai sub Matching 추가
|
57
|
</if>
|
8dc487b1
함상기
Init Version - 20...
|
58
59
60
61
62
|
GROUP BY
sys_se
, accnut_ym
, cpr_code
, partn_cpr
|
8dc487b1
함상기
Init Version - 20...
|
63
64
65
66
67
68
|
) m
GROUP BY
sys_se
, accnut_ym
, cpr_code
, partn_cpr
|
8dc487b1
함상기
Init Version - 20...
|
69
70
71
72
73
74
75
76
77
78
79
80
81
|
HAVING sum(cnt) > 1
</select>
<!-- 작업키 업데이트 -->
<update id="setDataMakeCompareKy" parameterType="map">
UPDATE public.batch_tbcr_inner_delng
SET
${compareKey} = ${makeCompareKey}
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
and cpr_code = #{cprCode}
and partn_cpr = #{partnCpr}
|
8dc487b1
함상기
Init Version - 20...
|
82
83
84
85
86
87
88
89
90
91
|
<foreach collection="cond" item="item" open="" close="" separator="">
and ${item}
</foreach>
</update>
<!-- 매칭작업할 데이타 가져오기 -->
<select id="getMatchingData" parameterType="map" resultType="map">
SELECT
accnut_ym
, compare_ky
|
30bbef42
함상기
ai sub Matching 추가
|
92
|
, ${currencyField}
|
8dc487b1
함상기
Init Version - 20...
|
93
94
95
96
97
98
99
100
101
|
, ${amtField}
FROM
public.batch_tbcr_inner_delng
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
and compare_ky is not null
and cpr_code = #{cprCode}
and partn_cpr = #{partnCpr}
|
8dc487b1
함상기
Init Version - 20...
|
102
103
104
105
106
|
<foreach collection="cond" item="item" open="" close="" separator="">
and ${item}
</foreach>
group by
accnut_ym,
|
30bbef42
함상기
ai sub Matching 추가
|
107
108
|
compare_ky,
${currencyField}
|
8dc487b1
함상기
Init Version - 20...
|
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
</select>
<!-- 매칭결과 업데이트 -->
<select id="getMatchingResult" parameterType="map" resultType="map">
SELECT
sys_se
, accnut_ym
, sn
, compare_ky
FROM
public.batch_tbcr_inner_delng
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
and compare_ky is not null
and cpr_code = #{cprCode}
and partn_cpr = #{partnCpr}
|
8dc487b1
함상기
Init Version - 20...
|
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
|
<foreach collection="cond" item="item" open="" close="" separator="">
and ${item}
</foreach>
</select>
<update id="setResult" parameterType="map">
<foreach collection="itemList" item="item" separator=";">
UPDATE public.batch_tbcr_inner_delng
SET
mtch_sys = 'AUTO',
${item.matchingType} = #{item.matchingTypeVal},
${item.matchingTypeName} = #{item.matchingTypeNameVal},
${item.matchingNumber} = #{item.matchingNumberVal}
WHERE
sys_se = #{item.sys_se}
and accnut_ym = #{item.accnut_ym}
and sn = #{item.sn}
</foreach>
</update>
<update id="deleteOriginalData" parameterType="map">
DELETE FROM tbcr_transaction_history
WHERE
cons_group = #{sysSe}
and account_period = #{accnutYm}
</update>
<update id="insertOriginalData" parameterType="map">
INSERT INTO tbcr_transaction_history (
session_id,
cons_group,
ledger,
account_period,
seq,
tran_type,
own_comp,
|
a99930a8
함상기
2024.04.18
|
170
|
own_comp_name,
|
8dc487b1
함상기
Init Version - 20...
|
171
|
tran_comp,
|
a99930a8
함상기
2024.04.18
|
172
|
tran_comp_name,
|
8dc487b1
함상기
Init Version - 20...
|
173
|
comp_acct_code,
|
a99930a8
함상기
2024.04.18
|
174
|
comp_acct_name,
|
8dc487b1
함상기
Init Version - 20...
|
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
|
comp_prod_code,
recon_key,
tran_date,
tran_currency,
tran_amt,
book_amt,
group_amt,
book_cost,
document_no,
remark,
cons_acct_code,
cons_acct_name,
prod_code,
adjust_type,
adjust_remark,
if_account_period,
if_comp_code,
if_file_id,
if_source,
equal_check,
cons_own_comp,
cons_tran_comp,
invoice_no,
lc_no,
bl_no,
own_biz_no,
partner_biz_no,
acct_date,
matching_cause,
|
50447760
함상기
.
|
204
205
206
|
match_key,
creation_div_code,
cost_mat_key
|
8dc487b1
함상기
Init Version - 20...
|
207
208
209
210
211
212
213
214
215
216
|
) values
<foreach collection="itemList" item="item" separator=",">
(
#{item.SESSION_ID},
#{item.CONS_GROUP},
#{item.LEDGER},
#{item.ACCOUNT_PERIOD},
#{item.SEQ},
#{item.TRAN_TYPE},
#{item.OWN_COMP},
|
a99930a8
함상기
2024.04.18
|
217
|
#{item.OWN_COMP_NAME},
|
8dc487b1
함상기
Init Version - 20...
|
218
|
#{item.TRAN_COMP},
|
a99930a8
함상기
2024.04.18
|
219
|
#{item.TRAN_COMP_NAME},
|
8dc487b1
함상기
Init Version - 20...
|
220
|
#{item.COMP_ACCT_CODE},
|
a99930a8
함상기
2024.04.18
|
221
|
#{item.COMP_ACCT_NAME},
|
8dc487b1
함상기
Init Version - 20...
|
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
|
#{item.COMP_PROD_CODE},
#{item.RECON_KEY},
#{item.TRAN_DATE},
#{item.TRAN_CURRENCY},
#{item.TRAN_AMT},
#{item.BOOK_AMT},
#{item.GROUP_AMT},
#{item.BOOK_COST},
#{item.DOCUMENT_NO},
#{item.REMARK},
#{item.CONS_ACCT_CODE},
#{item.CONS_ACCT_NAME},
#{item.PROD_CODE},
#{item.ADJUST_TYPE},
#{item.ADJUST_REMARK},
#{item.IF_ACCOUNT_PERIOD},
#{item.IF_COMP_CODE},
#{item.IF_FILE_ID},
#{item.IF_SOURCE},
#{item.EQUAL_CHECK},
#{item.CONS_OWN_COMP},
#{item.CONS_TRAN_COMP},
#{item.INVOICE_NO},
#{item.LC_NO},
#{item.BL_NO},
#{item.OWN_BIZ_NO},
#{item.PARTNER_BIZ_NO},
#{item.ACCT_DATE},
#{item.MATCHING_CAUSE},
|
50447760
함상기
.
|
251
252
253
|
#{item.MATCH_KEY},
#{item.CREATION_DIV_CODE},
#{item.COST_MAT_KEY}
|
8dc487b1
함상기
Init Version - 20...
|
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
|
)
</foreach>
</update>
<update id="deleteData" parameterType="map">
DELETE FROM batch_tbcr_inner_delng
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
</update>
<update id="insertDataFromOriginal" parameterType="map">
INSERT INTO
batch_tbcr_inner_delng
(
sys_se
, accnut_ym
, sn
, dta_ty
, cpr_code
|
76e09ec5
함상기
2024.04.18 수정분
|
274
|
, cpr_nm
|
8dc487b1
함상기
Init Version - 20...
|
275
|
, partn_cpr
|
76e09ec5
함상기
2024.04.18 수정분
|
276
|
, partn_cpr_nm
|
8dc487b1
함상기
Init Version - 20...
|
277
|
, cpr_acnt_code
|
76e09ec5
함상기
2024.04.18 수정분
|
278
|
, cpr_acnt_nm
|
8dc487b1
함상기
Init Version - 20...
|
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
|
, cnnc_acnt_code
, cnnc_acnt_nm
, delng_de
, elcty_de
, chit_no
, cmpnsp_ky
, ext_key1
, ext_key2
, ext_key3
, ext_key4
, ext_key5
, delng_crncy
, delng_amt
, acntbk_amt
, group_amt
, suply_amount
, sumry
, org_mtch_ty
, org_mtch_ky
, new_mtch_ty
, new_mtch_ky
, compare_ky
, mtch_ty
, mtch_ty_nm
, mtch_ky
)
SELECT
cons_group
, account_period
, seq
, tran_type
, own_comp
|
76e09ec5
함상기
2024.04.18 수정분
|
311
|
, own_comp_name
|
8dc487b1
함상기
Init Version - 20...
|
312
|
, tran_comp
|
76e09ec5
함상기
2024.04.18 수정분
|
313
|
, tran_comp_name
|
8dc487b1
함상기
Init Version - 20...
|
314
|
, comp_acct_code
|
76e09ec5
함상기
2024.04.18 수정분
|
315
|
, comp_acct_name
|
8dc487b1
함상기
Init Version - 20...
|
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
|
, cons_acct_code
, cons_acct_name
, tran_date
, acct_date
, document_no
, recon_key
, null
, invoice_no
, lc_no
, bl_no
, null
, tran_currency
, tran_amt
, book_amt
, group_amt
, book_cost
, remark
, matching_cause
, match_key
, null
, null
, null
, null
, null
, null
FROM
tbcr_transaction_history
WHERE
cons_group = #{sysSe}
and account_period = #{accnutYm}
|
f97db154
함상기
.
|
346
347
348
|
<foreach collection="conds" item="item" open="" close="" separator="">
and ${item}
</foreach>
|
8dc487b1
함상기
Init Version - 20...
|
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
|
</update>
<update id="deleteDataAi" parameterType="map">
DELETE FROM batch_tbcr_inner_delng_ai
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
</update>
<update id="insertDataAiFromOriginal" parameterType="map">
INSERT INTO
batch_tbcr_inner_delng_ai
(
sys_se
, accnut_ym
, sn
, ai_key1
, ai_key2
, ai_key3
, ai_key4
, ai_key5
, ai_key6
, ai_key7
, ai_key8
, ai_key9
, ai_key10
)
SELECT
cons_group
, account_period
, seq
, regexp_replace(document_no, '[^0-9a-zA-Z]', '',1,0) as ai_key1
, regexp_replace(recon_key, '[^0-9a-zA-Z]', '',1,0) as ai_key2
, '' as ai_key3
, '' as ai_key4
, '' as ai_key5
, '' as ai_key6
, '' as ai_key7
, '' as ai_key8
, '' as ai_key9
, '' as ai_key10
FROM
tbcr_transaction_history
WHERE
cons_group = #{sysSe}
and account_period = #{accnutYm}
|
8dc487b1
함상기
Init Version - 20...
|
396
|
</update>
|
78928007
함상기
20240305
|
397
398
399
400
401
402
403
404
405
406
|
<update id="updateClearNewMatchKey" parameterType="map">
update batch_tbcr_inner_delng
set
new_mtch_ty = null,
new_mtch_ky = null
where
sys_se = #{sysSe}
AND accnut_ym = #{accnutYm}
</update>
|
8dc487b1
함상기
Init Version - 20...
|
407
408
409
410
411
412
413
414
415
416
417
418
419
|
<update id="updateNewMatchKey" parameterType="map">
merge into batch_tbcr_inner_delng m
using
(
select
sys_se,
accnut_ym,
sn,
org_mtch_ty,
org_mtch_ky,
mtch_ty as new_mtch_ty,
mtch_ky,
|
dcdf9dd3
함상기
.
|
420
421
422
423
424
425
|
DENSE_RANK() over (order by
mtch_ty
, mtch_ky
, case when dta_ty in ('11','21','31','33','35','37','41') then cpr_code else partn_cpr end
, case when dta_ty in ('11','21','31','33','35','37','41') then partn_cpr else cpr_code end
) AS new_mtch_ky
|
8dc487b1
함상기
Init Version - 20...
|
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
|
from batch_tbcr_inner_delng
where
sys_se = #{sysSe}
AND accnut_ym = #{accnutYm}
AND mtch_ty is not null
) t
on
m.sys_se = t.sys_se
and m.accnut_ym = t.accnut_ym
and m.sn = t.sn
when matched then
update set
new_mtch_ty = t.new_mtch_ty,
new_mtch_ky = t.new_mtch_ky
</update>
<!-- 매칭작업할 데이타 가져오기 -->
<select id="getMatchingExtraDataOne" parameterType="map" resultType="map">
SELECT
sys_se
, accnut_ym
, sn
, '' as compare_ky
, delng_de
|
8dc487b1
함상기
Init Version - 20...
|
452
453
454
455
456
457
458
459
|
, delng_amt
FROM
public.batch_tbcr_inner_delng
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
and cpr_code = #{cprCode}
and partn_cpr = #{partnCpr}
|
8dc487b1
함상기
Init Version - 20...
|
460
|
and mtch_ky is null
|
78928007
함상기
20240305
|
461
462
463
464
465
466
|
<if test='conds eq "T".toString()'>
and dta_ty in ('11','21','41')
</if>
<if test='conds eq "B".toString()'>
and dta_ty in ('31','33','35','37')
</if>
|
8dc487b1
함상기
Init Version - 20...
|
467
468
|
and delng_amt != 0
ORDER BY
|
d3e8a8a9
함상기
2024-04-01
|
469
|
delng_de
|
8dc487b1
함상기
Init Version - 20...
|
470
471
472
473
474
475
476
477
478
479
|
</select>
<!-- 매칭작업할 데이타 가져오기 -->
<select id="getMatchingExtraDataTwo" parameterType="map" resultType="map">
SELECT
sys_se
, accnut_ym
, sn
, '' as compare_ky
, delng_de
|
8dc487b1
함상기
Init Version - 20...
|
480
481
482
483
484
485
486
487
|
, delng_amt
FROM
public.batch_tbcr_inner_delng
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
and cpr_code = #{cprCode}
and partn_cpr = #{partnCpr}
|
8dc487b1
함상기
Init Version - 20...
|
488
|
and mtch_ky is null
|
78928007
함상기
20240305
|
489
490
491
492
493
494
|
<if test='conds eq "T".toString()'>
and dta_ty in ('12','22','42')
</if>
<if test='conds eq "B".toString()'>
and dta_ty in ('32','34','36','38')
</if>
|
8dc487b1
함상기
Init Version - 20...
|
495
496
|
and delng_amt != 0
ORDER BY
|
d3e8a8a9
함상기
2024-04-01
|
497
|
delng_de
|
8dc487b1
함상기
Init Version - 20...
|
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
|
</select>
<update id="setExtraResult" parameterType="map">
<foreach collection="itemList" item="item" separator=";">
UPDATE public.batch_tbcr_inner_delng
SET
mtch_sys = #{item.mtch_sys},
mtch_ty = #{item.mtch_ty},
mtch_ty_nm = #{item.mtch_ty_nm},
mtch_ky = #{item.mtch_ky}
WHERE
sys_se = #{item.sys_se}
and accnut_ym = #{item.accnut_ym}
and sn = #{item.sn}
</foreach>
</update>
<update id="createUserJob" parameterType="map">
INSERT INTO public.batch_user_job_status (
|
78928007
함상기
20240305
|
517
|
user_job_group,
|
8dc487b1
함상기
Init Version - 20...
|
518
519
520
521
522
|
user_job_id,
user_job_name,
start_time,
status
) VALUES (
|
78928007
함상기
20240305
|
523
|
#{user_job_group},
|
8dc487b1
함상기
Init Version - 20...
|
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
|
#{user_job_id},
#{user_job_name},
now(),
'Started'
)
</update>
<update id="finishUserJob" parameterType="map">
UPDATE public.batch_user_job_status
SET
end_time = now(),
status = 'Finished',
exit_code = #{exit_code},
exit_message = #{exit_message}
WHERE
user_job_id = #{user_job_id}
</update>
<!-- AI 작업리스트 -->
<select id="getAiReadData" parameterType="map" resultType="map">
|
d3e8a8a9
함상기
2024-04-01
|
544
545
546
547
548
|
SELECT
sys_se
, accnut_ym
, cpr_code
, partn_cpr
|
f97db154
함상기
.
|
549
|
, tb_ty
|
d3e8a8a9
함상기
2024-04-01
|
550
551
552
|
, delng_crncy
FROM
(
|
a45ecedc
ggun12
* EX 매칭은 순차 실행으로 처리
|
553
554
555
556
557
558
|
SELECT
sys_se
, accnut_ym
, cpr_code
, partn_cpr
, delng_crncy
|
f97db154
함상기
.
|
559
|
, case when dta_ty in ('11','21','41') then 'T' else 'B' end tb_ty
|
d3e8a8a9
함상기
2024-04-01
|
560
|
, case when count(*) > 0 then 1 else 0 end as cnt
|
a45ecedc
ggun12
* EX 매칭은 순차 실행으로 처리
|
561
562
563
564
565
566
|
FROM
public.batch_tbcr_inner_delng
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
and mtch_ty is null
|
d3e8a8a9
함상기
2024-04-01
|
567
|
and dta_ty in ('11','21','31','33','35','37','41')
|
30bbef42
함상기
ai sub Matching 추가
|
568
569
570
571
572
573
|
<if test='cpr_code != null and !cpr_code.equals("")'>
and cpr_code = #{cpr_code}
</if>
<if test='partn_cpr != null and !partn_cpr.equals("")'>
and partn_cpr = #{partn_cpr}
</if>
|
a45ecedc
ggun12
* EX 매칭은 순차 실행으로 처리
|
574
575
576
577
578
579
|
GROUP BY
sys_se
, accnut_ym
, cpr_code
, partn_cpr
, delng_crncy
|
f97db154
함상기
.
|
580
|
, case when dta_ty in ('11','21','41') then 'T' else 'B' end
|
a45ecedc
ggun12
* EX 매칭은 순차 실행으로 처리
|
581
582
583
584
585
586
587
|
union all
SELECT
sys_se
, accnut_ym
, partn_cpr as cpr_code
, cpr_code as partn_cpr
, delng_crncy
|
f97db154
함상기
.
|
588
|
, case when dta_ty in ('12','22','42') then 'T' else 'B' end as tb_ty
|
d3e8a8a9
함상기
2024-04-01
|
589
|
, case when count(*) > 0 then 1 else 0 end as cnt
|
a45ecedc
ggun12
* EX 매칭은 순차 실행으로 처리
|
590
591
592
593
594
595
|
FROM
public.batch_tbcr_inner_delng
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
and mtch_ty is null
|
d3e8a8a9
함상기
2024-04-01
|
596
|
and dta_ty in ('12','22','32','34','36','38','42')
|
30bbef42
함상기
ai sub Matching 추가
|
597
|
<if test='partn_cpr != null and !partn_cpr.equals("")'>
|
415842d2
함상기
20240408
|
598
599
600
601
|
and cpr_code = #{partn_cpr}
</if>
<if test='cpr_code != null and !cpr_code.equals("")'>
and partn_cpr = #{cpr_code}
|
30bbef42
함상기
ai sub Matching 추가
|
602
|
</if>
|
a45ecedc
ggun12
* EX 매칭은 순차 실행으로 처리
|
603
604
605
|
GROUP BY
sys_se
, accnut_ym
|
a45ecedc
ggun12
* EX 매칭은 순차 실행으로 처리
|
606
|
, cpr_code
|
d3e8a8a9
함상기
2024-04-01
|
607
|
, partn_cpr
|
a45ecedc
ggun12
* EX 매칭은 순차 실행으로 처리
|
608
|
, delng_crncy
|
f97db154
함상기
.
|
609
|
, case when dta_ty in ('12','22','42') then 'T' else 'B' end
|
d3e8a8a9
함상기
2024-04-01
|
610
|
) m
|
a45ecedc
ggun12
* EX 매칭은 순차 실행으로 처리
|
611
612
613
614
615
616
|
GROUP BY
sys_se
, accnut_ym
, cpr_code
, partn_cpr
, delng_crncy
|
4aa0b12d
함상기
.
|
617
|
, tb_ty
|
d3e8a8a9
함상기
2024-04-01
|
618
|
HAVING sum(cnt) > 1
|
78928007
함상기
20240305
|
619
620
621
622
623
624
625
626
627
628
629
630
631
|
</select>
<!-- User Job Status -->
<select id="getUserJobStatus" parameterType="map" resultType="map">
SELECT
user_job_id
, user_job_name
, start_time
, end_time
, status
, exit_code
, exit_message
, user_job_group
|
78928007
함상기
20240305
|
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
|
FROM
public.batch_user_job_status
WHERE
user_job_group = #{userJobGroup}
ORDER BY
user_job_id ASC
</select>
<!-- ReturnData Select -->
<select id="getReturnData" parameterType="map" resultType="map">
SELECT
sys_se
, accnut_ym
, sn
, dta_ty
, cpr_code
, partn_cpr
, cpr_acnt_code
, cnnc_acnt_code
, cnnc_acnt_nm
, delng_de
, elcty_de
, chit_no
, cmpnsp_ky
, ext_key1
, ext_key2
, ext_key3
, ext_key4
, ext_key5
, delng_crncy
, delng_amt
, acntbk_amt
, group_amt
, suply_amount
, sumry
, org_mtch_ty
, org_mtch_ky
, new_mtch_ty
, new_mtch_ky
, compare_ky
, mtch_sys
, mtch_ty
, mtch_ty_nm
, mtch_ky
FROM
batch_tbcr_inner_delng
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
</select>
|
30bbef42
함상기
ai sub Matching 추가
|
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
|
<!-- 작업리스트 -->
<select id="getAiSubReadData" parameterType="map" resultType="map">
SELECT
sys_se
, accnut_ym
, cpr_code
, partn_cpr
, mtch_ty
, mtch_ky
FROM
(
SELECT
sys_se
, accnut_ym
, cpr_code
, partn_cpr
, mtch_ty
, mtch_ky
, case when count(*) > 0 then 1 else 0 end as cnt
FROM
public.batch_tbcr_inner_delng
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
and mtch_ty = #{mtch_ty}
and dta_ty in ('11','21','31','33','35','37','41')
<if test='cpr_code != null and !cpr_code.equals("")'>
and cpr_code = #{cpr_code}
</if>
<if test='partn_cpr != null and !partn_cpr.equals("")'>
and partn_cpr = #{partn_cpr}
</if>
GROUP BY
sys_se
, accnut_ym
, cpr_code
, partn_cpr
, mtch_ty
, mtch_ky
union all
SELECT
sys_se
, accnut_ym
, partn_cpr as cpr_code
, cpr_code as partn_cpr
, mtch_ty
, mtch_ky
, case when count(*) > 0 then 1 else 0 end as cnt
FROM
public.batch_tbcr_inner_delng
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
and mtch_ty = #{mtch_ty}
and dta_ty in ('12','22','32','34','36','38','42')
|
30bbef42
함상기
ai sub Matching 추가
|
738
|
<if test='partn_cpr != null and !partn_cpr.equals("")'>
|
415842d2
함상기
20240408
|
739
740
741
742
|
and cpr_code = #{partn_cpr}
</if>
<if test='cpr_code != null and !cpr_code.equals("")'>
and partn_cpr = #{cpr_code}
|
30bbef42
함상기
ai sub Matching 추가
|
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
|
</if>
GROUP BY
sys_se
, accnut_ym
, cpr_code
, partn_cpr
, mtch_ty
, mtch_ky
) m
GROUP BY
sys_se
, accnut_ym
, cpr_code
, partn_cpr
, mtch_ty
, mtch_ky
HAVING sum(cnt) > 1
</select>
<!-- 매칭작업할 데이타 가져오기 -->
<select id="getAiSubDataOne" parameterType="map" resultType="map">
SELECT
sys_se
, accnut_ym
, sn
, '' as compare_ky
, delng_de
, delng_amt
FROM
public.batch_tbcr_inner_delng
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
and cpr_code = #{cprCode}
and partn_cpr = #{partnCpr}
and mtch_ty = #{mtchTy}
and mtch_ky = #{mtchKy}
<if test='conds eq "T".toString()'>
and dta_ty in ('11','21','41')
</if>
<if test='conds eq "B".toString()'>
and dta_ty in ('31','33','35','37')
</if>
and delng_amt != 0
ORDER BY
delng_de
</select>
<!-- 매칭작업할 데이타 가져오기 -->
<select id="getAiSubDataTwo" parameterType="map" resultType="map">
SELECT
sys_se
, accnut_ym
, sn
, '' as compare_ky
, delng_de
, delng_amt
FROM
public.batch_tbcr_inner_delng
WHERE
sys_se = #{sysSe}
and accnut_ym = #{accnutYm}
and cpr_code = #{cprCode}
and partn_cpr = #{partnCpr}
and mtch_ty = #{mtchTy}
and mtch_ky = #{mtchKy}
<if test='conds eq "T".toString()'>
and dta_ty in ('12','22','42')
</if>
<if test='conds eq "B".toString()'>
and dta_ty in ('32','34','36','38')
</if>
and delng_amt != 0
ORDER BY
delng_de
</select>
|
8dc487b1
함상기
Init Version - 20...
|
821
|
</mapper>
|