From 0b21254640e3b08211cd1643d82f2f2a02d964ff Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Fri, 5 Jan 2024 14:09:10 +0900 Subject: [PATCH] =?UTF-8?q?=EC=98=A4=EB=9D=BC=ED=81=B4=20SQL=20=EC=A7=80?= =?UTF-8?q?=EC=9B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 9 ++ .../basic/a/service/bean/LntrisA02Bean.java | 1 + .../basic/a/service/bean/LntrisA03Bean.java | 7 +- .../lntris/basic/d/dao/LntrisD07Mapper.java | 5 ++ .../lntris/basic/d/dao/LntrisDMapper.java | 4 + .../basic/d/service/bean/LntrisD04Bean.java | 2 - src/main/resources/intf-conf/lntris.conf | 3 +- .../sql/mapper/lntris/lntris-A-mapper.xml | 13 ++- .../sql/mapper/lntris/lntris-D-mapper.xml | 87 +++++++++++-------- .../basic/a/service/LntrisDServiceTest.java | 15 +++- src/test/resources/logback.xml | 14 +-- src/test/resources/spring/context-common.xml | 10 --- .../resources/spring/context-datasource.xml | 8 +- 13 files changed, 113 insertions(+), 65 deletions(-) diff --git a/pom.xml b/pom.xml index 9f7e4ab..84ae60f 100644 --- a/pom.xml +++ b/pom.xml @@ -52,6 +52,15 @@ xit-lntris 23.04.01-SNAPSHOT + diff --git a/src/main/java/cokr/xit/interfaces/lntris/basic/a/service/bean/LntrisA02Bean.java b/src/main/java/cokr/xit/interfaces/lntris/basic/a/service/bean/LntrisA02Bean.java index 5b60939..73c2424 100644 --- a/src/main/java/cokr/xit/interfaces/lntris/basic/a/service/bean/LntrisA02Bean.java +++ b/src/main/java/cokr/xit/interfaces/lntris/basic/a/service/bean/LntrisA02Bean.java @@ -41,6 +41,7 @@ public class LntrisA02Bean extends InterfaceInfoReader { */ public List getA02List(int pageNum, int fetchSize) { DataObject params = new DataObject() + .set("orderBy", "A02_ID") .set("pageNum", pageNum) .set("fetchSize", fetchSize); return lntrisAMapper.selectA02List(params); diff --git a/src/main/java/cokr/xit/interfaces/lntris/basic/a/service/bean/LntrisA03Bean.java b/src/main/java/cokr/xit/interfaces/lntris/basic/a/service/bean/LntrisA03Bean.java index aacf21e..cf45f85 100644 --- a/src/main/java/cokr/xit/interfaces/lntris/basic/a/service/bean/LntrisA03Bean.java +++ b/src/main/java/cokr/xit/interfaces/lntris/basic/a/service/bean/LntrisA03Bean.java @@ -50,7 +50,12 @@ public class LntrisA03Bean extends ScheduledBean { * @return 업무적용 대상인 과태료 대장 상세 조회 결과 목록 */ public List getA03List(int pageNum, int fetchSize) { - return lntrisAMapper.selectA03List(new DataObject().set("pageNum", pageNum).set("fetchSize", fetchSize)); + return lntrisAMapper.selectA03List( + new DataObject() + .set("orderBy", "A03_ID") + .set("pageNum", pageNum) + .set("fetchSize", fetchSize) + ); } public List getA03s() { diff --git a/src/main/java/cokr/xit/interfaces/lntris/basic/d/dao/LntrisD07Mapper.java b/src/main/java/cokr/xit/interfaces/lntris/basic/d/dao/LntrisD07Mapper.java index e7c0266..7007991 100644 --- a/src/main/java/cokr/xit/interfaces/lntris/basic/d/dao/LntrisD07Mapper.java +++ b/src/main/java/cokr/xit/interfaces/lntris/basic/d/dao/LntrisD07Mapper.java @@ -40,6 +40,7 @@ public interface LntrisD07Mapper extends AbstractMapper { .set("sgbCd", sgbCd) .set("dptCd", dptCd) .set("rprsTxmCd", rprsTxmCd) + .set("orderBy", "D07A_ID") .set("pageNum", pageNum) .set("fetchSize", fetchSize) ); @@ -114,6 +115,7 @@ public interface LntrisD07Mapper extends AbstractMapper { .set("sgbCd", sgbCd) .set("dptCd", dptCd) .set("rprsTxmCd", rprsTxmCd) + .set("orderBy", "D07B_ID") .set("pageNum", pageNum) .set("fetchSize", fetchSize) ); @@ -188,6 +190,7 @@ public interface LntrisD07Mapper extends AbstractMapper { .set("sgbCd", sgbCd) .set("dptCd", dptCd) .set("rprsTxmCd", rprsTxmCd) + .set("orderBy", "D07C_ID") .set("pageNum", pageNum) .set("fetchSize", fetchSize) ); @@ -262,6 +265,7 @@ public interface LntrisD07Mapper extends AbstractMapper { .set("sgbCd", sgbCd) .set("dptCd", dptCd) .set("rprsTxmCd", rprsTxmCd) + .set("orderBy", "D07D_ID") .set("pageNum", pageNum) .set("fetchSize", fetchSize) ); @@ -336,6 +340,7 @@ public interface LntrisD07Mapper extends AbstractMapper { .set("sgbCd", sgbCd) .set("dptCd", dptCd) .set("rprsTxmCd", rprsTxmCd) + .set("orderBy", "D07E_ID") .set("pageNum", pageNum) .set("fetchSize", fetchSize) ); diff --git a/src/main/java/cokr/xit/interfaces/lntris/basic/d/dao/LntrisDMapper.java b/src/main/java/cokr/xit/interfaces/lntris/basic/d/dao/LntrisDMapper.java index cff4f3d..e7d8941 100644 --- a/src/main/java/cokr/xit/interfaces/lntris/basic/d/dao/LntrisDMapper.java +++ b/src/main/java/cokr/xit/interfaces/lntris/basic/d/dao/LntrisDMapper.java @@ -138,6 +138,7 @@ public interface LntrisDMapper extends AbstractMapper { */ default List selectD03List(int pageNum, int fetchSize) { return selectD03List(params() + .set("orderBy", "D03_ID") .set("pageNum", pageNum) .set("fetchSize", fetchSize) ); @@ -207,6 +208,7 @@ public interface LntrisDMapper extends AbstractMapper { */ default List selectD04List(int pageNum, int fetchSize) { return selectD04List(params() + .set("orderBy", "D04_ID") .set("pageNum", pageNum) .set("fetchSize", fetchSize) ); @@ -276,6 +278,7 @@ public interface LntrisDMapper extends AbstractMapper { */ default List selectD05List(int pageNum, int fetchSize) { return selectD05List(params() + .set("orderBy", "D05_ID") .set("pageNum", pageNum) .set("fetchSize", fetchSize) ); @@ -345,6 +348,7 @@ public interface LntrisDMapper extends AbstractMapper { */ default List selectD06List(int pageNum, int fetchSize) { return selectD06List(params() + .set("orderBy", "D06_ID") .set("pageNum", pageNum) .set("fetchSize", fetchSize) ); diff --git a/src/main/java/cokr/xit/interfaces/lntris/basic/d/service/bean/LntrisD04Bean.java b/src/main/java/cokr/xit/interfaces/lntris/basic/d/service/bean/LntrisD04Bean.java index b380ac0..3b3d495 100644 --- a/src/main/java/cokr/xit/interfaces/lntris/basic/d/service/bean/LntrisD04Bean.java +++ b/src/main/java/cokr/xit/interfaces/lntris/basic/d/service/bean/LntrisD04Bean.java @@ -1,7 +1,5 @@ package cokr.xit.interfaces.lntris.basic.d.service.bean; -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.log; - import java.util.List; import javax.annotation.Resource; diff --git a/src/main/resources/intf-conf/lntris.conf b/src/main/resources/intf-conf/lntris.conf index b5a116f..07de191 100644 --- a/src/main/resources/intf-conf/lntris.conf +++ b/src/main/resources/intf-conf/lntris.conf @@ -1,5 +1,6 @@ { - "useDatabase": false, + "useDatabase": true, + "sendRequest": false, "locals": [ {"organization": "4060000",/* 지역 자치단체 코드(7자리) */ diff --git a/src/main/resources/sql/mapper/lntris/lntris-A-mapper.xml b/src/main/resources/sql/mapper/lntris/lntris-A-mapper.xml index 9a67941..cb91380 100644 --- a/src/main/resources/sql/mapper/lntris/lntris-A-mapper.xml +++ b/src/main/resources/sql/mapper/lntris/lntris-A-mapper.xml @@ -399,7 +399,7 @@ INSERT INTO TB_NIS_INDIV_A01 ( ) /* 과태료 대장 단속 정보 연계상태 수정(lntrisAMapper.updateA01Status) */ -UPDATE TB_NIS_INDIV_A01 A +UPDATE TB_NIS_INDIV_A01 A , ( SELECT #{a01.a01Id} A01_ID, #{a01.response.resVo1.linkMngKey} LINK_MNG_KEY, #{a01.response.linkRstCd} LINK_RST_CD, #{a01.response.linkRstMsg} LINK_RST_MSG ) B @@ -407,7 +407,16 @@ UPDATE TB_NIS_INDIV_A01 A , A.LINK_MNG_KEY = B.LINK_MNG_KEY , A.LINK_RST_CD = B.LINK_RST_CD , A.LINK_RST_MSG = B.LINK_RST_MSG - WHERE A.A01_ID = B.A01_ID + WHERE A.A01_ID = B.A01_ID +MERGE INTO TB_NIS_INDIV_A01 A USING + ( + SELECT #{a01.a01Id} A01_ID, #{a01.response.resVo1.linkMngKey} LINK_MNG_KEY, #{a01.response.linkRstCd} LINK_RST_CD, #{a01.response.linkRstMsg} LINK_RST_MSG FROM DUAL + ) B ON (A.A01_ID = B.A01_ID) + WHEN MATCHED THEN UPDATE + SET A.LINK_RST_DT = + , A.LINK_MNG_KEY = B.LINK_MNG_KEY + , A.LINK_RST_CD = B.LINK_RST_CD + , A.LINK_RST_MSG = B.LINK_RST_MSG diff --git a/src/main/resources/sql/mapper/lntris/lntris-D-mapper.xml b/src/main/resources/sql/mapper/lntris/lntris-D-mapper.xml index 532a881..29ab71b 100644 --- a/src/main/resources/sql/mapper/lntris/lntris-D-mapper.xml +++ b/src/main/resources/sql/mapper/lntris/lntris-D-mapper.xml @@ -387,7 +387,7 @@ INSERT INTO TB_NIS_INDIV_D01 ( ) /* 부과정보 연계상태 수정(lntrisDMapper.updateD01) */ -UPDATE TB_NIS_INDIV_D01 A +UPDATE TB_NIS_INDIV_D01 A , ( SELECT #{d01.d01Id} D01_ID, #{d01.response.resVo.linkMngKey} LINK_MNG_KEY, #{d01.response.resVo.linkRstCd} LINK_RST_CD, #{d01.response.resVo.linkRstMsg} LINK_RST_MSG ) B @@ -395,7 +395,16 @@ UPDATE TB_NIS_INDIV_D01 A , A.LINK_MNG_KEY = B.LINK_MNG_KEY , A.LINK_RST_CD = B.LINK_RST_CD , A.LINK_RST_MSG = B.LINK_RST_MSG - WHERE A.D01_ID = B.D01_ID + WHERE A.D01_ID = B.D01_ID +MERGE INTO TB_NIS_INDIV_D01 A USING + ( + SELECT #{d01.d01Id} D01_ID, #{d01.response.resVo.linkMngKey} LINK_MNG_KEY, #{d01.response.resVo.linkRstCd} LINK_RST_CD, #{d01.response.resVo.linkRstMsg} LINK_RST_MSG FROM DUAL + ) B ON (A.D01_ID = B.D01_ID) + WHEN MATCHED THEN UPDATE + SET A.LINK_RST_DT = + , A.LINK_MNG_KEY = B.LINK_MNG_KEY + , A.LINK_RST_CD = B.LINK_RST_CD + , A.LINK_RST_MSG = B.LINK_RST_MSG @@ -801,14 +810,22 @@ INSERT INTO TB_NIS_INDIV_D02 ( ) /* 부과수납 정보 연계상태 수정(lntrisDMapper.updateD02Status) */ -UPDATE TB_NIS_INDIV_D02 A +UPDATE TB_NIS_INDIV_D02 A , ( SELECT #{d02.d02Id} D02_ID, #{d02.response.linkRstCd} LINK_RST_CD, #{d02.response.linkRstMsg} LINK_RST_MSG ) B SET A.LINK_RST_DT = , A.LINK_RST_CD = B.LINK_RST_CD , A.LINK_RST_MSG = B.LINK_RST_MSG - WHERE A.D02_ID = B.D02_ID + WHERE A.D02_ID = B.D02_ID +MERGE INTO TB_NIS_INDIV_D02 A USING + ( + SELECT #{d02.d02Id} D02_ID, #{d02.response.linkRstCd} LINK_RST_CD, #{d02.response.linkRstMsg} LINK_RST_MSG FROM DUAL + ) B ON (A.D02_ID = B.D02_ID) + WHEN MATCHED THEN UPDATE + SET A.LINK_RST_DT = + , A.LINK_RST_CD = B.LINK_RST_CD + , A.LINK_RST_MSG = B.LINK_RST_MSG @@ -957,7 +974,7 @@ UPDATE TB_NIS_INDIV_D02 A WHERE TASK_APLCN_CD = '999' - + /* 부과결과정보 등록(lntrisDMapper.insertD03) */ @@ -1041,7 +1058,7 @@ INSERT INTO TB_NIS_INDIV_D03 ( , #{req.taxnNo} , #{req.untyTaxnNo} , #{req.dptCd} - , #{req.spclFisBizCd} + , #{req.spclFisBizCd} , #{req.fyr} , #{req.actSeCd} , #{req.rprsTxmCd} @@ -1587,35 +1604,35 @@ INSERT INTO TB_NIS_INDIV_D06 ( , MDFR ) VALUES ( #{d06.d06Id} - , #{req.sgbCd} - , #{req.sgbNm} - , #{req.linkMngKey} - , #{req.taxnNo} - , #{req.untyTaxnNo} - , #{req.dptCd} - , #{req.dptNm} - , #{req.spclFisBizCd} - , #{req.spclFisBizNm} - , #{req.fyr} - , #{req.actSeCd} - , #{req.actSeNm} - , #{req.rprsTxmCd} - , #{req.rprsTxmNm} - , #{req.operItemCd} - , #{req.operItemNm} - , #{req.lvyNo} - , #{req.itmNo} - , #{req.rdcYmd} - , #{req.rdcPctAmt} - , #{req.rdcAdtnAmt} - , #{req.rdcIntrAmt} - , #{req.rdcAmt} - , #{req.rdcRsnCn} - , #{req.rsveItem1} - , #{req.rsveItem2} - , #{req.rsveItem3} - , #{req.rsveItem4} - , #{req.rsveItem5} + , #{req.sgbCd} + , #{req.sgbNm} + , #{req.linkMngKey} + , #{req.taxnNo} + , #{req.untyTaxnNo} + , #{req.dptCd} + , #{req.dptNm} + , #{req.spclFisBizCd} + , #{req.spclFisBizNm} + , #{req.fyr} + , #{req.actSeCd} + , #{req.actSeNm} + , #{req.rprsTxmCd} + , #{req.rprsTxmNm} + , #{req.operItemCd} + , #{req.operItemNm} + , #{req.lvyNo} + , #{req.itmNo} + , #{req.rdcYmd} + , #{req.rdcPctAmt} + , #{req.rdcAdtnAmt} + , #{req.rdcIntrAmt} + , #{req.rdcAmt} + , #{req.rdcRsnCn} + , #{req.rsveItem1} + , #{req.rsveItem2} + , #{req.rsveItem3} + , #{req.rsveItem4} + , #{req.rsveItem5} , #{d06.linkRsltDt} , #{d06.response.resVo.linkRstCd} , #{d06.response.resVo.linkRstMsg} diff --git a/src/test/java/cokr/xit/interfaces/lntris/basic/a/service/LntrisDServiceTest.java b/src/test/java/cokr/xit/interfaces/lntris/basic/a/service/LntrisDServiceTest.java index d36a6a7..3ea2b70 100644 --- a/src/test/java/cokr/xit/interfaces/lntris/basic/a/service/LntrisDServiceTest.java +++ b/src/test/java/cokr/xit/interfaces/lntris/basic/a/service/LntrisDServiceTest.java @@ -5,6 +5,7 @@ import java.util.stream.Collectors; import javax.annotation.Resource; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import cokr.xit.foundation.test.TestSupport; @@ -29,6 +30,11 @@ public class LntrisDServiceTest extends TestSupport { @Resource(name = "lntrisDService") private LntrisDService dService; + @Test + void d01() { + dService.registerD01s(); + } + @Test void d02() { dService.registerD02s(); @@ -42,7 +48,8 @@ public class LntrisDServiceTest extends TestSupport { String d07aIds = d07as.stream() .map(d07a -> "'" + d07a.getD07aId() + "'") .collect(Collectors.joining(",")); -// testMapper.execDelete("DELETE FROM TB_NIS_INDIV_D07A WHERE D07A_ID IN (" + d07aIds + ")"); + int affected = testMapper.execDelete("DELETE FROM TB_NIS_INDIV_D07A WHERE D07A_ID IN (" + d07aIds + ")"); + Assertions.assertEquals(affected, d07as.size()); } @Test @@ -75,7 +82,8 @@ public class LntrisDServiceTest extends TestSupport { String d07dIds = d07ds.stream() .map(d07d -> "'" + d07d.getD07dId() + "'") .collect(Collectors.joining(",")); -// testMapper.execDelete("DELETE FROM TB_NIS_INDIV_D07D WHERE D07D_ID IN (" + d07dIds + ")"); + int affected = testMapper.execDelete("DELETE FROM TB_NIS_INDIV_D07D WHERE D07D_ID IN (" + d07dIds + ")"); + Assertions.assertEquals(affected, d07ds.size()); } @Test @@ -86,6 +94,7 @@ public class LntrisDServiceTest extends TestSupport { String d07eIds = d07es.stream() .map(d07e -> "'" + d07e.getD07eId() + "'") .collect(Collectors.joining(",")); -// testMapper.execDelete("DELETE FROM TB_NIS_INDIV_D07E WHERE D07E_ID IN (" + d07eIds + ")"); + int affected = testMapper.execDelete("DELETE FROM TB_NIS_INDIV_D07E WHERE D07E_ID IN (" + d07eIds + ")"); + Assertions.assertEquals(affected, d07es.size()); } } \ No newline at end of file diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml index 7e0e947..52b92cb 100644 --- a/src/test/resources/logback.xml +++ b/src/test/resources/logback.xml @@ -62,14 +62,14 @@ - - - - - - - + + + + + + + diff --git a/src/test/resources/spring/context-common.xml b/src/test/resources/spring/context-common.xml index b8c88b0..6f710d8 100644 --- a/src/test/resources/spring/context-common.xml +++ b/src/test/resources/spring/context-common.xml @@ -51,16 +51,6 @@ - - - - - - - - - - diff --git a/src/test/resources/spring/context-datasource.xml b/src/test/resources/spring/context-datasource.xml index 726cf5f..66c3653 100644 --- a/src/test/resources/spring/context-datasource.xml +++ b/src/test/resources/spring/context-datasource.xml @@ -10,13 +10,13 @@ + + + +