관서설정 페이지 작업중.
parent
29a088eaba
commit
332fc298fc
|
|
@ -41,10 +41,11 @@ public class CodeMgtService{
|
|||
}
|
||||
|
||||
public List<CodeMgt> selectCommonCodeList() {
|
||||
return codeMgtRepository.findByUseChkOrderByItemCdAsc("T");
|
||||
//return codeMgtRepository.findByUseChkOrderByItemCdAsc("T");
|
||||
return codeMgtRepository.findByOrderByItemCdAsc();
|
||||
}
|
||||
|
||||
public List<CodeMgt> selectCodeMgtList(String categoryCd) {
|
||||
return codeMgtRepository.findByCategoryCdOrderByItemCdAsc(categoryCd);
|
||||
return codeMgtRepository.findByCategoryCdAndUseChkOrderByItemCdAsc(categoryCd, "T");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,5 +9,7 @@ import java.util.List;
|
|||
public interface CodeMgtRepository extends JpaRepository<CodeMgt, CodeMgt.CodeMgtId> {
|
||||
|
||||
List<CodeMgt> findByCategoryCdOrderByItemCdAsc(String categoryCd);
|
||||
List<CodeMgt> findByCategoryCdAndUseChkOrderByItemCdAsc(String categoryCd, String useChk);
|
||||
List<CodeMgt> findByUseChkOrderByItemCdAsc(String useChk);
|
||||
List<CodeMgt> findByOrderByItemCdAsc();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@ import lombok.Getter;
|
|||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum Role {
|
||||
ADMIN("ROLE_ADMIN"),
|
||||
USER("ROLE_USER");
|
||||
ADMIN("ROLE_ADMIN"),
|
||||
SUB_ADMIN("ROLE_SUB_ADMIN"),
|
||||
USER("ROLE_USER");
|
||||
|
||||
private String value;
|
||||
private String value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,8 +59,19 @@ public class SecurityConfig{
|
|||
@Bean
|
||||
protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
http.authorizeRequests() // 페이지 권한 설정
|
||||
.antMatchers("/dashboard", "/refreshSession").hasRole(Role.USER.name()) // USER, ADMIN 접근 허용
|
||||
.antMatchers("/codeMgt/**", "/menuMgt/**", "/authMgt/**").hasRole(Role.ADMIN.name()) // ADMIN만 접근 허용
|
||||
.antMatchers(
|
||||
"/dashboard",
|
||||
"/refreshSession"
|
||||
).hasRole(Role.USER.name()) // USER 접근 허용
|
||||
.antMatchers(
|
||||
"/codeMgt/**",
|
||||
"/menuMgt/**",
|
||||
"/authMgt/**",
|
||||
"/organMgt/**"
|
||||
).hasRole(Role.ADMIN.name()) // ADMIN 접근 허용
|
||||
.antMatchers(
|
||||
"/authMgt/**"
|
||||
).hasRole(Role.SUB_ADMIN.name()) // SUB_ADMIN 접근 허용
|
||||
.antMatchers("/login").permitAll() // 로그인 페이지는 권한 없이 접근 허용
|
||||
.and() // 로그인 설정
|
||||
.formLogin() .loginPage("/login") // Custom login form 사용
|
||||
|
|
|
|||
|
|
@ -19,12 +19,11 @@ import java.util.List;
|
|||
@RequestMapping("/authMgt")
|
||||
public class AuthMgtController {
|
||||
|
||||
private final MenuMgtService menuMgtService;
|
||||
private final UserInfoService userInfoService;
|
||||
private final AuthMgtService authMgtService;
|
||||
|
||||
@GetMapping("/authMgtPage")
|
||||
public ModelAndView menuMgtPage(UserInfo userInfo) {
|
||||
public ModelAndView authMgtPage(UserInfo userInfo) {
|
||||
ModelAndView mav = new ModelAndView("adminPage/authMgt/authMgt");
|
||||
userInfo.setQueryInfo();
|
||||
mav.addObject("userInfoList", userInfoService.selectUserInfoList(userInfo));
|
||||
|
|
@ -44,29 +43,9 @@ public class AuthMgtController {
|
|||
}
|
||||
|
||||
@PostMapping("/saveAuth")
|
||||
@ResponseBody
|
||||
public String saveAuth(@RequestBody AuthMgt authMgt){
|
||||
authMgtService.saveAuth(authMgt);
|
||||
return "";
|
||||
}
|
||||
|
||||
/*@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 "";
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.dbnt.faisp.controller;
|
||||
|
||||
import com.dbnt.faisp.organMgt.OrganConfigService;
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/organMgt")
|
||||
public class OrganConfigController {
|
||||
private final OrganConfigService organConfigService;
|
||||
|
||||
@GetMapping("/organMgtPage")
|
||||
public ModelAndView organMgtPage(UserInfo userInfo) {
|
||||
ModelAndView mav = new ModelAndView("adminPage/organMgt/organMgt");
|
||||
mav.addObject("searchParams", userInfo);
|
||||
return mav;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.dbnt.faisp.organMgt;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class OrganConfigService {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.dbnt.faisp.organMgt.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "organ_config")
|
||||
public class OrganConfig {
|
||||
@Id
|
||||
@Column(name = "organ_cd")
|
||||
private String organCd;
|
||||
@Column(name = "organ_type")
|
||||
private String organType;
|
||||
@Column(name = "parent_organ")
|
||||
private String parentOrgan;
|
||||
|
||||
@Transient
|
||||
private List<OrganConfig> organConfigList;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.dbnt.faisp.organMgt.repository;
|
||||
|
||||
import com.dbnt.faisp.organMgt.model.OrganConfig;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface OrganConfigRepository extends JpaRepository<OrganConfig, String> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
const organConfigList = []
|
||||
|
||||
$(document).on('click', '#middleAddBtn', function (){
|
||||
addTr('middleTbody')
|
||||
})
|
||||
|
||||
$(document).on('click', '#bottomAddBtn', function (){
|
||||
addTr('bottomTbody')
|
||||
})
|
||||
|
||||
$(document).on('click', '.rowDeleteBtn', function (){
|
||||
$(this).parents('tr').remove();
|
||||
})
|
||||
function addTr(tbody){
|
||||
$('#'+tbody).append(
|
||||
'<tr '+(tbody==="middleTbody"?'class="middleTr"':'')+'>' +
|
||||
'<td><button class="btn btn-sm btn-outline-danger rowDeleteBtn"><i class="bi bi-x"></i></button></td>' +
|
||||
'<td></td>' +
|
||||
'</tr>'
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
<!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/organMgt/organMgt.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">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="row justify-content-end">
|
||||
<button class="col-auto btn btn-success mx-3 my-2" id="codeSaveBtn">저장</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-start">
|
||||
<div class="col-3" id="middleOrganDiv">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>지방청</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="middleTbody">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<button class="btn btn-sm btn-outline-primary col-auto" id="middleAddBtn"><i class="bi bi-plus-lg"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3" id="bottomOrganDiv">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>관할서</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr id="emptyTr"><td colspan="2">지방청을 선택해주세요.</td></tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class="row justify-content-center" id="bottomBtnRow" style="display: none">
|
||||
<button class="btn btn-sm btn-outline-primary col-auto" id="bottomAddBtn"><i class="bi bi-plus-lg"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</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 modal-dialog-scrollable">
|
||||
<div class="modal-content" id="authEditModalContent">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="menuEditModalLabel">권한 편집</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
||||
<button type="button" class="btn btn-primary" id="saveAuthBtn">저장</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</html>
|
||||
|
|
@ -12,12 +12,19 @@
|
|||
<div>
|
||||
<ul class="nav nav-pills" sec:authorize="hasRole('ROLE_ADMIN')">
|
||||
<li class="nav-item"><a href="/codeMgt/codeMgtPage" class="nav-link p-1 link-dark">코드관리</a></li>
|
||||
<li class="nav-item"><a href="/organMgt/organMgtPage" 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="/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>
|
||||
<ul class="nav nav-pills" sec:authorize="hasRole('ROLE_SUB_ADMIN')">
|
||||
<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>
|
||||
</div>
|
||||
<div sec:authorize="isAuthenticated()">
|
||||
<ul class="nav nav-pills">
|
||||
|
|
|
|||
Loading…
Reference in New Issue