From 08b5d7f7b614e09ea1791f902b7d61817aa05c16 Mon Sep 17 00:00:00 2001 From: leebj Date: Mon, 30 Sep 2024 10:55:40 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B3=B5=EC=A7=80=EC=82=AC=ED=95=AD=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/fims/mngt/web/Mngt01Controller.java | 72 +++++++++++++++++-- .../sql/mapper/base/sigungu-mapper.xml | 44 ++++++++---- 2 files changed, 99 insertions(+), 17 deletions(-) diff --git a/src/main/java/cokr/xit/fims/mngt/web/Mngt01Controller.java b/src/main/java/cokr/xit/fims/mngt/web/Mngt01Controller.java index 2a6a58c8..98d904f2 100644 --- a/src/main/java/cokr/xit/fims/mngt/web/Mngt01Controller.java +++ b/src/main/java/cokr/xit/fims/mngt/web/Mngt01Controller.java @@ -54,8 +54,6 @@ public class Mngt01Controller extends ApplicationController { mav.setViewName("fims/mngt/mngt01010-main"); mav.addObject("pageName", "mngt01010"); - List allSggList = sggDeptService.getSigunguList(new SigunguQuery()); - mav.addObject("sggList", allSggList); FimsUser currentUser = (FimsUser) currentUser().getUser(); if(currentUser.getCntnSeCd().equals("01")) { @@ -64,6 +62,38 @@ public class Mngt01Controller extends ApplicationController { mav.addObject("isPublicOfficer", false); } + List sggList = null; + if(currentUser.getCntnSeCd().equals("01")){ + + sggList = sggDeptService.getSigunguList(new SigunguQuery()); + + if(!currentUser.getOrgID().equals("ADMIN")) { + String upSggCd = ""; + List curSggInfo = sggDeptService.getSigunguList(new SigunguQuery().setSggIDs(currentUser.getOrgID())); + if(curSggInfo != null && !curSggInfo.isEmpty()) { + upSggCd = curSggInfo.get(0).string("UP_SGG_CD"); + } + final String UP_SGG_CD = upSggCd.equals("") ? "" : upSggCd; + + sggList = sggList.stream().filter((item) -> { + if(item.string("SGG_CD").equals(currentUser.getOrgID())) { + return true; + } + if(item.string("UP_SGG_CD").equals(currentUser.getOrgID())) { + return true; + } + if(!UP_SGG_CD.equals("")) { + if(item.string("SGG_CD").equals(UP_SGG_CD)) { + return true; + } + } + return false; + }).toList(); + } + } + + mav.addObject("sggList", sggList); + return mav; } @@ -103,7 +133,7 @@ public class Mngt01Controller extends ApplicationController { * @return jsonView */ @RequestMapping(name="공지사항 상세 조회", value=METHOD_URL.getNtcInfo) - public ModelAndView getNtcInfo(String ntcId) { + public ModelAndView getNtcInfo(String ntcId, String cntnSeCd) { boolean json = jsonResponse(); ModelAndView mav = new ModelAndView(json ? "jsonView" : "fims/mngt/mngt01020-info"); mav.addObject("pageName", "mngt01020"); @@ -122,8 +152,42 @@ public class Mngt01Controller extends ApplicationController { mav.addObject("isPublicOfficer", false); } + List allSggList = sggDeptService.getSigunguList(new SigunguQuery()); - mav.addObject("sggList", allSggList); + mav.addObject("allSggList", allSggList); + + List selectableSggList = null; + if(currentUser.getCntnSeCd().equals("01")) { + selectableSggList = sggDeptService.getSigunguList(new SigunguQuery()); + if(!currentUser.getOrgID().equals("ADMIN")) { + String upSggCd = ""; + List curSggInfo = sggDeptService.getSigunguList(new SigunguQuery().setSggIDs(currentUser.getOrgID())); + if(curSggInfo != null && !curSggInfo.isEmpty()) { + upSggCd = curSggInfo.get(0).string("UP_SGG_CD"); + } + mav.addObject("upSggCd", upSggCd); + final String UP_SGG_CD = upSggCd.equals("") ? "" : upSggCd; + + selectableSggList = selectableSggList.stream().filter((item) -> { + if(item.string("SGG_CD").equals(currentUser.getOrgID())) { + return true; + } + if(item.string("UP_SGG_CD").equals(currentUser.getOrgID())) { + return true; + } + if(!UP_SGG_CD.equals("")) { + if(item.string("SGG_CD").equals(UP_SGG_CD)) { + return true; + } + } + return false; + }).toList(); + } + } + mav.addObject("selectableSggList", toJson(selectableSggList)); + + + mav.addObject("cntnSeCd", cntnSeCd); return mav; } diff --git a/src/main/resources/sql/mapper/base/sigungu-mapper.xml b/src/main/resources/sql/mapper/base/sigungu-mapper.xml index 995ce5cd..fb90f790 100644 --- a/src/main/resources/sql/mapper/base/sigungu-mapper.xml +++ b/src/main/resources/sql/mapper/base/sigungu-mapper.xml @@ -25,7 +25,8 @@ -SELECT SGG_CD + +SELECT SGG_CD , SGG_NM , INST_CD , INST_SE_CD @@ -35,27 +36,38 @@ , INST_ZIP , OFFCS_FILE_PATH , OFFCS_FILE_NM + , UP_SGG_CD , USE_YN , REG_DT , RGTR , MDFCN_DT , MDFR - FROM TB_SGG + FROM TB_SGG + - +/* 시군구 목록 조회(sigunguMapper.selectSigunguList) */ AND ${by} LIKE CONCAT('%', #{term}, '%') - AND SGG_CD IN (#{sggID}) - AND INST_CD IN (#{instCode}) - AND USE_YN = 'Y' + + AND SGG_CD IN (#{sggID}) + + + AND INST_CD IN (#{instCode}) + + + AND USE_YN = 'Y' + + - +/* 시군구 객체 가져오기(sigunguMapper.selectSigungus) */ @@ -66,7 +78,8 @@ AND USE_YN = 'Y' -/* 시군구 등록(sigunguMapper.insert) */ + +/* 시군구 등록(sigunguMapper.insert) */ INSERT INTO TB_SGG ( SGG_CD , SGG_NM @@ -99,9 +112,11 @@ INSERT INTO TB_SGG ( , #{createdBy} , #{lastModified} , #{modifiedBy} -) +) + -/* 시군구 수정(sigunguMapper.update) */ + +/* 시군구 수정(sigunguMapper.update) */ UPDATE TB_SGG SET INST_CD = #{instCode} , INST_SE_CD = #{instType} @@ -115,13 +130,16 @@ UPDATE TB_SGG , USE_YN = #{useYN} , MDFCN_DT = #{lastModified} , MDFR = #{modifiedBy} - WHERE SGG_CD = #{sggID} + WHERE SGG_CD = #{sggID} + -/* 시군구 삭제(sigunguMapper.delete) */ + +/* 시군구 삭제(sigunguMapper.delete) */ UPDATE TB_SGG SET USE_YN = 'N' , MDFCN_DT = , MDFR = #{currentUser.id} - WHERE SGG_CD IN (#{sggID}) + WHERE SGG_CD IN (#{sggID}) + \ No newline at end of file