권한설정 작업중.

강석 최 2022-08-29 13:13:35 +09:00
parent 24fa44aada
commit 37c0ca54df
9 changed files with 150 additions and 159 deletions

View File

@ -1,11 +1,16 @@
package com.dbnt.faisp.authMgt; package com.dbnt.faisp.authMgt;
import com.dbnt.faisp.authMgt.mapper.AuthMgtMapper; import com.dbnt.faisp.authMgt.mapper.AuthMgtMapper;
import com.dbnt.faisp.authMgt.model.AccessConfig;
import com.dbnt.faisp.authMgt.model.ApprovalConfig;
import com.dbnt.faisp.authMgt.repository.AccessConfigRepository; import com.dbnt.faisp.authMgt.repository.AccessConfigRepository;
import com.dbnt.faisp.authMgt.repository.ApprovalConfigRepository; import com.dbnt.faisp.authMgt.repository.ApprovalConfigRepository;
import com.dbnt.faisp.userInfo.model.UserInfo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@ -15,4 +20,11 @@ public class AuthMgtService {
private final ApprovalConfigRepository approvalConfigRepository; private final ApprovalConfigRepository approvalConfigRepository;
public List<AccessConfig> selectAccessConfigList(UserInfo userInfo) {
return authMgtMapper.selectAccessConfigList(userInfo);
}
public List<ApprovalConfig> selectApprovalConfigList(UserInfo userInfo) {
return authMgtMapper.selectApprovalConfigList(userInfo);
}
} }

View File

@ -1,6 +1,8 @@
package com.dbnt.faisp.authMgt.mapper; package com.dbnt.faisp.authMgt.mapper;
import com.dbnt.faisp.authMgt.model.AccessConfig; import com.dbnt.faisp.authMgt.model.AccessConfig;
import com.dbnt.faisp.authMgt.model.ApprovalConfig;
import com.dbnt.faisp.userInfo.model.UserInfo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
@ -8,4 +10,7 @@ import java.util.List;
@Mapper @Mapper
public interface AuthMgtMapper { public interface AuthMgtMapper {
List<AccessConfig> selectAccessConfigList(UserInfo userInfo);
List<ApprovalConfig> selectApprovalConfigList(UserInfo userInfo);
} }

View File

