권한설정 페이지 작업중

강석 최 2022-08-24 18:17:28 +09:00
parent 278c16306e
commit 45155c4ec6
10 changed files with 341 additions and 1 deletions

View File

@ -0,0 +1,18 @@
package com.dbnt.faisp.authMgt;
import com.dbnt.faisp.authMgt.mapper.AuthMgtMapper;
import com.dbnt.faisp.authMgt.repository.AccessConfigRepository;
import com.dbnt.faisp.authMgt.repository.ApprovalConfigRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class AuthMgtService {
private final AuthMgtMapper authMgtMapper;
private final AccessConfigRepository accessConfigRepository;
private final ApprovalConfigRepository approvalConfigRepository;
}

View File

@ -0,0 +1,11 @@
package com.dbnt.faisp.authMgt.mapper;
import com.dbnt.faisp.authMgt.model.AccessConfig;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface AuthMgtMapper {
}

View File

@ -0,0 +1,36 @@
package com.dbnt.faisp.authMgt.model;
import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "access_config")
@IdClass(AccessConfig.AccessConfigId.class)
public class AccessConfig{
@Id
@Column(name = "menu_key")
private Integer menuKey;
@Id
@Column(name = "user_seq")
private Integer userSeq;
@Column(name = "access_auth")
private String accessAuth;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class AccessConfigId implements Serializable {
private Integer menuKey;
private Integer userSeq;
}
}

View File

@ -0,0 +1,37 @@
package com.dbnt.faisp.authMgt.model;
import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "approval_config")
@IdClass(ApprovalConfig.ApprovalConfigId.class)
public class ApprovalConfig {
@Id
@Column(name = "menu_key")
private Integer menuKey;
@Id
@Column(name = "user_seq")
private Integer userSeq;
@Column(name = "approval_auth")
private String approvalAuth;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class ApprovalConfigId implements Serializable {
private Integer menuKey;
private Integer userSeq;
}
}

View File

@ -0,0 +1,9 @@
package com.dbnt.faisp.authMgt.repository;
import com.dbnt.faisp.authMgt.model.AccessConfig;
import org.springframework.data.jpa.repository.JpaRepository;
public interface AccessConfigRepository extends JpaRepository<AccessConfig, AccessConfig.AccessConfigId> {
}

View File

@ -0,0 +1,9 @@
package com.dbnt.faisp.authMgt.repository;
import com.dbnt.faisp.authMgt.model.ApprovalConfig;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ApprovalConfigRepository extends JpaRepository<ApprovalConfig, ApprovalConfig.ApprovalConfigId> {
}

View File

