From 41aabf98cfa8730e8f2d74b112d402e65ea2a1d8 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Sun, 6 Nov 2022 21:27:54 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EA=B6=8C=ED=95=9C=EA=B7=B8=EB=A3=B9=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/cmm/model/XitAuthorGroupInfoVO.java | 61 ++----- .../service/impl/XitFrameCrudServiceImpl.java | 10 +- .../service/impl/XitFrameUnitServiceImpl.java | 6 +- .../mng/auth/mapper/AuthAuthorMgtMapper.java | 2 + .../biz/mng/auth/mapper/AuthGrpMgtMapper.java | 27 +++ .../auth/service/AuthAuthorMgtService.java | 9 - .../mng/auth/service/AuthGrpMgtService.java | 15 ++ .../service/impl/AuthGrpMgtServiceImpl.java | 166 +++++++++++++++++- .../mng/auth/web/AuthAuthorMgtController.java | 2 +- .../mng/auth/web/AuthGrpMgtController.java | 47 ++++- .../mng/auth/web/AuthRoleMgtController.java | 2 +- .../biz/mng/user/mapper/UserMgtMapper.java | 4 +- .../biz/mng/user/service/UserMgtService.java | 2 - .../user/service/impl/UserMgtServiceImpl.java | 20 +-- .../cache/cachecode-mysql-mapper.xml | 1 + .../mng/auth/auth-author-mysql-mapper.xml | 8 +- .../mng/auth/auth-grp-mysql-mapper.xml | 124 +++++++------ .../framework/mng/usr/user-mysql-mapper.xml | 114 +----------- .../biz/mng/auth/mngAuthAuthorMgtForm.jsp | 5 +- .../biz/mng/auth/mngAuthGrpMgtForm.jsp | 22 ++- .../biz/mng/auth/mngAuthGrpMgtPopup.jsp | 48 ++--- 21 files changed, 403 insertions(+), 292 deletions(-) diff --git a/src/main/java/kr/xit/framework/biz/cmm/model/XitAuthorGroupInfoVO.java b/src/main/java/kr/xit/framework/biz/cmm/model/XitAuthorGroupInfoVO.java index 38f470e1..b93e8ce8 100644 --- a/src/main/java/kr/xit/framework/biz/cmm/model/XitAuthorGroupInfoVO.java +++ b/src/main/java/kr/xit/framework/biz/cmm/model/XitAuthorGroupInfoVO.java @@ -1,6 +1,12 @@ package kr.xit.framework.biz.cmm.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,50 +18,19 @@ 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 XitAuthorGroupInfoVO extends BaseVO { - - /** - * serialVersionUID - */ private static final long serialVersionUID = -4390096179096398215L; - - - protected String group_id; //그룹 id - protected String group_nm; //그룹 명 - protected String group_creat_de; //그룹 생성 일 - protected String group_dc; //그룹 설명 - protected String author_code; //권한 코드 - - public String getGroup_id() { - return group_id; - } - public void setGroup_id(String group_id) { - this.group_id = group_id; - } - public String getGroup_nm() { - return group_nm; - } - public void setGroup_nm(String group_nm) { - this.group_nm = group_nm; - } - public String getGroup_creat_de() { - return group_creat_de; - } - public void setGroup_creat_de(String group_creat_de) { - this.group_creat_de = group_creat_de; - } - public String getGroup_dc() { - return group_dc; - } - public void setGroup_dc(String group_dc) { - this.group_dc = group_dc; - } - public String getAuthor_code() { - return author_code; - } - public void setAuthor_code(String author_code) { - this.author_code = author_code; - } - + private String groupId; //그룹 id + private String groupNm; //그룹 명 + private String groupDc; //그룹 설명 + private String authorCode; //권한 코드 + private String authorNm; + private String groupCreatDe; //그룹 생성 일 } diff --git a/src/main/java/kr/xit/framework/biz/cmm/service/impl/XitFrameCrudServiceImpl.java b/src/main/java/kr/xit/framework/biz/cmm/service/impl/XitFrameCrudServiceImpl.java index 79c173b4..5537724e 100644 --- a/src/main/java/kr/xit/framework/biz/cmm/service/impl/XitFrameCrudServiceImpl.java +++ b/src/main/java/kr/xit/framework/biz/cmm/service/impl/XitFrameCrudServiceImpl.java @@ -97,7 +97,7 @@ public class XitFrameCrudServiceImpl implements XitFrameCrudService{ * 필수조건 확인 */ String emsg = null; - if(XitCmmnUtil.isEmpty(vo.getGroup_id())) + if(XitCmmnUtil.isEmpty(vo.getGroupId())) emsg = String.format("(%s)그룹ID(은)는 필수조건 입니다.", table); if(emsg!=null){ logger.error(emsg); @@ -128,7 +128,7 @@ public class XitFrameCrudServiceImpl implements XitFrameCrudService{ * 필수조건 확인 */ String emsg = null; - if(XitCmmnUtil.isEmpty(vo.getGroup_id())) + if(XitCmmnUtil.isEmpty(vo.getGroupId())) emsg = String.format("(%s)그룹ID(은)는 필수조건 입니다.", table); if(emsg!=null){ logger.error(emsg); @@ -161,7 +161,7 @@ public class XitFrameCrudServiceImpl implements XitFrameCrudService{ * 필수조건 확인 */ String emsg = null; - if(XitCmmnUtil.isEmpty(vo.getGroup_id())) + if(XitCmmnUtil.isEmpty(vo.getGroupId())) emsg = String.format("(%s)그룹ID(은)는 필수조건 입니다.", table); if(emsg!=null){ logger.error(emsg); @@ -194,7 +194,7 @@ public class XitFrameCrudServiceImpl implements XitFrameCrudService{ * 필수조건 확인 */ String emsg = null; - if(XitCmmnUtil.isEmpty(vo.getGroup_id())) + if(XitCmmnUtil.isEmpty(vo.getGroupId())) emsg = String.format("(%s)그룹ID(은)는 필수조건 입니다.", table); if(emsg!=null){ logger.error(emsg); @@ -4981,7 +4981,7 @@ public class XitFrameCrudServiceImpl implements XitFrameCrudService{ // logger.error(emsg); // throw new RuntimeException(emsg); // } - + /** * 처리 */ diff --git a/src/main/java/kr/xit/framework/biz/cmm/service/impl/XitFrameUnitServiceImpl.java b/src/main/java/kr/xit/framework/biz/cmm/service/impl/XitFrameUnitServiceImpl.java index 2ee40f9a..c68cf683 100644 --- a/src/main/java/kr/xit/framework/biz/cmm/service/impl/XitFrameUnitServiceImpl.java +++ b/src/main/java/kr/xit/framework/biz/cmm/service/impl/XitFrameUnitServiceImpl.java @@ -523,16 +523,16 @@ public class XitFrameUnitServiceImpl implements XitFrameUnitService { // 그룹의 권한 조회 XitAuthorGroupInfoVO groupInfo = new XitAuthorGroupInfoVO(); - groupInfo.setGroup_id(groupId); + groupInfo.setGroupId(groupId); groupInfo = xitFrameCrudService.findXitAuthorGroupInfo(groupInfo); // 권한 설정 if (XitCmmnUtil.isEmpty(groupInfo)) return "ROLE_USER"; else { - if (XitCmmnUtil.isEmpty(groupInfo.getAuthor_code())) + if (XitCmmnUtil.isEmpty(groupInfo.getAuthorCode())) return "ROLE_USER"; else - return groupInfo.getAuthor_code(); + return groupInfo.getAuthorCode(); } } diff --git a/src/main/java/kr/xit/framework/biz/mng/auth/mapper/AuthAuthorMgtMapper.java b/src/main/java/kr/xit/framework/biz/mng/auth/mapper/AuthAuthorMgtMapper.java index 53c06d10..fa9b5515 100644 --- a/src/main/java/kr/xit/framework/biz/mng/auth/mapper/AuthAuthorMgtMapper.java +++ b/src/main/java/kr/xit/framework/biz/mng/auth/mapper/AuthAuthorMgtMapper.java @@ -51,6 +51,8 @@ public interface AuthAuthorMgtMapper { int deleteAuthorInfo(final String authorCode); + List selectRoleSclsrtRescues(final XitRoleSclsrtRescueVO vo); + XitRoleSclsrtRescueVO selectRoleSclsrtRescue(final XitRoleSclsrtRescueVO vo); int insertRoleSclsrtRescue(final XitRoleSclsrtRescueVO vo); int deleteRoleSclsrtRescue(final XitRoleSclsrtRescueVO vo); diff --git a/src/main/java/kr/xit/framework/biz/mng/auth/mapper/AuthGrpMgtMapper.java b/src/main/java/kr/xit/framework/biz/mng/auth/mapper/AuthGrpMgtMapper.java index 57f79164..23133775 100644 --- a/src/main/java/kr/xit/framework/biz/mng/auth/mapper/AuthGrpMgtMapper.java +++ b/src/main/java/kr/xit/framework/biz/mng/auth/mapper/AuthGrpMgtMapper.java @@ -2,8 +2,13 @@ package kr.xit.framework.biz.mng.auth.mapper; import java.sql.SQLException; import java.util.List; +import java.util.Map; + +import org.apache.ibatis.session.RowBounds; import egovframework.rte.psl.dataaccess.mapper.Mapper; +import kr.xit.framework.biz.cmm.model.XitAuthorGroupInfoVO; +import kr.xit.framework.biz.cmm.model.XitRoleSclsrtRescueVO; import kr.xit.framework.biz.mng.auth.model.XitAuthGrpMngSearchVO; import kr.xit.framework.biz.mng.auth.model.XitAuthGrpMngVO; @@ -20,6 +25,26 @@ import kr.xit.framework.biz.mng.auth.model.XitAuthGrpMngVO; @Mapper public interface AuthGrpMgtMapper { + List selectAuthorGroupInfos(final Map paraMap, final RowBounds rowBounds); + XitAuthorGroupInfoVO selectAuthorGroupInfo(final String groupId); + int insertAuthorGroupInfo(final XitAuthorGroupInfoVO vo); + int updateAuthorGroupInfo(final XitAuthorGroupInfoVO vo); + int deleteAuthorGroupInfo(final String groupId); + + + + + + + + + + + + + + + /** *
메소드 설명: 사용자그룹관리 목록 조회
* @param searchVO @@ -46,4 +71,6 @@ public interface AuthGrpMgtMapper { * @date: 2020. 4. 16. */ public XitAuthGrpMngVO findView(XitAuthGrpMngVO vo) throws SQLException; + + } diff --git a/src/main/java/kr/xit/framework/biz/mng/auth/service/AuthAuthorMgtService.java b/src/main/java/kr/xit/framework/biz/mng/auth/service/AuthAuthorMgtService.java index 762eff8f..9df97857 100644 --- a/src/main/java/kr/xit/framework/biz/mng/auth/service/AuthAuthorMgtService.java +++ b/src/main/java/kr/xit/framework/biz/mng/auth/service/AuthAuthorMgtService.java @@ -32,16 +32,7 @@ public interface AuthAuthorMgtService { * @date: 2020. 4. 16. */ List findAuthAuthors(final Map paraMap, final RowBounds rowBounds); - - /** - *
메소드 설명: 권한관리 상세정보 조회
- * @param vo - * @return XitAuthRegMngVO 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2020. 4. 16. - */ XitAuthorInfoVO findAuthAuthor(final String authorCode); - void addAuthAuthor(final XitAuthorInfoVO vo); void modifyAuthAuthor(final XitAuthorInfoVO vo); void removeAuthAuthor(final String authorCode); diff --git a/src/main/java/kr/xit/framework/biz/mng/auth/service/AuthGrpMgtService.java b/src/main/java/kr/xit/framework/biz/mng/auth/service/AuthGrpMgtService.java index 324b81ee..9d4aca7f 100644 --- a/src/main/java/kr/xit/framework/biz/mng/auth/service/AuthGrpMgtService.java +++ b/src/main/java/kr/xit/framework/biz/mng/auth/service/AuthGrpMgtService.java @@ -1,7 +1,12 @@ package kr.xit.framework.biz.mng.auth.service; import java.util.List; +import java.util.Map; +import org.apache.ibatis.session.RowBounds; + +import kr.xit.framework.biz.cmm.model.XitAuthorGroupInfoVO; +import kr.xit.framework.biz.cmm.model.XitAuthorInfoVO; import kr.xit.framework.biz.mng.auth.model.XitAuthGrpMngSearchVO; import kr.xit.framework.biz.mng.auth.model.XitAuthGrpMngVO; @@ -17,6 +22,16 @@ import kr.xit.framework.biz.mng.auth.model.XitAuthGrpMngVO; */ public interface AuthGrpMgtService { + List findAuthGrps(final Map paraMap, final RowBounds rowBounds); + XitAuthorGroupInfoVO findAuthGrp(final String groupId); + void addAuthGrp(final XitAuthorGroupInfoVO vo); + void modifyAuthGrp(final XitAuthorGroupInfoVO vo); + void removeAuthGrp(final String authorCode); + + + + + /** *
메소드 설명: 사용자그룹관리 목록 조회
diff --git a/src/main/java/kr/xit/framework/biz/mng/auth/service/impl/AuthGrpMgtServiceImpl.java b/src/main/java/kr/xit/framework/biz/mng/auth/service/impl/AuthGrpMgtServiceImpl.java index 50d870af..6a0f5393 100644 --- a/src/main/java/kr/xit/framework/biz/mng/auth/service/impl/AuthGrpMgtServiceImpl.java +++ b/src/main/java/kr/xit/framework/biz/mng/auth/service/impl/AuthGrpMgtServiceImpl.java @@ -2,28 +2,44 @@ package kr.xit.framework.biz.mng.auth.service.impl; import java.sql.SQLException; import java.util.List; +import java.util.Map; import javax.annotation.Resource; +import org.apache.ibatis.session.RowBounds; import org.springframework.stereotype.Service; import egovframework.rte.fdl.cmmn.exception.FdlException; import egovframework.rte.fdl.idgnr.EgovIdGnrService; import kr.xit.framework.biz.cmm.model.XitAuthorGroupInfoVO; +import kr.xit.framework.biz.cmm.model.XitRoleSclsrtRescueVO; +import kr.xit.framework.biz.cmm.model.XitUserScrtySetupVO; import kr.xit.framework.biz.cmm.service.XitFrameCrudService; import kr.xit.framework.biz.cmm.service.XitFrameUnitService; +import kr.xit.framework.biz.mng.auth.mapper.AuthAuthorMgtMapper; import kr.xit.framework.biz.mng.auth.mapper.AuthGrpMgtMapper; import kr.xit.framework.biz.mng.auth.model.XitAuthGrpMngSearchVO; import kr.xit.framework.biz.mng.auth.model.XitAuthGrpMngVO; import kr.xit.framework.biz.mng.auth.service.AuthGrpMgtService; +import kr.xit.framework.biz.mng.user.mapper.UserMgtMapper; import kr.xit.framework.core.message.XitMessageSource; import kr.xit.framework.core.utils.XitCmmnUtil; +import kr.xit.framework.support.exception.BizRuntimeException; +import kr.xit.framework.support.util.constants.MessageKey; +import lombok.extern.slf4j.Slf4j; +@Slf4j @Service public class AuthGrpMgtServiceImpl implements AuthGrpMgtService { @Resource - private AuthGrpMgtMapper xitAuthGrpMngMapper; + private AuthGrpMgtMapper mapper; + @Resource + private AuthAuthorMgtMapper authAuthorMgtMapper; + @Resource + private UserMgtMapper userMgtMapper; + + @Resource private XitFrameCrudService xitFrameCrudService; @Resource @@ -33,11 +49,145 @@ public class AuthGrpMgtServiceImpl implements AuthGrpMgtService { @Resource private XitMessageSource xitMessageSource; + @Override + public List findAuthGrps(final Map paraMap, final RowBounds rowBounds) { + return mapper.selectAuthorGroupInfos(paraMap, rowBounds); + } + + @Override + public XitAuthorGroupInfoVO findAuthGrp(final String groupId) { + return mapper.selectAuthorGroupInfo(groupId); + } + + @Override + public void addAuthGrp(final XitAuthorGroupInfoVO vo) { + // 유효성 확인 + boolean isChangePermission = isCheckUserForCanChange(XitCmmnUtil.getUserInfo().getUniqId(), vo.getAuthorCode()); + if(!isChangePermission) + throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, "자신의 권한보다 상위 권한을 설정 할 수 없습니다."); + + try { + vo.setGroupId(idgenService.getNextStringId()); + } catch (FdlException e) { + throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, e.getMessage()); + } + mapper.insertAuthorGroupInfo(vo); + } + + @Override + public void modifyAuthGrp(final XitAuthorGroupInfoVO vo) { + // 유효성 확인 + boolean isChangePermission = isCheckUserForCanChange(XitCmmnUtil.getUserInfo().getUniqId(), vo.getAuthorCode()); + if(!isChangePermission) + throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, "자신의 권한보다 상위 권한을 설정 할 수 없습니다."); + + mapper.updateAuthorGroupInfo(vo); + } + + @Override + public void removeAuthGrp(final String groupId) { + mapper.deleteAuthorGroupInfo(groupId); + } + + private boolean isCheckUserForCanChange(String uniqId, String trgetAuthorCode) { + //사용자보안설정 조회 + XitUserScrtySetupVO userScrtySetupVO = new XitUserScrtySetupVO(); + userScrtySetupVO.setScrtySetupTrgetId(uniqId); + List listUserScrtySetupVO = userMgtMapper.selectUserScrtySetups(userScrtySetupVO); + String userAuthorCode = XitCmmnUtil.isEmpty(listUserScrtySetupVO)?null:listUserScrtySetupVO.get(0).getAuthorCode(); + + return this.isCheckUserAuthorCodeForCanChange(userAuthorCode, trgetAuthorCode); + } + + + private boolean isCheckUserAuthorCodeForCanChange(String userAuthorCode, String trgetAuthorCode) { + //역할(권한)계층구조 데이터 목록 조회 + List listRoleSclsrtRescueVO = authAuthorMgtMapper.selectRoleSclsrtRescues(null); + //역할(권한)계층구조를 사용하지 않고 있는 경우 true 반환 + if(XitCmmnUtil.isEmpty(listRoleSclsrtRescueVO)) { + log.debug("Do not use a RoleSclsrtRescue Data !!"); + return true; + }else { + //사용자의 권한 정보가 없을 때(비정상적인 루트로 등록한 사용자 계정으로 판단) + if(XitCmmnUtil.isEmpty(userAuthorCode)) { + log.debug("This user is have not UserScrtySetup Data !!"); + return false; + } + } + boolean isExists = false; + //사용자 권한과 매칭되는 역할(권한)계층정보 유무 확인 + for(XitRoleSclsrtRescueVO item : listRoleSclsrtRescueVO) { + if(item.getParntsRole().equals(userAuthorCode)) { + isExists = true; + break; + } + } + //사용자 권한이 최상위 권한이면 true 반환 + if(!isExists) + for(XitRoleSclsrtRescueVO item : listRoleSclsrtRescueVO) { + if(item.getChldrnRole().equals(userAuthorCode)) { + log.debug("This user is Top-Level Author !!"); + return true; + } + } + //사용자의 역할(권한)정보가 없으면 false 반환 + if(!isExists) { + log.debug("This user is have not RoleSclsrtRescue Data !!"); + return false; + } + + + /** + * 상위권한 여부 확인 + * + */ + return this.isHighAuthor(listRoleSclsrtRescueVO, userAuthorCode, trgetAuthorCode)?false:true; + } + + private boolean isHighAuthor(List list, String authorCode, String highAuthorCode) { + boolean result = false; + + for (XitRoleSclsrtRescueVO item : list) { + // 상위 권한으로 확인 되었으면 stop + if (result) + break; + // 권한코드가 일치하지 않으면 skip + if (!item.getParntsRole().equals(authorCode)) + continue; + + if (item.getChldrnRole().equals(highAuthorCode)) { // 상위 권한과 일치하면 + result = true; + } else { // 상위 권한과 일치하지 않으면 재호출 + result = this.isHighAuthor(list, item.getChldrnRole(), highAuthorCode); + } + } + + return result; + } + + + + + + + + + + + + + + + + + + + @Override public List findList(XitAuthGrpMngSearchVO searchVO) { List result = null; try { - result = xitAuthGrpMngMapper.findList(searchVO); + result = mapper.findList(searchVO); } catch (SQLException e) { throw new RuntimeException("사용자그룹관리 목록 조회 FAIL::", e); } @@ -48,7 +198,7 @@ public class AuthGrpMgtServiceImpl implements AuthGrpMgtService { public int findListTotCnt(XitAuthGrpMngSearchVO searchVO) { int result = 0; try { - result = xitAuthGrpMngMapper.findListTotCnt(searchVO); + result = mapper.findListTotCnt(searchVO); } catch (SQLException e) { throw new RuntimeException("사용자그룹관리 목록 총건수 조회 FAIL::", e); } @@ -59,7 +209,7 @@ public class AuthGrpMgtServiceImpl implements AuthGrpMgtService { public XitAuthGrpMngVO findView(XitAuthGrpMngVO vo) { XitAuthGrpMngVO result = null; try { - result = xitAuthGrpMngMapper.findView(vo); + result = mapper.findView(vo); } catch (SQLException e) { throw new RuntimeException("사용자그룹관리 상세정보 조회 FAIL::", e); } @@ -155,11 +305,11 @@ public class AuthGrpMgtServiceImpl implements AuthGrpMgtService { */ private XitAuthorGroupInfoVO convertToCrudVO(XitAuthGrpMngVO vo) { XitAuthorGroupInfoVO authorGroupInfoVO = new XitAuthorGroupInfoVO(); - authorGroupInfoVO.setGroup_id (vo.getGroupId()); //그룹 id - authorGroupInfoVO.setGroup_nm (vo.getGroupNm()); //그룹 명 + authorGroupInfoVO.setGroupId(vo.getGroupId()); //그룹 id + authorGroupInfoVO.setGroupNm(vo.getGroupNm()); //그룹 명 // authorGroupInfoVO.setGroup_creat_de(); //그룹 생성 일 - authorGroupInfoVO.setGroup_dc (vo.getGroupDc()); //그룹 설명 - authorGroupInfoVO.setAuthor_code (vo.getAuthorCode()); //권한 코드 + authorGroupInfoVO.setGroupDc(vo.getGroupDc()); //그룹 설명 + authorGroupInfoVO.setAuthorCode(vo.getAuthorCode()); //권한 코드 return authorGroupInfoVO; } diff --git a/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthAuthorMgtController.java b/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthAuthorMgtController.java index c1c9b147..ecf4c650 100644 --- a/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthAuthorMgtController.java +++ b/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthAuthorMgtController.java @@ -84,7 +84,7 @@ public class AuthAuthorMgtController { public ModelAndView mngAuthAuthorMgtPopup(@ModelAttribute final XitAuthorInfoVO vo){ ModelAndView mav = new ModelAndView(); - if(Checks.isEmpty(vo)){ + if(Checks.isEmpty(vo) || Checks.isEmpty(vo.getAuthorCode())){ mav.addObject("authorInfoVO", new XitAuthorInfoVO()); mav.addObject("pageTitle", "권한 등록"); } else { diff --git a/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthGrpMgtController.java b/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthGrpMgtController.java index a6a3f858..2e33772b 100644 --- a/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthGrpMgtController.java +++ b/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthGrpMgtController.java @@ -18,6 +18,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; @@ -26,6 +27,7 @@ import org.springframework.web.bind.support.SessionStatus; import org.springframework.web.servlet.ModelAndView; 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.XitAuthGrpMngVO; @@ -38,8 +40,10 @@ import kr.xit.framework.core.model.ResultResponse; import kr.xit.framework.core.utils.XitCmmnUtil; import kr.xit.framework.core.validation.XitBeanValidator; import kr.xit.framework.support.mybatis.MybatisUtils; +import kr.xit.framework.support.util.AjaxMessageMapRenderer; import kr.xit.framework.support.util.AjaxUtils; import kr.xit.framework.support.util.Checks; +import kr.xit.framework.support.util.constants.MessageKey; /** * @@ -78,14 +82,14 @@ public class AuthGrpMgtController { } @RequestMapping(value = "/mngAuthGrpMgtPopup") - public ModelAndView mngAuthAuthorMgtPopup(@ModelAttribute final XitAuthGrpMngVO vo){ + public ModelAndView mngAuthAuthorMgtPopup(@ModelAttribute final XitAuthorGroupInfoVO vo){ ModelAndView mav = new ModelAndView(); - if(Checks.isEmpty(vo)){ - mav.addObject("authGrpVO", new XitAuthGrpMngVO()); + if(Checks.isEmpty(vo) || Checks.isEmpty(vo.getGroupId())){ + mav.addObject("groupManage", new XitAuthorGroupInfoVO()); mav.addObject("pageTitle", "권한그룹 등록"); } else { - mav.addObject("authGrpVO", vo); + mav.addObject("groupManage", vo); mav.addObject("pageTitle", "권한그룹 변경"); } mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"mng/auth/mngAuthGrpMgtPopup.popup"); @@ -94,10 +98,41 @@ public class AuthGrpMgtController { @GetMapping(value = "/findAuthGrps") public ModelAndView findAuthAuthors(@RequestParam final Map paraMap) { - //return ResultResponse.of(service.findAuthAuthors(paraMap, MybatisUtils.getPagingInfo(paraMap))); - return null; + return ResultResponse.of(service.findAuthGrps(paraMap, MybatisUtils.getPagingInfo(paraMap))); } + @PostMapping(value = "/addAuthGrp") + //public ModelAndView addAuthAuthor(@ModelAttribute final XitAuthorInfoVO vo, final BindingResult bindingResult){ + public ModelAndView addAuthAuthor(@ModelAttribute final XitAuthorGroupInfoVO vo){ + ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW); + + //TODO : validate + //ValidationError.of("", vo, bindingResult); + service.addAuthGrp(vo); + AjaxMessageMapRenderer.success(mav, MessageKey.CMM_INSERT_SUCCESS); + return mav; + } + + @PostMapping(value = "/modifyAuthGrp") + //public ModelAndView modifyAuthAuthor(@ModelAttribute final XitAuthorInfoVO vo, final BindingResult bindingResult){ + public ModelAndView modifyAuthAuthor(@ModelAttribute final XitAuthorGroupInfoVO vo){ + ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW); + + //TODO : validate + //ValidationError.of("", vo, bindingResult); + service.modifyAuthGrp(vo); + AjaxMessageMapRenderer.success(mav, MessageKey.CMM_UPDATE_SUCCESS); + return mav; + } + + @PostMapping(value = "/removeAuthGrp") + public ModelAndView removeAuthAuthor(final String groupId){ + ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW); + + service.removeAuthGrp(groupId); + AjaxMessageMapRenderer.success(mav, MessageKey.CMM_DELETE_SUCCESS); + return mav; + } diff --git a/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthRoleMgtController.java b/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthRoleMgtController.java index 19439ad6..8343e085 100644 --- a/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthRoleMgtController.java +++ b/src/main/java/kr/xit/framework/biz/mng/auth/web/AuthRoleMgtController.java @@ -77,7 +77,7 @@ public class AuthRoleMgtController { public ModelAndView mngAuthRoleMgtPopup(@ModelAttribute final XitRoleInfoVO vo){ ModelAndView mav = new ModelAndView(); - if(Checks.isEmpty(vo)){ + if(Checks.isEmpty(vo) || Checks.isEmpty(vo.getRoleCode())){ mav.addObject("roleManage", new XitRoleInfoVO()); mav.addObject("pageTitle", "롤 등록"); } else { diff --git a/src/main/java/kr/xit/framework/biz/mng/user/mapper/UserMgtMapper.java b/src/main/java/kr/xit/framework/biz/mng/user/mapper/UserMgtMapper.java index 6aca8a08..4a71eb2e 100644 --- a/src/main/java/kr/xit/framework/biz/mng/user/mapper/UserMgtMapper.java +++ b/src/main/java/kr/xit/framework/biz/mng/user/mapper/UserMgtMapper.java @@ -32,6 +32,7 @@ public interface UserMgtMapper { */ List selectUsers(final Map paraMap, final RowBounds rowBounds); XitUserInfoVO selectUser(final String uniqId); + @SuppressWarnings("MybatisXMapperMethodInspection") Map selectCheckUserInfo(final String userId); int insertUserInfo(final XitUserInfoVO vo); int updateUserInfo(final XitUserInfoVO vo); @@ -42,11 +43,12 @@ public interface UserMgtMapper { - Map selectAuthorGroupInfo(final Map map); + //Map selectAuthorGroupInfo(final Map map); + List selectUserScrtySetups(final XitUserScrtySetupVO vo); XitUserScrtySetupVO selectUserScrtySetup(final String scrtySetupTrgetId); int insertUserScrtySetup(final XitUserScrtySetupVO vo); int updateUserScrtySetup(final XitUserScrtySetupVO vo); diff --git a/src/main/java/kr/xit/framework/biz/mng/user/service/UserMgtService.java b/src/main/java/kr/xit/framework/biz/mng/user/service/UserMgtService.java index a7f88dd7..a9e0892b 100644 --- a/src/main/java/kr/xit/framework/biz/mng/user/service/UserMgtService.java +++ b/src/main/java/kr/xit/framework/biz/mng/user/service/UserMgtService.java @@ -38,8 +38,6 @@ public interface UserMgtService { String getDefaultAuthorCode(final String groupId); - Map findAuthorGroupInfo(final String groupId); - int addUserScrtySetup(final XitUserScrtySetupVO vo); int addXitUserEtcOption(final XitUserEtcOptionVO vo); diff --git a/src/main/java/kr/xit/framework/biz/mng/user/service/impl/UserMgtServiceImpl.java b/src/main/java/kr/xit/framework/biz/mng/user/service/impl/UserMgtServiceImpl.java index a7a0b13b..857cdf37 100644 --- a/src/main/java/kr/xit/framework/biz/mng/user/service/impl/UserMgtServiceImpl.java +++ b/src/main/java/kr/xit/framework/biz/mng/user/service/impl/UserMgtServiceImpl.java @@ -13,11 +13,13 @@ import org.springframework.stereotype.Service; import egovframework.rte.fdl.cmmn.exception.FdlException; import egovframework.rte.fdl.idgnr.EgovIdGnrService; +import kr.xit.framework.biz.cmm.model.XitAuthorGroupInfoVO; import kr.xit.framework.biz.cmm.model.XitUserEtcOptionVO; import kr.xit.framework.biz.cmm.model.XitUserInfoVO; import kr.xit.framework.biz.cmm.model.XitUserScrtySetupVO; import kr.xit.framework.biz.cmm.service.XitFrameCrudService; import kr.xit.framework.biz.cmm.model.XitLoginVO; +import kr.xit.framework.biz.mng.auth.mapper.AuthGrpMgtMapper; import kr.xit.framework.biz.mng.user.mapper.UserMgtMapper; import kr.xit.framework.biz.mng.user.model.XitUserRegMngVO; import kr.xit.framework.biz.mng.user.service.UserMgtService; @@ -33,6 +35,8 @@ public class UserMgtServiceImpl implements UserMgtService { @Resource private UserMgtMapper mapper; @Resource + private AuthGrpMgtMapper authGrpMgtMapper; + @Resource private XitFrameCrudService xitFrameCrudService; @Resource private XitMessageSource xitMessageSource; @@ -165,26 +169,18 @@ public class UserMgtServiceImpl implements UserMgtService { public String getDefaultAuthorCode(final String groupId) { if(Checks.isEmpty(groupId)) return "ROLE_USER"; - Map authMap = findAuthorGroupInfo(groupId); + XitAuthorGroupInfoVO vo = authGrpMgtMapper.selectAuthorGroupInfo(groupId); // 권한 설정 - if (Checks.isEmpty(authMap)) + if (Checks.isEmpty(vo)) return "ROLE_USER"; else { - if (Checks.isEmpty(authMap.get("author_code"))) + if (Checks.isEmpty(vo.getAuthorCode())) return "ROLE_USER"; else - return String.valueOf(authMap.get("author_code")); + return vo.getAuthorCode(); } } - @Override - public Map findAuthorGroupInfo(final String groupId) { - if(Checks.isEmpty(groupId)) throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, "그룹ID(은)는 필수조건 입니다"); - Map map = new HashMap<>(); - map.put("groupId", groupId); - return mapper.selectAuthorGroupInfo(map); - } - @Override public int addUserScrtySetup(final XitUserScrtySetupVO vo) { diff --git a/src/main/resources/sqlmapper/framework/cache/cachecode-mysql-mapper.xml b/src/main/resources/sqlmapper/framework/cache/cachecode-mysql-mapper.xml index f4185696..b5291d5e 100644 --- a/src/main/resources/sqlmapper/framework/cache/cachecode-mysql-mapper.xml +++ b/src/main/resources/sqlmapper/framework/cache/cachecode-mysql-mapper.xml @@ -42,6 +42,7 @@ SELECT author_code AS code , author_nm AS code_nm FROM xit_author_info + 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 831ad906..6c471b12 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 @@ -114,8 +114,8 @@ - + /* auth-author-mysql-mapper|selectRoleSclsrtRescues-역할계층 조회|julim */ SELECT parnts_role , chldrn_role FROM xit_role_sclsrt_rescue @@ -129,8 +129,8 @@ - + /* auth-author-mysql-mapper|selectRoleSclsrtRescue-역할계층 정보 조회|julim */ SELECT parnts_role , chldrn_role FROM xit_role_sclsrt_rescue diff --git a/src/main/resources/sqlmapper/framework/mng/auth/auth-grp-mysql-mapper.xml b/src/main/resources/sqlmapper/framework/mng/auth/auth-grp-mysql-mapper.xml index 39b980ca..a6efd813 100644 --- a/src/main/resources/sqlmapper/framework/mng/auth/auth-grp-mysql-mapper.xml +++ b/src/main/resources/sqlmapper/framework/mng/auth/auth-grp-mysql-mapper.xml @@ -3,71 +3,68 @@ - + /* auth-grp-mysql-mapper|selectAuthorGroupInfos-권한그룹 목록 조회|julim */ + SELECT agi.group_id + , agi.group_nm + , agi.group_dc + , agi.author_code + , xai.author_nm + , agi.group_creat_de + FROM xit_author_group_info agi + LEFT OUTER JOIN xit_author_info xai + ON agi.author_code = xai.author_code + + + AND agi.group_nm = #{groupNm} + + - + /* auth-grp-mysql-mapper|selectAuthorGroupInfo-권한그룹 정보 조회|julim */ + SELECT group_id + , group_nm + , group_dc + , author_code + , group_creat_de + FROM xit_author_group_info + WHERE group_id = #{groupId} - - /** addXitAuthorGroupInfo */ - /** 권한그룹정보 등록 */ - INSERT INTO XIT_AUTHOR_GROUP_INFO( - GROUP_ID - ,GROUP_NM - ,GROUP_CREAT_DE - ,GROUP_DC - ,AUTHOR_CODE + + + /* auth-grp-mysql-mapper|insertAuthorGroupInfo-권한그룹 등록|julim */ + INSERT INTO xit_author_group_info( + group_id + , group_nm + , group_dc + , author_code + , group_creat_de )VALUES( - #{group_id } - ,#{group_nm } - ,DATE_FORMAT(NOW(), '%Y%m%d%H%i%s') - ,#{group_dc } - ,#{author_code } + #{groupId} + , #{groupNm} + , #{groupDc} + , #{authorCode} + , DATE_FORMAT(NOW(), '%Y%m%d%H%i%s') ) - - /** modifyXitAuthorGroupInfo */ - /** 권한그룹정보 수정 */ - UPDATE XIT_AUTHOR_GROUP_INFO - SET - GROUP_CREAT_DE = GROUP_CREAT_DE - ,GROUP_NM = #{group_nm } - ,GROUP_DC = #{group_dc } - ,AUTHOR_CODE = #{author_code} - WHERE 1=1 - AND GROUP_ID = #{group_id} + + + /* auth-grp-mysql-mapper|updateAuthorGroupInfo-권한그룹 정보 변경|julim */ + UPDATE xit_author_group_info + SET group_nm = IF(group_nm = #{groupNm}, group_nm, #{groupNm}) + , group_dc = IF(group_dc = #{groupDc}, group_dc, #{groupDc}) + , author_code = IF(author_code = #{authorCode}, author_code, #{authorCode}) + WHERE group_id = #{groupId} - - /** removeXitAuthorGroupInfo */ - /** 권한그룹정보 삭제 */ - DELETE FROM XIT_AUTHOR_GROUP_INFO - WHERE 1=1 - AND GROUP_ID = #{group_id} + + + /* auth-grp-mysql-mapper|deleteAuthorGroupInfo-권한그룹 삭제|julim */ + DELETE + FROM xit_author_group_info + WHERE group_id = #{groupId} @@ -77,6 +74,17 @@ + + + + + + + + + + + SELECT LIST.* FROM( diff --git a/src/main/resources/sqlmapper/framework/mng/usr/user-mysql-mapper.xml b/src/main/resources/sqlmapper/framework/mng/usr/user-mysql-mapper.xml index 96b93194..c40d09cb 100644 --- a/src/main/resources/sqlmapper/framework/mng/usr/user-mysql-mapper.xml +++ b/src/main/resources/sqlmapper/framework/mng/usr/user-mysql-mapper.xml @@ -205,13 +205,14 @@ - + /* user-mysql-mapper|delectEntrprsMber-기업사용자정보 삭제|julim */ DELETE FROM xit_entrprs_mber WHERE entrprs_mber_id = #{userId} + @@ -467,116 +468,5 @@ - - - - - /** modifyXitUserInfoChangeDtls */ - /** 사용자정보변경내역 수정 */ - UPDATE XIT_USER_INFO_CHANGE_DTLS - SET - CHANGE_DE = DATE_FORMAT(NOW(), '%Y%m%d%H%i%s') - ,ORGNZT_ID = #{orgnzt_id } - ,GROUP_ID = #{group_id } - ,EMPL_NO = #{empl_no } - ,SEXDSTN_CODE = #{sexdstn_code } - ,BRTHDY = #{brthdy } - ,FXNUM = #{fxnum } - ,HOUSE_ADRES = #{house_adres } - ,HOUSE_END_TELNO = #{house_end_telno } - ,AREA_NO = #{area_no } - ,DETAIL_ADRES = #{detail_adres } - ,ZIP = #{zip } - ,OFFM_TELNO = #{offm_telno } - ,MBTLNUM = #{mbtlnum } - ,EMAIL_ADRES = #{email_adres } - ,HOUSE_MIDDLE_TELNO = #{house_middle_telno} - ,PSTINST_CODE = #{pstinst_code } - ,USER_STTUS_CODE = #{user_sttus_code } - ,ESNTL_ID = #{esntl_id } - WHERE 1=1 - AND USER_ID = #{user_id } - AND CHANGE_DE = #{change_de} - - - /** removeXitUserInfoChangeDtls */ - /** 사용자정보변경내역 삭제 */ - DELETE FROM XIT_USER_INFO_CHANGE_DTLS - WHERE 1=1 - AND USER_ID = #{user_id } - AND CHANGE_DE = #{change_de} - diff --git a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthAuthorMgtForm.jsp b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthAuthorMgtForm.jsp index cd520e64..35ebb530 100644 --- a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthAuthorMgtForm.jsp +++ b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthAuthorMgtForm.jsp @@ -153,7 +153,10 @@ name: 'authorCreatDe', width: 120, sortable: false, - align: 'center' + align: 'center', + formatter({value}) { + return setDateTimeFmt(value); // + } }, { header: '롤정보', diff --git a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthGrpMgtForm.jsp b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthGrpMgtForm.jsp index 23661f40..092c57e3 100644 --- a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthGrpMgtForm.jsp +++ b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/auth/mngAuthGrpMgtForm.jsp @@ -40,6 +40,19 @@