Compare commits

..

2 Commits

9 changed files with 150 additions and 159 deletions

View File

@ -1,11 +1,16 @@
package com.dbnt.faisp.authMgt;
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.ApprovalConfigRepository;
import com.dbnt.faisp.userInfo.model.UserInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
@ -15,4 +20,11 @@ public class AuthMgtService {
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;
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 java.util.List;
@ -8,4 +10,7 @@ import java.util.List;
@Mapper
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")
private String accessAuth;
@Transient
private String cat1Cd;
@Transient
private String cat2Cd;
@Transient
private String cat3Cd;
@Embeddable
@Data
@NoArgsConstructor

View File

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

View File

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

View File

@ -4,5 +4,26 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<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>

View File

@ -1,11 +1,8 @@
<!DOCTYPE html>
<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">
<table class="table table-hover">
<form id="accessEditForm" action="#" method="post">
<table class="table table-hover text-center">
<thead>
<tr>
<th>대분류</th>
@ -17,43 +14,42 @@
</tr>
</thead>
<tbody>
<tr>
<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>
<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 th:each="accessConfig:${userInfo.accessConfigList}">
<th:block th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.itemCd eq accessConfig.cat1Cd}">
<td th:text="${commonCode.itemValue}"></td>
</th:block>
</th:block>
<th:block th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.itemCd eq accessConfig.cat2Cd}">
<td th:text="${commonCode.itemValue}"></td>
</th:block>
</th:block>
<th:block th:if="${#strings.isEmpty(accessConfig.cat3Cd)}">
<td></td>
</th:block>
<th:block th:unless="${#strings.isEmpty(accessConfig.cat3Cd)}" th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.itemCd eq accessConfig.cat3Cd}">
<td th:text="${commonCode.itemValue}"></td>
</th:block>
</th:block>
<td>
<input type="radio" th:name="${#strings.concat('accessAuth',accessConfig.menuKey)}" th:checked="${'ACC003' eq accessConfig.accessAuth}" value="ACC003">
</td>
<td>
<input type="radio" th:name="${#strings.concat('accessAuth',accessConfig.menuKey)}" th:checked="${'ACC002' eq accessConfig.accessAuth}" value="ACC002">
</td>
<td>
<input type="radio" th:name="${#strings.concat('accessAuth',accessConfig.menuKey)}" th:checked="${'ACC001' eq accessConfig.accessAuth}" value="ACC001">
</td>
</tr>
</tbody>
</table>
</form>
</div>
<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>
<tr>
<th>대분류</th>
@ -65,85 +61,29 @@
</tr>
</thead>
<tbody>
<tr>
<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>
<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 th:each="approvalConfig:${userInfo.approvalConfigList}">
<th:block th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.itemCd eq approvalConfig.cat1Cd}">
<td th:text="${commonCode.itemValue}">.</td>
</th:block>
</th:block>
<th:block th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.itemCd eq approvalConfig.cat2Cd}">
<td th:text="${commonCode.itemValue}">.</td>
</th:block>
</th:block>
<th:block th:each="commonCode:${session.commonCodeList}">
<th:block th:if="${commonCode.itemCd eq approvalConfig.cat3Cd}">
<td th:text="${commonCode.itemValue}">.</td>
</th:block>
</th:block>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</form>
</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>

View File

@ -134,7 +134,7 @@
</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-dialog modal-lg">
<div class="modal-dialog modal-lg modal-dialog-scrollable">
<div class="modal-content" id="authEditModalContent">
<div class="modal-header">
<h5 class="modal-title" id="menuEditModalLabel">권한 편집</h5>

View File

@ -19,7 +19,7 @@
<div class="col-auto">
<select class="form-select" name="rowCnt" id="rowCnt">
<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>
</select>
</div>
@ -29,8 +29,8 @@
<select class="form-select form-select-sm" 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="${searchParams.cat1Cd==commonCode.itemCd}"></option>
<th:block th:if="${commonCode.categoryCd eq 'CAT1'}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${searchParams.cat1Cd eq commonCode.itemCd}"></option>
</th:block>
</th:block>
</select>
@ -39,8 +39,8 @@
<select class="form-select form-select-sm" 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="${searchParams.cat2Cd==commonCode.itemCd}"></option>
<th:block th:if="${commonCode.categoryCd eq 'CAT2'}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${searchParams.cat2Cd eq commonCode.itemCd}"></option>
</th:block>
</th:block>
</select>
@ -49,8 +49,8 @@
<select class="form-select form-select-sm" 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="${searchParams.cat3Cd==commonCode.itemCd}"></option>
<th:block th:if="${commonCode.categoryCd eq 'CAT3'}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${searchParams.cat3Cd eq commonCode.itemCd}"></option>
</th:block>
</th:block>
</select>
@ -89,17 +89,17 @@
<input type="checkbox" class="menuCheckBox" th:value="${menuMgt.menuKey}">
</td>
<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>
</th:block>
</th:block>
<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>
</th:block>
</th:block>
<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>
</th:block>
</th:block>
@ -126,7 +126,7 @@
</li>
</th:block>
<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>
</li>
</th:block>