수정요청 승인시 동작 작업중.

master
강석 최 2021-12-27 18:46:43 +09:00
parent ce5ca53691
commit 4cdd015726
19 changed files with 676 additions and 83 deletions

View File

@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@ -46,20 +47,84 @@ public class InfoController {
if(modifyRequest.getRequestSeq()==null){ if(modifyRequest.getRequestSeq()==null){
mav.addObject("type", "new"); mav.addObject("type", "new");
mav.addObject("modifyRequest", modifyRequest); mav.addObject("modifyRequest", modifyRequest);
}else{
mav.addObject("type", "modify");
modifyRequest = modifyRequestService.selectModifyRequestByRequestSeq(modifyRequest.getRequestSeq());
modifyRequest.setCreateName(userInfoService.selectUserInfoByUserId(modifyRequest.getCreateId()).getName());
if(modifyRequest.getRequestType().equals("categoryRole")){
String[] categoryAry = modifyRequest.getRequestCategoryAry().split(",");
List<Integer> requestCategoryList = new ArrayList<>();
for(String categorySeq : categoryAry){
requestCategoryList.add(Integer.parseInt(categorySeq.replaceAll(" ", "")));
}
modifyRequest.setRequestCategoryList(requestCategoryList);
}
mav.addObject("modifyRequest", modifyRequest);
}
CategoryRole categoryRole = new CategoryRole(); CategoryRole categoryRole = new CategoryRole();
categoryRole.setUserSeq(loginUser.getUserSeq()); categoryRole.setUserSeq(loginUser.getUserSeq());
mav.addObject("categorySeqList", categoryRoleService.selectCategorySeqListToUser(categoryRole)); mav.addObject("categorySeqList", categoryRoleService.selectCategorySeqListToUser(categoryRole));
}else{
mav.addObject("type", "modify");
// 이하 수정기능 추가시 작업 필요.
mav.addObject("modifyRequest", modifyRequest);
mav.addObject("categorySeqList", new ArrayList<>());
}
return mav; return mav;
} }
@PostMapping("/saveModifyRequest") @PostMapping("/saveModifyRequest")
public Integer saveModifyRequest(ModifyRequest modifyRequest){ public Integer saveModifyRequest(ModifyRequest modifyRequest,
@RequestParam(value = "categorySeq", required = false) List<Integer> categorySeqList){
if(categorySeqList != null && categorySeqList.size()>0){
String requestCategoryAry = categorySeqList.toString();
modifyRequest.setRequestCategoryAry(requestCategoryAry.substring(1, requestCategoryAry.length()-1));
}
if(modifyRequest.getRequestSeq()!=null){
return modifyRequestService.updateModifyRequest(modifyRequest);
}else{
return modifyRequestService.saveModifyRequest(modifyRequest); return modifyRequestService.saveModifyRequest(modifyRequest);
} }
} }
@PutMapping("/modifyRequestStateChange")
public Integer modifyRequestStateChange(ModifyRequest modifyRequest){
return modifyRequestService.modifyRequestStateChange(modifyRequest);
}
@GetMapping("/modifyRequestList")
public ModelAndView modifyRequestList(@AuthenticationPrincipal UserInfo loginUser, ModifyRequest modifyRequest){
ModelAndView mav = new ModelAndView("user/modifyRequestList");
if(loginUser.getUserRole().contains("ADMIN")){
modifyRequest.setUserRole("ADMIN");
}else{
modifyRequest.setCreateId(loginUser.getUserId());
modifyRequest.setUserRole("USER");
}
modifyRequest.setQueryInfo();
mav.addObject("modifyRequestList", modifyRequestService.selectModifyRequestList(modifyRequest));
modifyRequest.setContentCnt(modifyRequestService.selectModifyRequestListCnt(modifyRequest));
modifyRequest.setPaginationInfo();
mav.addObject("searchParams", modifyRequest);
return mav;
}
@GetMapping("/modifyRequestDetail")
public ModelAndView modifyRequestDetail(@AuthenticationPrincipal UserInfo loginUser, ModifyRequest modifyRequest){
ModelAndView mav = new ModelAndView("user/modifyRequestDetail");
ModifyRequest request = modifyRequestService.selectModifyRequestByRequestSeq(modifyRequest.getRequestSeq());
mav.addObject("modifyRequest", request);
switch (request.getRequestType()){
case "userInfo":
mav.addObject("userInfo", userInfoService.selectUserInfoByUserId(request.getCreateId()));
break;
case "categoryRole":
String[] categoryAry = request.getRequestCategoryAry().split(",");
List<Integer> requestCategoryList = new ArrayList<>();
for(String categorySeq : categoryAry){
requestCategoryList.add(Integer.parseInt(categorySeq.replaceAll(" ", "")));
}
request.setRequestCategoryList(requestCategoryList);
CategoryRole categoryRole = new CategoryRole();
categoryRole.setUserSeq(loginUser.getUserSeq());
mav.addObject("categorySeqList", categoryRoleService.selectCategorySeqListToUser(categoryRole));
break;
}
mav.addObject("loginUser", loginUser);
return mav;
}
}

View File

