MatchingInnerDelingMapper.xml
19.3 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
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
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
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
738
739
740
741
742
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
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
<?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
<if test='asCurrency eq "Y".toString()'>
, delng_crncy
</if>
FROM
(
SELECT
sys_se
, accnut_ym
, cpr_code
, partn_cpr
<if test='asCurrency eq "Y".toString()'>
, delng_crncy
</if>
, 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')
<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
<if test='asCurrency eq "Y".toString()'>
, delng_crncy
</if>
union all
SELECT
sys_se
, accnut_ym
, partn_cpr as cpr_code
, cpr_code as partn_cpr
<if test='asCurrency eq "Y".toString()'>
, delng_crncy
</if>
, 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')
<if test='partn_cpr != null and !partn_cpr.equals("")'>
and cpr_code = #{partn_cpr}
</if>
<if test='cpr_code != null and !cpr_code.equals("")'>
and partn_cpr = #{cpr_code}
</if>
GROUP BY
sys_se
, accnut_ym
, cpr_code
, partn_cpr
<if test='asCurrency eq "Y".toString()'>
, delng_crncy
</if>
) m
GROUP BY
sys_se
, accnut_ym
, cpr_code
, partn_cpr
<if test='asCurrency eq "Y".toString()'>
, delng_crncy
</if>
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}
<foreach collection="cond" item="item" open="" close="" separator="">
and ${item}
</foreach>
</update>
<!-- 매칭작업할 데이타 가져오기 -->
<select id="getMatchingData" parameterType="map" resultType="map">
SELECT
accnut_ym
, compare_ky
, ${currencyField}
, ${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}
<foreach collection="cond" item="item" open="" close="" separator="">
and ${item}
</foreach>
group by
accnut_ym,
compare_ky,
${currencyField}
</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}
<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,
own_comp_name,
tran_comp,
tran_comp_name,
comp_acct_code,
comp_acct_name,
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,
match_key,
creation_div_code,
cost_mat_key
) 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},
#{item.OWN_COMP_NAME},
#{item.TRAN_COMP},
#{item.TRAN_COMP_NAME},
#{item.COMP_ACCT_CODE},
#{item.COMP_ACCT_NAME},
#{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},
#{item.MATCH_KEY},
#{item.CREATION_DIV_CODE},
#{item.COST_MAT_KEY}
)
</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
, cpr_nm
, partn_cpr
, partn_cpr_nm
, cpr_acnt_code
, cpr_acnt_nm
, 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
, own_comp_name
, tran_comp
, tran_comp_name
, comp_acct_code
, comp_acct_name
, 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}
<foreach collection="conds" item="item" open="" close="" separator="">
and ${item}
</foreach>
</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}
</update>
<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>
<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,
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
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
, 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 delng_crncy = #{delngCurncy}
and mtch_ky is null
<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="getMatchingExtraDataTwo" 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 delng_crncy = #{delngCurncy}
and mtch_ky is null
<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>
<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 (
user_job_group,
user_job_id,
user_job_name,
start_time,
status
) VALUES (
#{user_job_group},
#{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">
SELECT
sys_se
, accnut_ym
, cpr_code
, partn_cpr
, tb_ty
, delng_crncy
, sum(cnt) as cnt
, max(cnt_all) as cnt_all
FROM
(
SELECT
sys_se
, accnut_ym
, cpr_code
, partn_cpr
, delng_crncy
, case when dta_ty in ('11','21','41') then 'T' else 'B' end tb_ty
, case when count(*) > 0 then 1 else 0 end as cnt
, count(*) as cnt_all
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')
<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
, delng_crncy
, case when dta_ty in ('11','21','41') then 'T' else 'B' end
union all
SELECT
sys_se
, accnut_ym
, partn_cpr as cpr_code
, cpr_code as partn_cpr
, delng_crncy
, case when dta_ty in ('12','22','42') then 'T' else 'B' end as tb_ty
, case when count(*) > 0 then 1 else 0 end as cnt
, count(*) as cnt_all
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')
<if test='partn_cpr != null and !partn_cpr.equals("")'>
and cpr_code = #{partn_cpr}
</if>
<if test='cpr_code != null and !cpr_code.equals("")'>
and partn_cpr = #{cpr_code}
</if>
GROUP BY
sys_se
, accnut_ym
, cpr_code
, partn_cpr
, delng_crncy
, case when dta_ty in ('12','22','42') then 'T' else 'B' end
) m
GROUP BY
sys_se
, accnut_ym
, cpr_code
, partn_cpr
, delng_crncy
, tb_ty
HAVING sum(cnt) > 1
ORDER BY cnt_all
</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
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>
<!-- 작업리스트 -->
<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')
<if test='partn_cpr != null and !partn_cpr.equals("")'>
and cpr_code = #{partn_cpr}
</if>
<if test='cpr_code != null and !cpr_code.equals("")'>
and partn_cpr = #{cpr_code}
</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>
</mapper>