@ -25,6 +25,13 @@ public class AccessConfig{
@Column(name = "access_auth") @Column(name = "access_auth")
private String accessAuth; private String accessAuth;
@Transient
private String cat1Cd;
@Transient
private String cat2Cd;
@Transient
private String cat3Cd;
@Embeddable @Embeddable
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@ -25,6 +25,13 @@ public class ApprovalConfig {
@Column(name = "approval_auth") @Column(name = "approval_auth")
private String approvalAuth; private String approvalAuth;
@Transient
private String cat1Cd;
@Transient
private String cat2Cd;
@Transient
private String cat3Cd;
@Embeddable @Embeddable
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@ -1,15 +1,13 @@
package com.dbnt.faisp.controller; package com.dbnt.faisp.controller;
import com.dbnt.faisp.authMgt.AuthMgtService;
import com.dbnt.faisp.menuMgt.MenuMgtService; import com.dbnt.faisp.menuMgt.MenuMgtService;
import com.dbnt.faisp.menuMgt.model.MenuMgt;
import com.dbnt.faisp.userInfo.UserInfoService; import com.dbnt.faisp.userInfo.UserInfoService;
import com.dbnt.faisp.userInfo.model.UserInfo; import com.dbnt.faisp.userInfo.model.UserInfo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import java.util.List;
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@ -18,10 +16,11 @@ public class AuthMgtController {
private final MenuMgtService menuMgtService; private final MenuMgtService menuMgtService;
private final UserInfoService userInfoService; private final UserInfoService userInfoService;
private final AuthMgtService authMgtService;
@GetMapping("/authMgtPage") @GetMapping("/authMgtPage")
public ModelAndView menuMgtPage(UserInfo userInfo) { public ModelAndView menuMgtPage(UserInfo userInfo) {
ModelAndView mav = new ModelAndView("/adminPage/authMgt/authMgt"); ModelAndView mav = new ModelAndView("adminPage/authMgt/authMgt");
userInfo.setQueryInfo(); userInfo.setQueryInfo();
mav.addObject("userInfoList", userInfoService.selectUserInfoList(userInfo)); mav.addObject("userInfoList", userInfoService.selectUserInfoList(userInfo));
userInfo.setContentCnt(userInfoService.selectUserInfoListCnt(userInfo)); userInfo.setContentCnt(userInfoService.selectUserInfoListCnt(userInfo));
@ -32,10 +31,10 @@ public class AuthMgtController {
@GetMapping("/authEditModal") @GetMapping("/authEditModal")
public ModelAndView menuEditModal(UserInfo userInfo){ public ModelAndView menuEditModal(UserInfo userInfo){
ModelAndView mav = new ModelAndView("/adminPage/authMgt/authEditModal"); ModelAndView mav = new ModelAndView("adminPage/authMgt/authEditModal");
userInfo.setAccessConfigList(null);// 기능구현 예정 userInfo.setAccessConfigList(authMgtService.selectAccessConfigList(userInfo));
userInfo.setApprovalConfigList(null);// 기능구현 예정 userInfo.setApprovalConfigList(authMgtService.selectApprovalConfigList(userInfo));
mav.addObject(userInfo); mav.addObject("userInfo", userInfo);
return mav; return mav;
} }

View File

@ -4,5 +4,26 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dbnt.faisp.authMgt.mapper.AuthMgtMapper"> <mapper namespace="com.dbnt.faisp.authMgt.mapper.AuthMgtMapper">
<select id="selectAccessConfigList" resultType="AccessConfig" parameterType="UserInfo">
select a.menu_key,
a.cat1_cd as cat1Cd,
a.cat2_cd as cat2Cd,
a.cat3_cd as cat3Cd,
b.access_auth
from menu_mgt a
left outer join access_config b
on a.menu_key = b.menu_key and b.user_seq = #{userSeq}
</select>
<select id="selectApprovalConfigList" resultType="ApprovalConfig" parameterType="UserInfo">
select a.menu_key,
a.cat1_cd as cat1Cd,
a.cat2_cd as cat2Cd,
a.cat3_cd as cat3Cd,
b.approval_auth
from menu_mgt a
left outer join approval_config b
on a.menu_key = b.menu_key and b.user_seq = #{userSeq}
where a.approval_chk = 'T'
</select>
</mapper> </mapper>

View File

@ -1,11 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org"> <html lang="ko" xmlns:th="http://www.thymeleaf.org">
<!--<form id="authEditForm" action="#" method="post">-->
<!--<th:block th:if="${menuMgt.menuKey ne null}">
<input type="hidden" name="menuKey" id="menuKey" th:value="${menuMgt.menuKey}">
</th:block>-->
<div class="tab-pane fade show active" id="accessTabPanel" role="tabpanel" aria-labelledby="accessTab" tabindex="0"> <div class="tab-pane fade show active" id="accessTabPanel" role="tabpanel" aria-labelledby="accessTab" tabindex="0">
<table class="table table-hover"> <form id="accessEditForm" action="#" method="post">
<table class="table table-hover text-center">
<thead> <thead>
<tr> <tr>
<th>대분류</th> <th>대분류</th>
@ -17,43 +14,42 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr th:each="accessConfig:${userInfo.accessConfigList}">
<td>.</td> <th:block th:each="commonCode:${session.commonCodeList}">
<td>.</td> <th:block th:if="${commonCode.itemCd eq accessConfig.cat1Cd}">
<td>.</td> <td th:text="${commonCode.itemValue}"></td>
<td>.</td> </th:block>
<td>.</td> </th:block>
<td>.</td> <th:block th:each="commonCode:${session.commonCodeList}">
</tr> <th:block th:if="${commonCode.itemCd eq accessConfig.cat2Cd}">
<tr> <td th:text="${commonCode.itemValue}"></td>
<td>.</td> </th:block>
<td>.</td> </th:block>
<td>.</td> <th:block th:if="${#strings.isEmpty(accessConfig.cat3Cd)}">
<td>.</td> <td></td>
<td>.</td> </th:block>
<td>.</td> <th:block th:unless="${#strings.isEmpty(accessConfig.cat3Cd)}" th:each="commonCode:${session.commonCodeList}">
</tr> <th:block th:if="${commonCode.itemCd eq accessConfig.cat3Cd}">
<tr> <td th:text="${commonCode.itemValue}"></td>
<td>.</td> </th:block>
<td>.</td> </th:block>
<td>.</td> <td>
<td>.</td> <input type="radio" th:name="${#strings.concat('accessAuth',accessConfig.menuKey)}" th:checked="${'ACC003' eq accessConfig.accessAuth}" value="ACC003">
<td>.</td> </td>
<td>.</td> <td>
</tr> <input type="radio" th:name="${#strings.concat('accessAuth',accessConfig.menuKey)}" th:checked="${'ACC002' eq accessConfig.accessAuth}" value="ACC002">
<tr> </td>
<td>.</td> <td>
<td>.</td> <input type="radio" th:name="${#strings.concat('accessAuth',accessConfig.menuKey)}" th:checked="${'ACC001' eq accessConfig.accessAuth}" value="ACC001">
<td>.</td> </td>
<td>.</td>
<td>.</td>
<td>.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</form>
</div> </div>
<div class="tab-pane fade" id="approvalTabPanel" role="tabpanel" aria-labelledby="approvalTab" tabindex="0"> <div class="tab-pane fade" id="approvalTabPanel" role="tabpanel" aria-labelledby="approvalTab" tabindex="0">
<table class="table table-hover"> <form id="approvalEditForm" action="#" method="post">
<table class="table table-hover text-center">
<thead> <thead>
<tr> <tr>
<th>대분류</th> <th>대분류</th>
@ -65,85 +61,29 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr th:each="approvalConfig:${userInfo.approvalConfigList}">
<td>.</td> <th:block th:each="commonCode:${session.commonCodeList}">
<td>.</td> <th:block th:if="${commonCode.itemCd eq approvalConfig.cat1Cd}">
<td>.</td> <td th:text="${commonCode.itemValue}">.</td>
<td>.</td> </th:block>
<td>.</td> </th:block>
<td>.</td> <th:block th:each="commonCode:${session.commonCodeList}">
</tr> <th:block th:if="${commonCode.itemCd eq approvalConfig.cat2Cd}">
<tr> <td th:text="${commonCode.itemValue}">.</td>
<td>.</td> </th:block>
<td>.</td> </th:block>
<td>.</td> <th:block th:each="commonCode:${session.commonCodeList}">
<td>.</td> <th:block th:if="${commonCode.itemCd eq approvalConfig.cat3Cd}">
<td>.</td> <td th:text="${commonCode.itemValue}">.</td>
<td>.</td> </th:block>
</tr> </th:block>
<tr> <td></td>
<td>.</td> <td></td>
<td>.</td> <td></td>
<td>.</td> <td></td>
<td>.</td>
<td>.</td>
<td>.</td>
</tr>
<tr>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</form>
</div> </div>
<!--<div class="row mb-3">
<label for="cat1Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">대분류</label>
<div class="col-sm-6">
<select class="form-select form-select-sm" id="cat1Cd" name="cat1Cd">
<option value="">대분류 선택</option>
<th:block th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.categoryCd=='CAT1'}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd==menuMgt.cat1Cd}"></option>
</th:block>
</th:block>
</select>
</div>
</div>
<div class="row mb-3">
<label for="cat2Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">중분류</label>
<div class="col-sm-6">
<select class="form-select form-select-sm" id="cat2Cd" name="cat2Cd">
<option value="">중분류 선택</option>
<th:block th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.categoryCd=='CAT2'}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd==menuMgt.cat2Cd}"></option>
</th:block>
</th:block>
</select>
</div>
</div>
<div class="row mb-3">
<label for="cat3Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">소분류</label>
<div class="col-sm-6">
<select class="form-select form-select-sm" id="cat3Cd" name="cat3Cd">
<option value="">소분류 선택</option>
<th:block th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.categoryCd=='CAT3'}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd==menuMgt.cat3Cd}"></option>
</th:block>
</th:block>
</select>
</div>
</div>
<div class="row mb-3">
<label for="menuUrl" class="col-sm-4 col-form-label col-form-label-sm text-center">URL</label>
<div class="col-sm-6">
<input type="text" class="form-control form-control-sm" id="menuUrl" name="menuUrl" th:value="${menuMgt.menuUrl}">
</div>
</div>-->
<!--</form>-->
</html> </html>