@ -0,0 +1,49 @@
package com.dbnt.faisp.controller;
import com.dbnt.faisp.menuMgt.MenuMgtService;
import com.dbnt.faisp.menuMgt.model.MenuMgt;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/authMgt")
public class AuthMgtController {
private final MenuMgtService menuMgtService;
@GetMapping("/authMgtPage")
public ModelAndView menuMgtPage(MenuMgt menuMgt) {
ModelAndView mav = new ModelAndView("/adminPage/authMgt/authMgt");
// menuMgt.setQueryInfo();
// mav.addObject("menuMgtList", menuMgtService.selectMenuMgtList(menuMgt));
// menuMgt.setContentCnt(menuMgtService.selectMenuMgtListCnt(menuMgt));
// menuMgt.setPaginationInfo();
// mav.addObject("searchParams", menuMgt);
return mav;
}
/*@GetMapping("/menuEditModal")
public ModelAndView menuEditModal(MenuMgt menuMgt){
ModelAndView mav = new ModelAndView("/adminPage/menuMgt/menuEditModal");
mav.addObject("menuMgt", menuMgt);
return mav;
}
@PostMapping("/saveMenuMgt")
public String saveMenuMgt(MenuMgt menuMgt){
return menuMgtService.saveMenuMgt(menuMgt);
}
@PostMapping("/deleteMenuMgt")
@ResponseBody
public String deleteMenuMgt(@RequestBody List<MenuMgt> menuMgt){
menuMgtService.deleteMenuMgt(menuMgt);
return "";
}*/
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dbnt.faisp.authMgt.mapper.AuthMgtMapper">
</mapper>

View File

@ -0,0 +1,163 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout/layout}">
<th:block layout:fragment="script">
<!--<script type="text/javascript" th:src="@{/js/menuMgt/menuMgt.js}"></script>-->
</th:block>
<div layout:fragment="content">
<main class="pt-3">
<h4>권한 설정</h4>
<!--<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<div class="row mx-0">
<div class="col-12 card text-center">
<div class="card-body">
<form method="get" th:action="@{/menuMgt/menuMgtPage}">
<input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}">
<div class="row justify-content-between pe-3 py-1">
<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>
</th:block>
</select>
</div>
<div class="col-auto">
<div class="row justify-content-end">
<div class="col-auto">
<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:block>
</select>
</div>
<div class="col-auto">
<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:block>
</select>
</div>
<div class="col-auto">
<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:block>
</select>
</div>
<div class="col-auto">
<input type="text" class="form-control form-control-sm" name="menuUrl" placeholder="url" th:value="${searchParams.menuUrl}">
</div>
<input type="submit" class="btn btn-sm btn-primary col-auto" id="searchBtn" value="검색">
</div>
</div>
</div>
</form>
<div class="row justify-content-start">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<table class="table table-striped">
<thead>
<tr>
<th><input type="checkbox" class="allChk"></th>
<th>대분류</th>
<th>중분류</th>
<th>소분류</th>
<th>url</th>
</tr>
</thead>
<tbody>
<tr class="menuTr" th:each="menuMgt:${menuMgtList}">
<input type="hidden" class="menuKey" th:value="${menuMgt.menuKey}">
<input type="hidden" class="cat1Cd" th:value="${menuMgt.cat1Cd}">
<input type="hidden" class="cat2Cd" th:value="${menuMgt.cat2Cd}">
<input type="hidden" class="cat3Cd" th:value="${menuMgt.cat3Cd}">
<input type="hidden" class="menuUrl" th:value="${menuMgt.menuUrl}">
<td>
<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}">
<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}">
<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}">
<td th:text="${commonCode.itemValue}"></td>
</th:block>
</th:block>
<th:block th:if="${#strings.isEmpty(menuMgt.cat3Cd)}">
<td></td>
</th:block>
<td th:text="${menuMgt.menuUrl}"></td>
</tr>
</tbody>
</table>
</div>
<div class="row justify-content-between">
<div class="col-auto">
<input type="button" class="btn btn-success" value="선택 삭제" id="deleteCheckedBtn">
</div>
<div class="col-auto">
<nav aria-label="Page navigation">
<ul class="pagination">
<th:block th:if="${searchParams.pageIndex>3}">
<li class="page-item" th:data-pageindex="${(searchParams.pageIndex)-3}">
<a class="page-link" href="#" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</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':''}">
<a class="page-link" href="#" th:text="${num}"></a>
</li>
</th:block>
<th:block th:if="${searchParams.maxNum>searchParams.endNum+2}">
<li class="page-item" th:data-pageindex="${(searchParams.pageIndex)+3}">
<a class="page-link" href="#" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
</th:block>
</ul>
</nav>
</div>
<div class="col-auto">
<input type="button" class="btn btn-success" value="메뉴 추가" id="addMenuBtn">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>-->
</main>
<div class="modal fade" id="menuEditModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="menuEditModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" id="menuEditModalContent">
</div>
</div>
</div>
</div>
</html>

View File

@ -14,7 +14,7 @@
<li class="nav-item"><a href="/codeMgt/codeMgtPage" class="nav-link p-1 link-dark">코드관리</a></li>
<li class="nav-item"><a href="/menuMgt/menuMgtPage" class="nav-link p-1 link-dark">메뉴관리</a></li>
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">외사경찰관리</a></li>
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">권한설정</a></li>
<li class="nav-item"><a href="/authMgt/authMgtPage" class="nav-link p-1 link-dark">권한설정</a></li>
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">사용자로그</a></li>
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">접속설정</a></li>
</ul>