From 0389e95ebf84c36488fcaeed4f3e3bf30e5123ce Mon Sep 17 00:00:00 2001 From: leebj Date: Thu, 4 Jul 2024 10:46:36 +0900 Subject: [PATCH] =?UTF-8?q?=EC=86=8C=EC=8A=A4=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cokr/xit/fims/base/dao/OgdpMapper.java | 16 +++--------- .../xit/fims/base/service/bean/OgdpBean.java | 9 ++----- .../xit/fims/base/web/MainController.java | 25 ++++++++++++++++--- .../xit/fims/base/web/OgdpController.java | 2 +- .../sql/mapper/base/authority-mapper.xml | 2 +- .../resources/sql/mapper/base/user-mapper.xml | 1 - .../WEB-INF/jsp/base/authority/user-list.jsp | 2 +- .../WEB-INF/jsp/base/user/select-user.jsp | 2 +- .../WEB-INF/jsp/base/user/user-main.jsp | 2 +- 9 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/main/java/cokr/xit/fims/base/dao/OgdpMapper.java b/src/main/java/cokr/xit/fims/base/dao/OgdpMapper.java index 067e2cb4..4899d334 100644 --- a/src/main/java/cokr/xit/fims/base/dao/OgdpMapper.java +++ b/src/main/java/cokr/xit/fims/base/dao/OgdpMapper.java @@ -164,21 +164,14 @@ public interface OgdpMapper extends AbstractMapper { - /**모든 시군구 목록을 반환한다.
- * @param - * @return 시군구 목록 - */ @Select(SQLUtil.SCRIPT_START+""" - /* 모든 시군구 조회(ogdpMapper.selectAllSggList) */ - SELECT SGG_CD - , SGG_NM - , (SELECT (CASE WHEN COUNT(*) > 0 THEN 'Y' ELSE 'N' END) FROM TB_USER WHERE NSTT_CD = A.INST_CD) AS USER_USE_YN + /* 유저 수 조회(ogdpMapper.countUser) */ + SELECT COUNT(*) FROM TB_SGG A WHERE USE_YN = 'Y' + AND SGG_CD = #{sggCd} """+SQLUtil.SCRIPT_END) - List selectAllSggList(); - - + int countUser(String sggCd); /**시군구 설정 정보를 수정한다. * @param sgg 시군구 @@ -332,5 +325,4 @@ public interface OgdpMapper extends AbstractMapper { List selectDeptStngList(OgdpQuery query); - } diff --git a/src/main/java/cokr/xit/fims/base/service/bean/OgdpBean.java b/src/main/java/cokr/xit/fims/base/service/bean/OgdpBean.java index c0b05501..f7d3a95b 100644 --- a/src/main/java/cokr/xit/fims/base/service/bean/OgdpBean.java +++ b/src/main/java/cokr/xit/fims/base/service/bean/OgdpBean.java @@ -34,8 +34,8 @@ public class OgdpBean extends AbstractBean { return ogdpMapper.selectAbleOgdpList(params); } - public List selectAllSggList(){ - return ogdpMapper.selectAllSggList(); + public int countUser(String sggCd) { + return ogdpMapper.countUser(sggCd); } public DataObject selectOgdpInfoOfUser(String userId){ @@ -127,9 +127,4 @@ public class OgdpBean extends AbstractBean { } - - - - - } diff --git a/src/main/java/cokr/xit/fims/base/web/MainController.java b/src/main/java/cokr/xit/fims/base/web/MainController.java index 85d4b3e2..63aabf53 100644 --- a/src/main/java/cokr/xit/fims/base/web/MainController.java +++ b/src/main/java/cokr/xit/fims/base/web/MainController.java @@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import cokr.xit.base.user.ManagedUser; +import cokr.xit.base.user.SigunguQuery; +import cokr.xit.base.user.service.SigunguDepartmentService; import cokr.xit.base.user.service.UserService; import cokr.xit.fims.base.service.bean.OgdpBean; import cokr.xit.fims.task.TaskRequestMappingHandlerMapping; @@ -36,17 +38,34 @@ public class MainController extends cokr.xit.base.web.MainController { @Resource(name="userService") private UserService userService; + @Resource(name="sigunguDepartmentService") + private SigunguDepartmentService sggDeptService; + @Override public ModelAndView loginPage() { + ModelAndView mav = new ModelAndView("login"); + + List sggs = sggDeptService.getSigunguList(new SigunguQuery()); + if (sggs.isEmpty()) { + throw new RuntimeException("No sigungu info found."); + } + for(DataObject sgg : sggs) { + int count = ogdpBean.countUser(sgg.string("SGG_CD")); + String userUseYn = count > 0 ? "Y" : "N"; + sgg.set("USER_USE_YN", userUseYn); + } + boolean multiple = sggs.size() > 1; + mav.addObject("sggs", toJson(sggs)); + mav.addObject("multipleSggs", multiple); - ModelAndView mav = new ModelAndView("login"); - List sggList = ogdpBean.selectAllSggList(); - mav.addObject("sggList", sggList); + mav.addObject("sggList", sggs); mav.addObject("sysInstCd", instCd); mav.addObject("sysSggCd", sggCd); return mav; + + } @Override diff --git a/src/main/java/cokr/xit/fims/base/web/OgdpController.java b/src/main/java/cokr/xit/fims/base/web/OgdpController.java index 495f9d35..cfc778d9 100644 --- a/src/main/java/cokr/xit/fims/base/web/OgdpController.java +++ b/src/main/java/cokr/xit/fims/base/web/OgdpController.java @@ -89,7 +89,7 @@ public class OgdpController extends ApplicationController { mav.setViewName("fims/ogdp/select-sgg"); mav.addObject("pageName", "selectSgg"); - List sggList = ogdpBean.selectAllSggList(); + List sggList = sggDeptService.getSigunguList(new SigunguQuery()) ; mav.addObject("sggList", sggList); } else { diff --git a/src/main/resources/sql/mapper/base/authority-mapper.xml b/src/main/resources/sql/mapper/base/authority-mapper.xml index 6a934461..80ae652c 100644 --- a/src/main/resources/sql/mapper/base/authority-mapper.xml +++ b/src/main/resources/sql/mapper/base/authority-mapper.xml @@ -164,7 +164,7 @@ SELECT A.AUTH_ID , B.ORG_ID , (SELECT SGG_NM FROM TB_SGG WHERE SGG_CD = B.ORG_ID) AS SGG_NM , B.NSTT_CD - , (SELECT INST_NM FROM TB_SGG WHERE SGG_CD = B.ORG_ID) AS NSTT_NM + , (SELECT INST_NM FROM TB_SGG WHERE SGG_CD = B.ORG_ID) AS INST_NM , B.DEPT_CD , (SELECT DEPT_NM FROM TB_DEPT WHERE DEPT_CD = B.DEPT_CD) AS DEPT_NM FROM TB_AUTH_USER A diff --git a/src/main/resources/sql/mapper/base/user-mapper.xml b/src/main/resources/sql/mapper/base/user-mapper.xml index cb866fed..e19d4fac 100644 --- a/src/main/resources/sql/mapper/base/user-mapper.xml +++ b/src/main/resources/sql/mapper/base/user-mapper.xml @@ -69,7 +69,6 @@ SELECT A.USER_ID , A.STTS , (SELECT GET_CODE_NM('CMN004', A.STTS) FROM DUAL) AS STTS_NM , A.NSTT_CD AS NSTT_CD - , (CASE WHEN A.NSTT_CD = 'default' THEN '기본 기관' ELSE B.INST_NM END) AS NSTT_NM , A.NSTT_CD AS INST_CD , (CASE WHEN A.NSTT_CD = 'default' THEN '기본 기관' ELSE B.INST_NM END) AS INST_NM , A.DEPT_CD AS DEPT_CD diff --git a/src/main/webapp/WEB-INF/jsp/base/authority/user-list.jsp b/src/main/webapp/WEB-INF/jsp/base/authority/user-list.jsp index 392d1de3..5d1a3957 100644 --- a/src/main/webapp/WEB-INF/jsp/base/authority/user-list.jsp +++ b/src/main/webapp/WEB-INF/jsp/base/authority/user-list.jsp @@ -23,7 +23,7 @@ {SGG_NM} - {NSTT_NM} + {INST_NM} {DEPT_NM} {USER_ACNT} {USER_NM} diff --git a/src/main/webapp/WEB-INF/jsp/base/user/select-user.jsp b/src/main/webapp/WEB-INF/jsp/base/user/select-user.jsp index bc55f9c4..f8046233 100644 --- a/src/main/webapp/WEB-INF/jsp/base/user/select-user.jsp +++ b/src/main/webapp/WEB-INF/jsp/base/user/select-user.jsp @@ -36,7 +36,7 @@ {SGG_NM} - {NSTT_NM} + {INST_NM} {DEPT_NM} {USER_ACNT} {USER_NM} diff --git a/src/main/webapp/WEB-INF/jsp/base/user/user-main.jsp b/src/main/webapp/WEB-INF/jsp/base/user/user-main.jsp index 8f4e533e..28252835 100644 --- a/src/main/webapp/WEB-INF/jsp/base/user/user-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/base/user/user-main.jsp @@ -41,7 +41,7 @@ {USER_ACNT} {USER_NM} - {NSTT_NM} + {INST_NM} {DEPT_NM} {EML_ADRS} {TELNO}