@ -82,7 +82,7 @@ public class adminController {
@GetMapping("/selectUserInfo") @GetMapping("/selectUserInfo")
public ModelAndView selectUserInfo(UserInfo userInfo){ public ModelAndView selectUserInfo(UserInfo userInfo){
ModelAndView mav = new ModelAndView("admin/userInfo"); ModelAndView mav = new ModelAndView("admin/userInfo");
mav.addObject("userInfo", userInfoService.selectUserInfo(userInfo)); mav.addObject("userInfo", userInfoService.selectUserInfoByUserSeq(userInfo));
return mav; return mav;
} }
@PostMapping("/insertCategoryRole") @PostMapping("/insertCategoryRole")

View File

@ -1,12 +0,0 @@
package com.dbnt.kcgfilemanager.mapper;
import com.dbnt.kcgfilemanager.model.BoardCategory;
import com.dbnt.kcgfilemanager.model.CategoryRole;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CategoryRoleMapper {
List<BoardCategory> selectCategoryListToUser(CategoryRole categoryRole);
}

View File

@ -0,0 +1,12 @@
package com.dbnt.kcgfilemanager.mapper;
import com.dbnt.kcgfilemanager.model.ModifyRequest;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface ModifyRequestMapper {
List<ModifyRequest> selectModifyRequestList(ModifyRequest modifyRequest);
Integer selectModifyRequestListCnt(ModifyRequest modifyRequest);
}

View File

@ -43,4 +43,11 @@ public class ModifyRequest extends BaseModel{
private String createId; private String createId;
@Column(name = "CREATE_DATE") @Column(name = "CREATE_DATE")
private LocalDateTime createDate; private LocalDateTime createDate;
@Transient
private List<Integer> requestCategoryList;
@Transient
private String createName;
@Transient
private String userRole;
} }

View File