View File

@ -134,7 +134,7 @@
</main> </main>
<div class="modal fade" id="authEditModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="authEditModalLabel" aria-hidden="true"> <div class="modal fade" id="authEditModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="authEditModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg modal-dialog-scrollable">
<div class="modal-content" id="authEditModalContent"> <div class="modal-content" id="authEditModalContent">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="menuEditModalLabel">권한 편집</h5> <h5 class="modal-title" id="menuEditModalLabel">권한 편집</h5>

View File

@ -19,7 +19,7 @@
<div class="col-auto"> <div class="col-auto">
<select class="form-select" name="rowCnt" id="rowCnt"> <select class="form-select" name="rowCnt" id="rowCnt">
<th:block th:each="num : ${#numbers.sequence(1,5)}"> <th:block th:each="num : ${#numbers.sequence(1,5)}">
<option th:value="${num*10}" th:text="${num*10}" th:selected="${searchParams.rowCnt==num*10}"></option> <option th:value="${num*10}" th:text="${num*10}" th:selected="${searchParams.rowCnt eq num*10}"></option>
</th:block> </th:block>
</select> </select>
</div> </div>
@ -29,8 +29,8 @@
<select class="form-select form-select-sm" name="cat1Cd"> <select class="form-select form-select-sm" name="cat1Cd">
<option value="">대분류 선택</option> <option value="">대분류 선택</option>
<th:block th:each="commonCode:${session.commonCodeList}"> <th:block th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.categoryCd=='CAT1'}"> <th:block th:if="${commonCode.categoryCd eq 'CAT1'}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${searchParams.cat1Cd==commonCode.itemCd}"></option> <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${searchParams.cat1Cd eq commonCode.itemCd}"></option>
</th:block> </th:block>
</th:block> </th:block>
</select> </select>
@ -39,8 +39,8 @@
<select class="form-select form-select-sm" name="cat2Cd"> <select class="form-select form-select-sm" name="cat2Cd">
<option value="">중분류 선택</option> <option value="">중분류 선택</option>
<th:block th:each="commonCode:${session.commonCodeList}"> <th:block th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.categoryCd=='CAT2'}"> <th:block th:if="${commonCode.categoryCd eq 'CAT2'}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${searchParams.cat2Cd==commonCode.itemCd}"></option> <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${searchParams.cat2Cd eq commonCode.itemCd}"></option>
</th:block> </th:block>
</th:block> </th:block>
</select> </select>
@ -49,8 +49,8 @@
<select class="form-select form-select-sm" name="cat3Cd"> <select class="form-select form-select-sm" name="cat3Cd">
<option value="">소분류 선택</option> <option value="">소분류 선택</option>
<th:block th:each="commonCode:${session.commonCodeList}"> <th:block th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.categoryCd=='CAT3'}"> <th:block th:if="${commonCode.categoryCd eq 'CAT3'}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${searchParams.cat3Cd==commonCode.itemCd}"></option> <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${searchParams.cat3Cd eq commonCode.itemCd}"></option>
</th:block> </th:block>
</th:block> </th:block>
</select> </select>
@ -89,17 +89,17 @@
<input type="checkbox" class="menuCheckBox" th:value="${menuMgt.menuKey}"> <input type="checkbox" class="menuCheckBox" th:value="${menuMgt.menuKey}">
</td> </td>
<th:block th:if="${menuMgt.cat1RowspanCnt ne 0}" th:each="commonCode:${session.commonCodeList}"> <th:block th:if="${menuMgt.cat1RowspanCnt ne 0}" th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.itemCd == menuMgt.cat1Cd}"> <th:block th:if="${commonCode.itemCd eq menuMgt.cat1Cd}">
<td th:text="${commonCode.itemValue}" th:rowspan="${menuMgt.cat1RowspanCnt}"></td> <td th:text="${commonCode.itemValue}" th:rowspan="${menuMgt.cat1RowspanCnt}"></td>
</th:block> </th:block>
</th:block> </th:block>
<th:block th:if="${menuMgt.cat2RowspanCnt ne 0}" th:each="commonCode:${session.commonCodeList}"> <th:block th:if="${menuMgt.cat2RowspanCnt ne 0}" th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.itemCd == menuMgt.cat2Cd}"> <th:block th:if="${commonCode.itemCd eq menuMgt.cat2Cd}">
<td th:text="${commonCode.itemValue}" th:rowspan="${menuMgt.cat2RowspanCnt}"></td> <td th:text="${commonCode.itemValue}" th:rowspan="${menuMgt.cat2RowspanCnt}"></td>
</th:block> </th:block>
</th:block> </th:block>
<th:block th:each="commonCode:${session.commonCodeList}"> <th:block th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.itemCd == menuMgt.cat3Cd}"> <th:block th:if="${commonCode.itemCd eq menuMgt.cat3Cd}">
<td th:text="${commonCode.itemValue}"></td> <td th:text="${commonCode.itemValue}"></td>
</th:block> </th:block>
</th:block> </th:block>
@ -126,7 +126,7 @@
</li> </li>
</th:block> </th:block>
<th:block th:each="num : ${#numbers.sequence(searchParams.startNum, searchParams.endNum)}"> <th:block th:each="num : ${#numbers.sequence(searchParams.startNum, searchParams.endNum)}">
<li class="page-item" th:data-pageindex="${num}" th:classappend="${searchParams.pageIndex==num?'active':''}"> <li class="page-item" th:data-pageindex="${num}" th:classappend="${searchParams.pageIndex eq num?'active':''}">
<a class="page-link" href="#" th:text="${num}"></a> <a class="page-link" href="#" th:text="${num}"></a>
</li> </li>
</th:block> </th:block>