From e0c1a4da943dcd7f9a00510abd10a8b46dbb93c7 Mon Sep 17 00:00:00 2001 From: minuk926 Date: Thu, 10 Nov 2022 12:21:38 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=EA=B6=8C=ED=95=9C=EA=B4=80?= =?UTF-8?q?=EB=A6=AC-=EA=B6=8C=ED=95=9C=EA=B3=84=EC=B8=B5=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mng/auth/model/XitAuthHierarchyMngVO.java | 82 ++------------ .../auth/service/AuthHierarchyMgtService.java | 2 +- .../impl/AuthHierarchyMgtServiceImpl.java | 38 ++++--- .../auth/web/AuthHierarchyMgtController.java | 75 +++++++++---- .../mng/auth/auth-author-mysql-mapper.xml | 4 +- .../biz/mng/auth/mngAuthHierarchyMgtForm.jsp | 8 +- .../biz/mng/auth/mngAuthHierarchyMgtPopup.jsp | 105 +++++++++--------- 7 files changed, 144 insertions(+), 170 deletions(-) diff --git a/src/main/java/kr/xit/framework/biz/mng/auth/model/XitAuthHierarchyMngVO.java b/src/main/java/kr/xit/framework/biz/mng/auth/model/XitAuthHierarchyMngVO.java index 5ae619be..08c63a60 100644 --- a/src/main/java/kr/xit/framework/biz/mng/auth/model/XitAuthHierarchyMngVO.java +++ b/src/main/java/kr/xit/framework/biz/mng/auth/model/XitAuthHierarchyMngVO.java @@ -1,6 +1,12 @@ package kr.xit.framework.biz.mng.auth.model; import kr.xit.framework.core.model.BaseVO; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; /** * @@ -12,6 +18,12 @@ import kr.xit.framework.core.model.BaseVO; * @since 2002. 2. 2. * @version 1.0 Copyright(c) XIT All rights reserved. */ +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = false) +@ToString public class XitAuthHierarchyMngVO extends BaseVO { /** @@ -42,74 +54,4 @@ public class XitAuthHierarchyMngVO extends BaseVO { * 권한구조 코드명 */ private String authorRescueCodeNm; - - /** - * authorCode attribute 를 리턴한다. - * @return String - */ - public String getAuthorCode() { - return authorCode; - } - /** - * authorCode attribute 값을 설정한다. - * @param authorCode String - */ - public void setAuthorCode(String authorCode) { - this.authorCode = authorCode; - } - /** - * authorCreatDe attribute 를 리턴한다. - * @return String - */ - public String getAuthorCreatDe() { - return authorCreatDe; - } - /** - * authorCreatDe attribute 값을 설정한다. - * @param authorCreatDe String - */ - public void setAuthorCreatDe(String authorCreatDe) { - this.authorCreatDe = authorCreatDe; - } - /** - * authorDc attribute 를 리턴한다. - * @return String - */ - public String getAuthorDc() { - return authorDc; - } - /** - * authorDc attribute 값을 설정한다. - * @param authorDc String - */ - public void setAuthorDc(String authorDc) { - this.authorDc = authorDc; - } - /** - * authorNm attribute 를 리턴한다. - * @return String - */ - public String getAuthorNm() { - return authorNm; - } - /** - * authorNm attribute 값을 설정한다. - * @param authorNm String - */ - public void setAuthorNm(String authorNm) { - this.authorNm = authorNm; - } - public String getAuthorRescueCode() { - return authorRescueCode; - } - public void setAuthorRescueCode(String authorRescueCode) { - this.authorRescueCode = authorRescueCode; - } - public String getAuthorRescueCodeNm() { - return authorRescueCodeNm; - } - public void setAuthorRescueCodeNm(String authorRescueCodeNm) { - this.authorRescueCodeNm = authorRescueCodeNm; - } - } diff --git a/src/main/java/kr/xit/framework/biz/mng/auth/service/AuthHierarchyMgtService.java b/src/main/java/kr/xit/framework/biz/mng/auth/service/AuthHierarchyMgtService.java index d5f2f2a1..4607905d 100644 --- a/src/main/java/kr/xit/framework/biz/mng/auth/service/AuthHierarchyMgtService.java +++ b/src/main/java/kr/xit/framework/biz/mng/auth/service/AuthHierarchyMgtService.java @@ -50,7 +50,7 @@ public interface AuthHierarchyMgtService { * @author: 박민규 * @date: 2020. 11. 2. */ - public XitAuthHierarchyMngVO findView(XitAuthHierarchyMngVO vo); + public XitAuthHierarchyMngVO findAuthHierarchyInfo(XitAuthHierarchyMngVO vo); /** *
메소드 설명: 권한계층관리 등록
diff --git a/src/main/java/kr/xit/framework/biz/mng/auth/service/impl/AuthHierarchyMgtServiceImpl.java b/src/main/java/kr/xit/framework/biz/mng/auth/service/impl/AuthHierarchyMgtServiceImpl.java index d6a11229..1df6127e 100644 --- a/src/main/java/kr/xit/framework/biz/mng/auth/service/impl/AuthHierarchyMgtServiceImpl.java +++ b/src/main/java/kr/xit/framework/biz/mng/auth/service/impl/AuthHierarchyMgtServiceImpl.java @@ -50,6 +50,27 @@ public class AuthHierarchyMgtServiceImpl implements AuthHierarchyMgtService { return voList; } + @Override + public XitAuthHierarchyMngVO findAuthHierarchyInfo(XitAuthHierarchyMngVO vo) { + XitAuthHierarchyMngVO result = new XitAuthHierarchyMngVO(); + + List listRoleSclsrtRescueVO = authAuthorMgtMapper.selectRoleSclsrtRescues(new XitRoleSclsrtRescueVO()); + if(XitCmmnUtil.isEmpty(listRoleSclsrtRescueVO)) + return result; + + + String topButtonAuthorCode = this.getStrAuthHierarchy(listRoleSclsrtRescueVO.get(0).getChldrnRole()); + topButtonAuthorCode = topButtonAuthorCode.split(">")[0].trim(); + String strAuthorRescueCode = this.getStrAuthHierarchy(topButtonAuthorCode); + result.setAuthorRescueCode(strAuthorRescueCode); + + return result; + } + + + + + @Override public List findList(XitAuthHierarchyMngSearchVO searchVO) { List result = null; @@ -82,23 +103,6 @@ public class AuthHierarchyMgtServiceImpl implements AuthHierarchyMgtService { return result; } - @Override - public XitAuthHierarchyMngVO findView(XitAuthHierarchyMngVO vo) { - XitAuthHierarchyMngVO result = new XitAuthHierarchyMngVO(); - - List listRoleSclsrtRescueVO = authAuthorMgtMapper.selectRoleSclsrtRescues(new XitRoleSclsrtRescueVO()); - if(XitCmmnUtil.isEmpty(listRoleSclsrtRescueVO)) - return result; - - - String topButtonAuthorCode = this.getStrAuthHierarchy(listRoleSclsrtRescueVO.get(0).getChldrnRole()); - topButtonAuthorCode = topButtonAuthorCode.split(">")[0].trim(); - String strAuthorRescueCode = this.getStrAuthHierarchy(topButtonAuthorCode); - result.setAuthorRescueCode(strAuthorRescueCode); - - return result; - } - @Override public void addProc(XitAuthHierarchyMngVO vo) { this.modifyProc(vo); diff --git a/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthHierarchyMgtController.java b/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthHierarchyMgtController.java index b911b7b5..f580445a 100644 --- a/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthHierarchyMgtController.java +++ b/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthHierarchyMgtController.java @@ -22,6 +22,7 @@ import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; @@ -32,7 +33,6 @@ import org.springframework.web.servlet.ModelAndView; import egovframework.rte.fdl.security.securedobject.EgovSecuredObjectService; import egovframework.rte.fdl.security.userdetails.jdbc.EgovJdbcUserDetailsManager; import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; -import kr.xit.framework.biz.cmm.model.XitAuthorGroupInfoVO; import kr.xit.framework.biz.cmm.model.XitAuthorInfoVO; import kr.xit.framework.biz.cmm.service.XitFrameCrudService; import kr.xit.framework.biz.mng.auth.model.XitAuthHierarchyMngSearchVO; @@ -93,20 +93,17 @@ public class AuthHierarchyMgtController { public void mngAuthHierarchyMgtForm() { } - - @RequestMapping(value = "/mngAuthHierarchyMgtPopup") public ModelAndView mngAuthHierarchyMgtPopup(XitAuthHierarchyMngVO vo){ ModelAndView mav = new ModelAndView(); //최하위 권한의 권한계층 조회 - XitAuthHierarchyMngVO authHierarchyMngVO = service.findView(vo); + XitAuthHierarchyMngVO authHierarchyMngVO = service.findAuthHierarchyInfo(vo); //권한코드 Map 생성 - List listAuthorInfoVO = authAuthorMgtService.findAuthAuthors(null); + List authorInfoVOList = authAuthorMgtService.findAuthAuthors(null); Map mAuthorInfo = new HashMap(); - for(XitAuthorInfoVO item : listAuthorInfoVO) { - mAuthorInfo.put(item.getAuthorCode(), item.getAuthorNm()); - } + authorInfoVOList.forEach(infoVO -> mAuthorInfo.put(infoVO.getAuthorCode(), infoVO.getAuthorNm())); + //권한코드 목록에서 비중복 권한만 추출 Map mNoDuplAuthorInfo = new HashMap(); mNoDuplAuthorInfo.putAll(mAuthorInfo); @@ -121,27 +118,18 @@ public class AuthHierarchyMgtController { } } //권한계층 미설정 권한 목록 설정 - List listAuthorInfo = new ArrayList(); - Iterator it = mNoDuplAuthorInfo.keySet().iterator(); - while(it.hasNext()) { - String authorCode = it.next(); + List listAuthorInfo = new ArrayList<>(); + for (String authorCode : mNoDuplAuthorInfo.keySet()) { XitAuthorInfoVO authorInfo = new XitAuthorInfoVO(); authorInfo.setAuthorCode(authorCode); authorInfo.setAuthorNm(mNoDuplAuthorInfo.get(authorCode)); listAuthorInfo.add(authorInfo); } - mav.addObject("authorList", listAuthorInfo); mav.addObject("mAuthorInfo", mAuthorInfo); - - if(Checks.isEmpty(vo) || Checks.isEmpty(vo.getAuthorCode())){ - mav.addObject("authHierarchyManage", new XitAuthHierarchyMngVO()); - mav.addObject("pageTitle", "권한 계층 설정"); - } else { - mav.addObject("authHierarchyManage", authHierarchyMngVO); - mav.addObject("pageTitle", "권한 계층 설정"); - } + mav.addObject("authHierarchyManage", authHierarchyMngVO); + mav.addObject("pageTitle", "권한 계층 설정"); mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"mng/auth/mngAuthHierarchyMgtPopup.popup"); return mav; } @@ -151,6 +139,49 @@ public class AuthHierarchyMgtController { return ResultResponse.of(service.findAuthHierarchies(paraMap, MybatisUtils.getPagingInfo(paraMap))); } + @PostMapping(value = "/saveResetAuthHierarchy") + public ModelAndView saveResetAuthHierarchy(@RequestParam Map paraMap){ + ModelAndView mav = new ModelAndView(); + + //최하위 권한의 권한계층 조회 + XitAuthHierarchyMngVO result = authAuthorMgtService.findAuthAuthors(paraMap); + //권한코드 Map 생성 + List listAuthorInfoVO = xitFrameCrudService.findXitAuthorInfos(new XitAuthorInfoVO()); + Map mAuthorInfo = new HashMap(); + for(XitAuthorInfoVO item : listAuthorInfoVO) { + mAuthorInfo.put(item.getAuthorCode(), item.getAuthorNm()); + } + //권한코드 목록에서 비중복 권한만 추출 + Map mNoDuplAuthorInfo = new HashMap(); + mNoDuplAuthorInfo.putAll(mAuthorInfo); + String[] arrAuthorRescue = result.getAuthorRescueCode().split(">"); + for(int i=0; i listAuthorInfo = new ArrayList(); + Iterator it = mNoDuplAuthorInfo.keySet().iterator(); + while(it.hasNext()) { + String authorCode = it.next(); + XitAuthorInfoVO authorInfo = new XitAuthorInfoVO(); + authorInfo.setAuthorCode(authorCode); + authorInfo.setAuthorNm(mNoDuplAuthorInfo.get(authorCode)); + listAuthorInfo.add(authorInfo); + } + + mav.addObject("authorList", listAuthorInfo); + mav.addObject("mAuthorInfo", mAuthorInfo); + mav.addObject("authHierarchyManage", paraMap); + mav.addObject("pageTitle", "권한 계층 설정"); + mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"mng/auth/mngAuthHierarchyMgtPopup.popup"); + return mav; + } @@ -257,7 +288,7 @@ public class AuthHierarchyMgtController { case "edit": //수정 페이지 // case "view": //상세 페이지 //최하위 권한의 권한계층 조회 - XitAuthHierarchyMngVO result = service.findView(vo); + XitAuthHierarchyMngVO result = authAuthorMgtService.findAuthAuthorInfos(vo); //권한코드 Map 생성 List listAuthorInfoVO = xitFrameCrudService.findXitAuthorInfos(new XitAuthorInfoVO()); Map mAuthorInfo = new HashMap(); diff --git a/src/main/resources/sqlmapper/framework/mng/auth/auth-author-mysql-mapper.xml b/src/main/resources/sqlmapper/framework/mng/auth/auth-author-mysql-mapper.xml index 4fc8ecdc..ddda4a41 100644 --- a/src/main/resources/sqlmapper/framework/mng/auth/auth-author-mysql-mapper.xml +++ b/src/main/resources/sqlmapper/framework/mng/auth/auth-author-mysql-mapper.xml @@ -52,7 +52,7 @@ - /* auth-author-mysql-mapper|selectAuthorInfos-권한 목록 조회|julim */ + /* auth-author-mysql-mapper|updateAuthorInfos-권한 정보 변경|julim */ UPDATE xit_author_info SET author_nm = IF(author_nm = #{authorNm}, author_nm, #{authorNm}) , author_dc = IF(author_dc = #{authorDc}, author_dc, #{authorDc}) @@ -60,7 +60,7 @@ - /* auth-author-mysql-mapper|selectAuthorInfos-권한 목록 조회|julim */ + /* auth-author-mysql-mapper|deleteAuthorInfos-권한 정보 삭제|julim */ DELETE FROM xit_author_info WHERE author_code = #{authorCode} diff --git a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthHierarchyMgtForm.jsp b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthHierarchyMgtForm.jsp index 422025a3..c4db5fd1 100644 --- a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthHierarchyMgtForm.jsp +++ b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthHierarchyMgtForm.jsp @@ -28,13 +28,11 @@ -<%-- ---%> @@ -106,9 +104,9 @@ $(() => { $('#btnSearch').on('click', () => fnBiz.search()); - // $('#btnPopup').on('click', () => { - // fnBiz.pagePopup('add', {}); - // }); + $('#btnPopup').on('click', () => { + fnBiz.pagePopup('add', {}); + }); }); diff --git a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthHierarchyMgtPopup.jsp b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthHierarchyMgtPopup.jsp index 7a52cbba..fe28ce35 100644 --- a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthHierarchyMgtPopup.jsp +++ b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthHierarchyMgtPopup.jsp @@ -2,12 +2,53 @@ <%@ include file="/WEB-INF/jsp/framework/taglibs.jsp" %> <%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %> + - +<%--@elvariable id="authHierarchyManage" type=""--%> + @@ -105,47 +145,6 @@ - diff --git a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthHierarchyMgtPopup.jsp b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthHierarchyMgtPopup.jsp index fe28ce35..305a3a3e 100644 --- a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthHierarchyMgtPopup.jsp +++ b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthHierarchyMgtPopup.jsp @@ -45,10 +45,9 @@ - <%--@elvariable id="authHierarchyManage" type=""--%> - +