@ -1,11 +1,8 @@
package com.dbnt.kcgfilemanager.service; package com.dbnt.kcgfilemanager.service;
import com.dbnt.kcgfilemanager.mapper.CategoryRoleMapper;
import com.dbnt.kcgfilemanager.model.BoardCategory;
import com.dbnt.kcgfilemanager.model.CategoryRole; import com.dbnt.kcgfilemanager.model.CategoryRole;
import com.dbnt.kcgfilemanager.repository.CategoryRoleRepository; import com.dbnt.kcgfilemanager.repository.CategoryRoleRepository;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.logging.log4j.util.StringBuilders;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -17,7 +14,6 @@ import java.util.List;
@RequiredArgsConstructor @RequiredArgsConstructor
public class CategoryRoleService { public class CategoryRoleService {
private final CategoryRoleRepository categoryRoleRepository; private final CategoryRoleRepository categoryRoleRepository;
private final CategoryRoleMapper categoryRoleMapper;
@Transactional @Transactional
public void insertCategoryRole(Integer userSeq, List<LinkedHashMap> mapList) { public void insertCategoryRole(Integer userSeq, List<LinkedHashMap> mapList) {
@ -33,6 +29,20 @@ public class CategoryRoleService {
categoryRoleRepository.saveAll(categoryRoleList); categoryRoleRepository.saveAll(categoryRoleList);
} }
@Transactional
public void modifyCategoryRole(Integer userSeq, List<Integer> categorySeqList) {
categoryRoleRepository.deleteByUserSeq(userSeq);
List<CategoryRole> categoryRoleList = new ArrayList<>();
for(Integer categorySeq: categorySeqList){
CategoryRole categoryRole = new CategoryRole();
categoryRole.setUserSeq(userSeq);
categoryRole.setCategorySeq(categorySeq);
categoryRole.setCategoryRole("T");
categoryRoleList.add(categoryRole);
}
categoryRoleRepository.saveAll(categoryRoleList);
}
public List<Integer> selectCategorySeqListToUser(CategoryRole categoryRole) { public List<Integer> selectCategorySeqListToUser(CategoryRole categoryRole) {
List<CategoryRole> categoryRoleList = categoryRoleRepository.findByUserSeq(categoryRole.getUserSeq()); List<CategoryRole> categoryRoleList = categoryRoleRepository.findByUserSeq(categoryRole.getUserSeq());
List<Integer> roleList = new ArrayList<>(); List<Integer> roleList = new ArrayList<>();

View File

@ -1,18 +1,106 @@
package com.dbnt.kcgfilemanager.service; package com.dbnt.kcgfilemanager.service;
import com.dbnt.kcgfilemanager.mapper.ModifyRequestMapper;
import com.dbnt.kcgfilemanager.model.ModifyRequest; import com.dbnt.kcgfilemanager.model.ModifyRequest;
import com.dbnt.kcgfilemanager.model.UserInfo;
import com.dbnt.kcgfilemanager.repository.ModifyRequestRepository; import com.dbnt.kcgfilemanager.repository.ModifyRequestRepository;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class ModifyRequestService { public class ModifyRequestService {
private final ModifyRequestRepository modifyRequestRepository; private final ModifyRequestRepository modifyRequestRepository;
private final ModifyRequestMapper modifyRequestMapper;
private final UserInfoService userInfoService;
private final CategoryRoleService categoryRoleService;
public Integer saveModifyRequest(ModifyRequest modifyRequest) { public Integer saveModifyRequest(ModifyRequest modifyRequest) {
return modifyRequestRepository.save(modifyRequest).getRequestSeq(); return modifyRequestRepository.save(modifyRequest).getRequestSeq();
} }
public Integer updateModifyRequest(ModifyRequest modifyRequest) {
ModifyRequest dbData = selectModifyRequestByRequestSeq(modifyRequest.getRequestSeq());
if(modifyRequest.getStatus()!=null && !modifyRequest.getStatus().equals("")){
dbData.setStatus(modifyRequest.getStatus());
}
if(modifyRequest.getRequestType()!=null && !modifyRequest.getRequestType().equals("")){
dbData.setRequestType(modifyRequest.getRequestType());
}
if(modifyRequest.getDescription()!=null && !modifyRequest.getDescription().equals("")){
dbData.setDescription(modifyRequest.getDescription());
}
if(modifyRequest.getRequestName()!=null && !modifyRequest.getRequestName().equals("")){
dbData.setRequestName(modifyRequest.getRequestName());
}
if(modifyRequest.getRequestDepartment()!=null && !modifyRequest.getRequestDepartment().equals(0)){
dbData.setRequestDepartment(modifyRequest.getRequestDepartment());
}
if(modifyRequest.getRequestPosition()!=null && !modifyRequest.getRequestPosition().equals(0)){
dbData.setRequestPosition(modifyRequest.getRequestPosition());
}
if(modifyRequest.getRequestCategoryAry()!=null && !modifyRequest.getRequestCategoryAry().equals("")){
dbData.setRequestCategoryAry(modifyRequest.getRequestCategoryAry());
}
return modifyRequestRepository.save(dbData).getRequestSeq();
}
public Integer deleteModifyRequest(ModifyRequest modifyRequest) {
modifyRequest = selectModifyRequestByRequestSeq(modifyRequest.getRequestSeq());
modifyRequest.setTitle("삭제된 요청.");
modifyRequest.setStatus("delete");
modifyRequest.setDescription(null);
modifyRequest.setRequestName(null);
modifyRequest.setRequestDepartment(null);
modifyRequest.setRequestPosition(null);
modifyRequest.setRequestCategoryAry(null);
return modifyRequestRepository.save(modifyRequest).getRequestSeq();
}
public List<ModifyRequest> selectModifyRequestList(ModifyRequest modifyRequest) {
return modifyRequestMapper.selectModifyRequestList(modifyRequest);
}
public Integer selectModifyRequestListCnt(ModifyRequest modifyRequest) {
return modifyRequestMapper.selectModifyRequestListCnt(modifyRequest);
}
public ModifyRequest selectModifyRequestByRequestSeq(Integer requestSeq) {
return modifyRequestRepository.findById(requestSeq).orElse(null);
}
public Integer modifyRequestStateChange(ModifyRequest modifyRequest) {
switch (modifyRequest.getStatus()){
case "approval":
ModifyRequest request = modifyRequestRepository.findById(modifyRequest.getRequestSeq()).orElse(null);
UserInfo userInfo = userInfoService.selectUserInfoByUserId(modifyRequest.getCreateId());
switch (request.getRequestType()) {
case "userInfo":
userInfo.setUserId(request.getCreateId());
userInfo.setName(request.getRequestName());
userInfo.setPosition(request.getRequestPosition());
userInfo.setDepartment(request.getRequestDepartment());
userInfoService.updateUserInfo(userInfo);
break;
case "categoryRole":
String[] categoryAry = request.getRequestCategoryAry().split(",");
List<Integer> requestCategoryList = new ArrayList<>();
for(String categorySeq : categoryAry){
requestCategoryList.add(Integer.parseInt(categorySeq.replaceAll(" ", "")));
}
categoryRoleService.modifyCategoryRole(userInfo.getUserSeq(), requestCategoryList);
break;
}
return updateModifyRequest(modifyRequest);
case "delete":
return deleteModifyRequest(modifyRequest);
default:
return updateModifyRequest(modifyRequest);
}
}
} }

View File

@ -68,7 +68,10 @@ public class UserInfoService implements UserDetailsService {
return userInfoMapper.selectUserInfoListCnt(userInfo); return userInfoMapper.selectUserInfoListCnt(userInfo);
} }
public UserInfo selectUserInfo(UserInfo userInfo) { public UserInfo selectUserInfoByUserSeq(UserInfo userInfo) {
return userInfoRepository.findById(userInfo.getUserSeq()).orElse(null); return userInfoRepository.findById(userInfo.getUserSeq()).orElse(null);
} }
public UserInfo selectUserInfoByUserId(String userId) {
return userInfoRepository.findByUserId(userId).orElse(null);
}
} }

View File

@ -83,7 +83,7 @@
<!--<if test="endDate != null and endDate != ''"> <!--<if test="endDate != null and endDate != ''">
AND A.CREATE_DATE &lt;= #{endDate} AND A.CREATE_DATE &lt;= #{endDate}
</if>--> </if>-->
<select id="selectContentListCnt" resultType="int" parameterType="int"> <select id="selectContentListCnt" resultType="int" parameterType="Board">
SELECT COUNT(*) SELECT COUNT(*)
FROM BOARD A FROM BOARD A
INNER JOIN USER_INFO B INNER JOIN USER_INFO B

View File

@ -1,16 +0,0 @@
<?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.kcgfilemanager.mapper.CategoryRoleMapper">
<select id="selectCategoryListToUser" resultType="BoardCategory" parameterType="CategoryRole">
SELECT B.CATEGORY_SEQ ,
B.DEPTH ,
B.PARENT_SEQ ,
B.CATEGORY_NAME
FROM CATEGORY_ROLE A
INNER JOIN BOARD_CATEGORY B ON A.CATEGORY_SEQ = B.CATEGORY_SEQ
WHERE A.USER_SEQ = #{userSeq}
</select>
</mapper>

View File

@ -0,0 +1,68 @@
<?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.kcgfilemanager.mapper.ModifyRequestMapper">
<select id="selectModifyRequestList" resultType="ModifyRequest" parameterType="ModifyRequest">
SELECT A.REQUEST_SEQ AS requestSeq,
A.REQUEST_TYPE AS requestType,
A.TITLE AS title,
A.STATUS AS status,
B.NAME AS createName,
A.CREATE_DATE AS createDate
FROM MODIFY_REQUEST A
INNER JOIN USER_INFO B ON A.CREATE_ID = B.USER_ID
<where>
<if test="userRole == 'USER'">
AND A.CREATE_ID = #{createId}
</if>
<if test="requestType != null and requestType != ''">
AND A.REQUEST_TYPE = #{requestType}
</if>
<if test="title != null and title != ''">
AND A.TITLE LIKE '%${title}%'
</if>
<if test="status != null and status != ''">
AND A.STATUS = #{status}
</if>
<if test="userRole == 'ADMIN'">
<if test="createName != null and createName != ''">
AND B.CREATE_NAME LIKE '%${createName}%'
</if>
</if>
<if test="startDate != null and startDate != ''">
AND A.CREATE_DATE >= CONCAT(#{startDate}, ' 00:00:00')
</if>
<if test="endDate != null and endDate != ''">
AND A.CREATE_DATE &lt;= CONCAT(#{endDate}, ' 23:59:59')
</if>
</where>
ORDER BY A.CREATE_DATE DESC
LIMIT #{rowCnt} OFFSET #{firstIndex}
</select>
<select id="selectModifyRequestListCnt" resultType="int" parameterType="ModifyRequest">
SELECT COUNT(*)
FROM MODIFY_REQUEST A
INNER JOIN USER_INFO B ON A.CREATE_ID = B.USER_ID
<where>
<if test="userRole == 'USER'">
AND CREATE_ID = #{createId}
</if>
<if test="requestType != null and requestType != ''">
AND REQUEST_TYPE LIKE '%${requestType}%'
</if>
<if test="title != null and title != ''">
AND TITLE LIKE '%${title}%'
</if>
<if test="status != null and status != ''">
AND STATUS LIKE '%${status}%'
</if>
<if test="userRole == 'ADMIN'">
<if test="createId != null and createId != ''">
AND CREATE_ID LIKE '%${createId}%'
</if>
</if>
</where>
</select>
</mapper>

View File

@ -26,6 +26,7 @@ $(document).on('click', '#savePasswordBtn', function (){
} }
}) })
function passwordCheck(){ function passwordCheck(){
let returnFlag = true; let returnFlag = true;
const password = $("#password"); const password = $("#password");

View File

@ -0,0 +1,74 @@
$(function (){
$("#dateSelectorDiv").datepicker({
format: "yyyy-mm-dd",
language: "ko"
});
})
$(document).on('click', '.modifyRequestTr', function (){
const checkBox = $(this).find(".modifyRequestCheckBox")
$(".modifyRequestCheckBox").prop("checked", false);
checkBox.prop("checked", true);
getRequestDetail(checkBox.val());
})
$(document).on('click', '#deleteBtn', function (){
if(confirm("삭제하시겠습니까?")){
modifyRequestStatusChange({
requestSeq: $(this).attr("data-requestseq"),
status: 'delete'
});
}
})
$(document).on('click', '#dinialBtn', function (){
if(confirm("요청을 거부 하시겠습니까?")){
modifyRequestStatusChange({
requestSeq: $(this).attr("data-requestseq"),
status: 'dinial'
})
}
})
$(document).on('click', '#approvalBtn', function (){
if(confirm("요청을 승인 하시겠습니까?")){
modifyRequestStatusChange({
requestSeq: $(this).attr("data-requestseq"),
createId: $(this).attr("data-createid"),
status: 'approval'
})
}
})
function modifyRequestStatusChange(data){
$.ajax({
type: "PUT",
url: '/info/modifyRequestStateChange',
data: data,
beforeSend: function (xhr){
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
},
success: function (html) {
alert("저장 되었습니다.")
location.reload()
},
error: function () {
}
});
}
function getRequestDetail(requestSeq){
$.ajax({
url: '/info/modifyRequestDetail',
data: {requestSeq: requestSeq},
type: 'GET',
dataType:"html",
success: function(html){
$("#requestDetailDiv").empty().append(html)
},
error:function(){
}
});
}

View File

@ -11,6 +11,9 @@ $(function (){
['table', ['table']] ['table', ['table']]
] ]
}) })
if(pageType === "modify"){
$("#modifyInfoDiv").empty().append($("#"+$("#categorySelector").val()+"Div").children().clone());
}
}) })
$(document).on('change', '#categorySelector', function (){ $(document).on('change', '#categorySelector', function (){
$("#modifyInfoDiv").empty().append($("#"+this.value+"Div").children().clone()); $("#modifyInfoDiv").empty().append($("#"+this.value+"Div").children().clone());
@ -18,17 +21,27 @@ $(document).on('change', '#categorySelector', function (){
$(document).on('click', '#saveBtn', function (){ $(document).on('click', '#saveBtn', function (){
if(contentCheck()){ if(contentCheck()){
if(confirm("저장하시겠습니까?")){ if(confirm("저장하시겠습니까?")){
saveModifyRequest();
}
}
})
$(document).on('change', '.parentSeq', function (){
childCategoryStatusChange(this.value, this.checked);
})
function saveModifyRequest(){
const formData = new FormData($("#requestForm")[0]); const formData = new FormData($("#requestForm")[0]);
$.ajax({ $.ajax({
type : 'POST', type : 'POST',
data : formData, data : formData,
url : pageType==='modify'?"/info/updateModifyRequest":"/info/saveModifyRequest", url : "/info/saveModifyRequest",
processData: false, processData: false,
contentType: false, contentType: false,
success : function(result) { success : function(result) {
if(result>0){ if(result>0){
alert("저장되었습니다."); alert("저장되었습니다.");
// location.href = "/board/contentList?categorySeq="+$("#categorySeq").val(); location.href = "/info/modifyRequestList";
} }
}, },
error : function(xhr, status) { error : function(xhr, status) {
@ -36,8 +49,16 @@ $(document).on('click', '#saveBtn', function (){
} }
}) })
} }
}
function childCategoryStatusChange(parentSeq, flag){
const target = $("[data-parentseq='"+parentSeq+"']");
if(target.length>0){
target.prop("checked", flag);
target.each(function(idx, el){
childCategoryStatusChange(el.value, flag);
}) })
}
}
function contentCheck(){ function contentCheck(){
let flag = true; let flag = true;

View File

@ -7,7 +7,7 @@
<div class="list-group py-2"> <div class="list-group py-2">
<a href="/admin/categoryMgt" class="list-group-item list-group-item-action">게시판 분류 관리</a> <a href="/admin/categoryMgt" class="list-group-item list-group-item-action">게시판 분류 관리</a>
<a href="/admin/userMgt" class="list-group-item list-group-item-action">사용자 관리</a> <a href="/admin/userMgt" class="list-group-item list-group-item-action">사용자 관리</a>
<a href="/admin/modifyRequest" class="list-group-item list-group-item-action">수정 요청</a> <a href="/info/modifyRequestList" class="list-group-item list-group-item-action">수정 요청</a>
<a href="#" class="list-group-item list-group-item-action disabled">통계</a> <a href="#" class="list-group-item list-group-item-action disabled">통계</a>
<a href="/admin/codeMgt" class="list-group-item list-group-item-action">코드관리</a> <a href="/admin/codeMgt" class="list-group-item list-group-item-action">코드관리</a>
</div> </div>

View File

@ -0,0 +1,107 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="p-3">
<input type="hidden" id="requestSeq" th:value="${modifyRequest.requestSeq}">
<div class="row justify-content-between">
<div class="col-auto">
<h5 class="fw-bold">
<span th:text="${modifyRequest.title}"></span>
</h5>
</div>
<div class="col-auto">
<span class="text-danger fw-bold" th:if="${modifyRequest.status=='delete'}">삭제</span>
<span class="text-primary fw-bold" th:if="${modifyRequest.status=='wait'}">대기</span>
<span class="text-danger fw-bold" th:if="${modifyRequest.status=='dinial'}">거부</span>
<span class="text-success fw-bold" th:if="${modifyRequest.status=='approval'}">승인</span>
</div>
</div>
<div class="row justify-content-between border-bottom pb-3">
<div class="col-auto" th:text="${#temporals.format(modifyRequest.createDate, 'yyyy-MM-dd HH:mm:ss')}"></div>
<div class="col-auto" th:text="${modifyRequest.createId}"></div>
</div>
<div class="row border-bottom py-3" th:if="${modifyRequest.requestType != 'etc'}">
<div class="col-12">
<th:block th:if="${modifyRequest.requestType=='userInfo'}">
<div class="p-3 border rounded">
<div class="row mb-3">
<label for="requestName" class="col-sm-2 col-form-label">이름</label>
<div class="col-sm-10">
<div class="input-group">
<input type="text" readonly class="form-control" id="originalName" th:value="${userInfo.name}">
<span class="input-group-text"><i class="bi bi-arrow-right"></i></span>
<input type="text" readonly class="form-control" id="requestName" th:value="${modifyRequest.requestName}"
th:classappend="${userInfo.name == modifyRequest.requestName?'':'bg-danger bg-opacity-25'}">
</div>
</div>
</div>
<div class="row mb-3">
<label for="requestDepartment" class="col-sm-2 col-form-label">부서</label>
<div class="col-sm-10">
<div class="input-group">
<th:block th:each="department:${session.departmentList}">
<th:block th:if="${department.codeSq == userInfo.department}">
<input type="text" readonly class="form-control" id="originalDepartment" th:value="${department.value}">
</th:block>
</th:block>
<span class="input-group-text"><i class="bi bi-arrow-right"></i></span>
<th:block th:each="department:${session.departmentList}">
<th:block th:if="${department.codeSq == modifyRequest.requestDepartment}">
<input type="text" readonly class="form-control" id="requestDepartment" th:value="${department.value}"
th:classappend="${userInfo.department == modifyRequest.requestDepartment?'':'bg-danger bg-opacity-25'}">
</th:block>
</th:block>
</div>
</div>
</div>
<div class="row mb-3">
<label for="requestPosition" class="col-sm-2 col-form-label">직책</label>
<div class="col-sm-10">
<div class="input-group">
<th:block th:each="position:${session.positionList}">
<th:block th:if="${position.codeSq == userInfo.position}">
<input type="text" readonly class="form-control" id="originalPosition" th:value="${position.value}">
</th:block>
</th:block>
<span class="input-group-text"><i class="bi bi-arrow-right"></i></span>
<th:block th:each="position:${session.positionList}">
<th:block th:if="${position.codeSq == modifyRequest.requestPosition}">
<input type="text" readonly class="form-control" id="requestPosition" th:value="${position.value}"
th:classappend="${userInfo.position == modifyRequest.requestPosition?'':'bg-danger bg-opacity-25'}">
</th:block>
</th:block>
</div>
</div>
</div>
</div>
</th:block>
<th:block th:if="${modifyRequest.requestType=='categoryRole'}">
</th:block>
</div>
</div>
<div class="row border-bottom py-3">
<div class="col-12" th:utext="${modifyRequest.description}"></div>
</div>
<th:block th:if="${modifyRequest.status=='wait'}">
<th:block th:if="${modifyRequest.createId == loginUser.userId}">
<div class="row justify-content-between py-3">
<div class="col-auto">
<button class="btn btn-danger" id="deleteBtn" th:data-requestseq="${modifyRequest.requestSeq}"><i class="bi bi-trash"></i> 삭제</button>
</div>
<div class="col-auto">
<a class="btn btn-warning" th:href="|@{/info/modifyRequestWrite}?requestSeq=${modifyRequest.requestSeq}|"><i class="bi bi-pencil-square"></i> 수정</a>
</div>
</div>
</th:block>
</th:block>
<th:block th:if="${loginUser.userRole.contains('ADMIN')}">
<div class="row justify-content-between py-3">
<div class="col-auto">
<button class="btn btn-danger" id="dinialBtn" th:data-requestseq="${modifyRequest.requestSeq}"> 거부</button>
</div>
<div class="col-auto">
<button class="btn btn-success" id="approvalBtn" th:data-requestseq="${modifyRequest.requestSeq}" th:data-createid="${modifyRequest.createId}"> 승인</button>
</div>
</div>
</th:block>
</div>

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/user/modifyRequestList.js}"></script>
</th:block>
<div layout:fragment="content">
<main class="pt-3">
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<h4>수정 요청 현황</h4>
<div class="row mx-0">
<div class="col-12 card">
<div class="card-body">
<div class="row justify-content-start">
<div class="col-7">
<!--검색 form-->
<form method="get" th:action="@{/info/modifyRequestList}">
<input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}">
<div class="row">
<div class="col-12 card">
<div class="row pt-1">
<div class="col-auto">
<div class="row my-2">
<label for="rowCnt" class="col-sm-auto col-form-label">데이터 수</label>
<div class="col-sm-auto">
<select class="form-select form-control-sm" 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>
<label for="title" class="col-sm-auto col-form-label">제목</label>
<div class="col-sm-auto">
<input type="text" class="form-control form-control-sm" id="title" name="title" th:value="${searchParams.title}">
</div>
<th:block th:if="${searchParams.userRole=='ADMIN'}">
<label for="createName" class="col-sm-auto col-form-label">작성자</label>
<div class="col-sm-auto">
<input type="text" class="form-control form-control-sm" id="createName" name="createName" th:value="${searchParams.createName}">
</div>
</th:block>
</div>
<div class="row my-2">
<label for="requestType" class="col-sm-auto col-form-label">구분</label>
<div class="col-sm-auto">
<select class="form-select form-control-sm" name="requestType" id="requestType">
<option value="">전체</option>
<option value="userInfo" th:selected="${searchParams.requestType=='userInfo'}">계정정보</option>
<option value="categoryRole" th:selected="${searchParams.requestType=='categoryRole'}">권한정보</option>
<option value="etc" th:selected="${searchParams.requestType=='etc'}">기타</option>
</select>
</div>
<label for="status" class="col-sm-auto col-form-label">상태</label>
<div class="col-sm-auto">
<select class="form-select form-control-sm" name="status" id="status">
<option value="">전체</option>
<option value="wait" th:selected="${searchParams.status=='wait'}">대기</option>
<option value="approval" th:selected="${searchParams.status=='approval'}">승인</option>
<option value="dinial" th:selected="${searchParams.status=='dinial'}">거부</option>
</select>
</div>
<label for="startDate" class="col-sm-auto col-form-label">작성일</label>
<div class="col-sm-5">
<div class="col-auto input-group w-auto input-daterange" id="dateSelectorDiv">
<input type="text" class="form-control form-control-sm" id="startDate" name="startDate" placeholder="시작일" autocomplete="off" th:value="${searchParams.startDate}" readonly>
<input type="text" class="form-control form-control-sm" id="endDate" name="endDate" placeholder="종료일" autocomplete="off" th:value="${searchParams.endDate}" readonly>
</div>
</div>
</div>
</div>
<div class="col-auto my-auto">
<input type="submit" class="btn btn-primary py-4" id="searchBtn" value="검색">
</div>
</div>
</div>
</div>
</form>
<div class="row-cols-6">
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th>구분</th>
<th>제목</th>
<th>상태</th>
<th>작성자</th>
<th>생성일</th>
</tr>
</thead>
<tbody>
<tr class="modifyRequestTr" th:each="modifyRequest:${modifyRequestList}">
<td>
<input type="checkbox" class="modifyRequestCheckBox" th:value="${modifyRequest.requestSeq}">
</td>
<td>
<th:block th:if="${modifyRequest.requestType=='userInfo'}">계정정보</th:block>
<th:block th:if="${modifyRequest.requestType=='categoryRole'}">권한정보</th:block>
<th:block th:if="${modifyRequest.requestType=='etc'}">기타</th:block>
</td>
<td th:text="${modifyRequest.title}"></td>
<td>
<th:block th:if="${modifyRequest.status=='delete'}">삭제</th:block>
<th:block th:if="${modifyRequest.status=='wait'}">대기</th:block>
<th:block th:if="${modifyRequest.status=='dinial'}">거부</th:block>
<th:block th:if="${modifyRequest.status=='approval'}">승인</th:block>
</td>
<td th:text="${modifyRequest.createName}"></td>
<th:block th:if="${#dates.format(#dates.createNow(), 'yyyy-MM-dd')} == ${#temporals.format(modifyRequest.createDate, 'yyyy-MM-dd')}">
<td th:text="${#temporals.format(modifyRequest.createDate, 'HH:mm:ss')}"></td>
</th:block>
<th:block th:unless="${#dates.format(#dates.createNow(), 'yyyy-MM-dd')} == ${#temporals.format(modifyRequest.createDate, 'yyyy-MM-dd')}">
<td th:text="${#temporals.format(modifyRequest.createDate, 'yyyy-MM-dd')}"></td>
</th:block>
</tr>
</tbody>
</table>
</div>
<div class="row justify-content-between">
<div class="col-auto"></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">
<a class="btn btn-warning mb-2" href="/info/modifyRequestWrite"> 수정 요청</a>
</div>
</div>
</div>
<div class="col-5">
<div class="card" id="requestDetailDiv">
<h3 class="p-5">왼쪽 목록에서 선택해주세요.</h3>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</html>

View File

@ -28,15 +28,16 @@
</div> </div>
<form id="requestForm" th:action="@{/info/saveModifyRequest}" method="post"> <form id="requestForm" th:action="@{/info/saveModifyRequest}" method="post">
<th:block th:if="${type!='new'}"> <th:block th:if="${type!='new'}">
<input type="hidden" name="requestSeq"> <input type="hidden" name="requestSeq" th:value="${modifyRequest.requestSeq}">
</th:block> </th:block>
<div class="row mb-3"> <div class="row mb-3">
<label for="title" class="col-sm-2 col-form-label">분류 선택</label> <label for="title" class="col-sm-2 col-form-label">분류 선택</label>
<div class="col-sm"> <div class="col-sm">
<select class="form-select" id="categorySelector" name="requestType"> <select class="form-select" id="categorySelector" name="requestType">
<option value="" disabled selected>분류를 선택해주세요</option> <option value="" disabled th:selected="${modifyRequest.requestType==null}">분류를 선택해주세요</option>
<option value="userInfo">계정정보</option> <option value="userInfo" th:selected="${modifyRequest.requestType=='userInfo'}">계정정보</option>
<option value="categoryRole">권한정보</option> <option value="categoryRole" th:selected="${modifyRequest.requestType=='categoryRole'}">권한정보</option>
<option value="etc" th:selected="${modifyRequest.requestType=='etc'}">기타</option>
</select> </select>
</div> </div>
</div> </div>
@ -49,8 +50,8 @@
<div class="row mb-3"> <div class="row mb-3">
<label for="createName" class="col-sm-2 col-form-label">작성자</label> <label for="createName" class="col-sm-2 col-form-label">작성자</label>
<div class="col-sm-4"> <div class="col-sm-4">
<input type="hidden" name="createId" th:value="${loginUser.userId}"> <input type="hidden" name="createId" th:value="${type!='new'?modifyRequest.createId:loginUser.userId}">
<input type="text" class="form-control" id="createName" th:value="${loginUser.name}" readonly> <input type="text" class="form-control" id="createName" th:value="${type!='new'?modifyRequest.createName:loginUser.name}" readonly>
</div> </div>
<label for="createDate" class="col-sm-2 col-form-label">작성일</label> <label for="createDate" class="col-sm-2 col-form-label">작성일</label>
<div class="col-sm-4"> <div class="col-sm-4">
@ -76,12 +77,17 @@
</div> </div>
</main> </main>
<div class="d-none"> <div class="d-none">
<div id="etcDiv">
<div class="p-3 border rounded">
설명란에 내용 직접 입력.
</div>
</div>
<div id="userInfoDiv"> <div id="userInfoDiv">
<div class="p-3 border rounded"> <div class="p-3 border rounded">
<div class="row mb-3"> <div class="row mb-3">
<label for="requestName" class="col-sm-2 col-form-label">이름</label> <label for="requestName" class="col-sm-2 col-form-label">이름</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" id="requestName" name="requestName" th:value="${type!='new'?loginUser.name:modifyRequest.requestName}"> <input type="text" class="form-control" id="requestName" name="requestName" th:value="${type!='new'?modifyRequest.requestName:loginUser.name}">
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
@ -89,7 +95,7 @@
<div class="col-sm-10"> <div class="col-sm-10">
<select class="form-select" id="requestDepartment" name="requestDepartment"> <select class="form-select" id="requestDepartment" name="requestDepartment">
<th:block th:each="deparement:${session.departmentList}"> <th:block th:each="deparement:${session.departmentList}">
<option th:value="${deparement.codeSq}" th:text="${deparement.value}" th:selected="${type!='new'?loginUser.department:modifyRequest.requestDepartment}"></option> <option th:value="${deparement.codeSq}" th:text="${deparement.value}" th:selected="${type!='new'?modifyRequest.requestDepartment:loginUser.department}"></option>
</th:block> </th:block>
</select> </select>
</div> </div>
@ -99,7 +105,7 @@
<div class="col-sm-10"> <div class="col-sm-10">
<select class="form-select" id="requestPosition" name="requestPosition"> <select class="form-select" id="requestPosition" name="requestPosition">
<th:block th:each="position:${session.positionList}"> <th:block th:each="position:${session.positionList}">
<option th:value="${position.codeSq}" th:text="${position.value}" th:selected="${type!='new'?loginUser.position:modifyRequest.requestPosition}"></option> <option th:value="${position.codeSq}" th:text="${position.value}" th:selected="${type!='new'?modifyRequest.requestPosition:loginUser.position}"></option>
</th:block> </th:block>
</select> </select>
</div> </div>
@ -119,8 +125,8 @@
<thead> <thead>
<tr> <tr>
<th> <th>
<input type="checkbox" class="categoryCheckBox parentSeq" th:data-categoryseq="${depth1.categorySeq}" <input type="checkbox" class="categoryCheckBox parentSeq" name="categorySeq"
th:checked="${#lists.contains(categorySeqList, depth1.categorySeq)}"> th:value="${depth1.categorySeq}" th:checked="${#lists.contains(categorySeqList, depth1.categorySeq)}">
</th> </th>
<th colspan="3" class="text-center" th:text="${depth1.categoryName}"></th> <th colspan="3" class="text-center" th:text="${depth1.categoryName}"></th>
</tr> </tr>
@ -135,8 +141,8 @@
<th:block th:each="depth2:${depth1.childCategoryList}"> <th:block th:each="depth2:${depth1.childCategoryList}">
<tr> <tr>
<td> <td>
<input type="checkbox" class="categoryCheckBox parentSeq" <input type="checkbox" class="categoryCheckBox parentSeq" name="categorySeq"
th:data-categoryseq="${depth2.categorySeq}" th:data-parentseq="${depth2.parentSeq}" th:value="${depth2.categorySeq}" th:data-parentseq="${depth2.parentSeq}"
th:checked="${#lists.contains(categorySeqList, depth2.categorySeq)}"> th:checked="${#lists.contains(categorySeqList, depth2.categorySeq)}">
</td> </td>
<td th:text="${depth2.categoryName}"></td> <td th:text="${depth2.categoryName}"></td>
@ -146,8 +152,8 @@
<th:block th:each="depth3:${depth2.childCategoryList}"> <th:block th:each="depth3:${depth2.childCategoryList}">
<tr> <tr>
<td> <td>
<input type="checkbox" class="categoryCheckBox parentSeq" <input type="checkbox" class="categoryCheckBox parentSeq" name="categorySeq"
th:data-categoryseq="${depth3.categorySeq}" th:data-parentseq="${depth3.parentSeq}" th:value="${depth3.categorySeq}" th:data-parentseq="${depth3.parentSeq}"
th:checked="${#lists.contains(categorySeqList, depth3.categorySeq)}"> th:checked="${#lists.contains(categorySeqList, depth3.categorySeq)}">
</td> </td>
<td></td> <td></td>
@ -157,8 +163,9 @@
<th:block th:each="depth4:${depth3.childCategoryList}"> <th:block th:each="depth4:${depth3.childCategoryList}">
<tr> <tr>
<td> <td>
<input type="checkbox" class="categoryCheckBox" th:data-categoryseq="${depth4.categorySeq}" <input type="checkbox" class="categoryCheckBox" name="categorySeq"
th:data-parentseq="${depth4.parentSeq}" th:checked="${#lists.contains(categorySeqList, depth4.categorySeq)}"> th:value="${depth4.categorySeq}" th:data-parentseq="${depth4.parentSeq}"
th:checked="${#lists.contains(categorySeqList, depth4.categorySeq)}">
</td> </td>
<td></td> <td></td>
<td></td> <td></td>
@ -172,11 +179,6 @@
</div> </div>
</th:block> </th:block>
</div> </div>
<div class="row justify-content-end">
<div class="col-auto">
<button type="button" class="btn btn-primary" id="saveCategoryRoleBtn">저장</button>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -11,7 +11,7 @@
<div class="col-auto"><h4>개인정보</h4></div> <div class="col-auto"><h4>개인정보</h4></div>
<div class="col-auto"> <div class="col-auto">
<th:block th:if="${!#strings.contains(loginUser.userRole,'ADMIN')}"> <th:block th:if="${!#strings.contains(loginUser.userRole,'ADMIN')}">
<a class="btn btn-success mb-2" href="#"> 요청 현황</a> <a class="btn btn-success mb-2" href="/info/modifyRequestList"> 요청 현황</a>
<a class="btn btn-warning mb-2" href="/info/modifyRequestWrite"> 수정 요청</a> <a class="btn btn-warning mb-2" href="/info/modifyRequestWrite"> 수정 요청</a>
</th:block> </th:block>
</div> </div>