feat:외사경찰관리 -> 승인목록 수정(관리자,일반사용자만적용됨) 삭제
parent
378c929f7d
commit
7efb5ed160
|
|
@ -61,4 +61,15 @@ public class userMgtController {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/updateUserInfo")
|
||||||
|
public void updateUserInfo(UserInfo userInfo) {
|
||||||
|
userInfoService.updateUser(userInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/userDelete")
|
||||||
|
@ResponseBody
|
||||||
|
public void userDelete(@RequestBody List<UserInfo> userInfo) {
|
||||||
|
userInfoService.userDelete(userInfo);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,15 +78,15 @@ public class UserInfoService implements UserDetailsService {
|
||||||
UserInfo dbUserInfo = userInfoRepository.findById(user.getUserSeq()).orElse(null);
|
UserInfo dbUserInfo = userInfoRepository.findById(user.getUserSeq()).orElse(null);
|
||||||
if(dbUserInfo != null) {
|
if(dbUserInfo != null) {
|
||||||
dbUserInfo.setUserStatus(user.getUserStatus());
|
dbUserInfo.setUserStatus(user.getUserStatus());
|
||||||
|
userInfoRepository.save(dbUserInfo);
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
@Transactional
|
||||||
public int updateUserCompanion(List<UserInfo> userInfo) {
|
public int updateUserCompanion(List<UserInfo> userInfo) {
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
System.out.println("!!"+userInfo);
|
|
||||||
for(UserInfo user: userInfo) {
|
for(UserInfo user: userInfo) {
|
||||||
UserInfo dbUserInfo = userInfoRepository.findById(user.getUserSeq()).orElse(null);
|
UserInfo dbUserInfo = userInfoRepository.findById(user.getUserSeq()).orElse(null);
|
||||||
if(dbUserInfo != null) {
|
if(dbUserInfo != null) {
|
||||||
|
|
@ -97,4 +97,14 @@ public class UserInfoService implements UserDetailsService {
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
@Transactional
|
||||||
|
public void updateUser(UserInfo userInfo) {
|
||||||
|
UserInfo dbUserInfo = userInfoRepository.findById(userInfo.getUserSeq()).orElse(null);
|
||||||
|
dbUserInfo.setUserRole(userInfo.getUserRole());
|
||||||
|
userInfoRepository.save(dbUserInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
public void userDelete(List<UserInfo> userInfo) {
|
||||||
|
userInfoRepository.deleteAll(userInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
user_id,
|
user_id,
|
||||||
user_nm,
|
user_nm,
|
||||||
address,
|
address,
|
||||||
|
user_role,
|
||||||
detail_addr,
|
detail_addr,
|
||||||
email,
|
email,
|
||||||
og_cd,
|
og_cd,
|
||||||
|
|
@ -43,7 +44,15 @@
|
||||||
<select id="selectUserInfoListCnt" resultType="int" parameterType="UserInfo">
|
<select id="selectUserInfoListCnt" resultType="int" parameterType="UserInfo">
|
||||||
select count(*)
|
select count(*)
|
||||||
from user_info
|
from user_info
|
||||||
where user_status != 'D'
|
where
|
||||||
|
<choose>
|
||||||
|
<when test="userStatus != null and userStatus != ''">
|
||||||
|
user_status = #{userStatus}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
user_status != 'D'
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
and user_id like '%'||#{userId}||'%'
|
and user_id like '%'||#{userId}||'%'
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
|
|
@ -95,4 +95,52 @@ function userCompanion(checkArr){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(document).on('click', '#updateBtn', function (){
|
||||||
|
if(confirm("저장하시겠습니까?")){
|
||||||
|
contentFade("in");
|
||||||
|
const formData = new FormData($("#userInfoUpdate")[0]);
|
||||||
|
$.ajax({
|
||||||
|
type : 'POST',
|
||||||
|
data : formData,
|
||||||
|
url : "/userMgt/updateUserInfo",
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
success : function() {
|
||||||
|
alert("저장되었습니다.");
|
||||||
|
contentFade("out");
|
||||||
|
},
|
||||||
|
error : function(xhr, status) {
|
||||||
|
alert("저장에 실패하였습니다.");
|
||||||
|
contentFade("out");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
$(document).on('click', '#deleteBtn', function (){
|
||||||
|
if(confirm("삭제 하시겠습니까?")){
|
||||||
|
console.log($("#userSeq").val());
|
||||||
|
deleteUser([{userSeq: Number($("#userSeq").val())}])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function deleteUser(userList){
|
||||||
|
$.ajax({
|
||||||
|
type : 'POST',
|
||||||
|
url : "/userMgt/userDelete",
|
||||||
|
data : JSON.stringify(userList),
|
||||||
|
contentType: 'application/json',
|
||||||
|
beforeSend: function (xhr){
|
||||||
|
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
|
||||||
|
},
|
||||||
|
success : function() {
|
||||||
|
alert("삭제 처리되었습니다.");
|
||||||
|
location.reload();
|
||||||
|
},
|
||||||
|
error : function(xhr, status) {
|
||||||
|
alert("삭제 처리에 실패하였습니다");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,12 +1,19 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
|
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
|
||||||
<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">
|
||||||
<form id="userInfoInsert" action="#" th:action="@{/admin/insertUserInfo}" method="post">
|
<form id="userInfoUpdate" action="#" th:action="@{/admin/insertUserInfo}" method="post">
|
||||||
|
<label style="font-size: 12px">
|
||||||
|
<input type="radio" name="userRole" value="ROLE_ADMIN,ROLE_USER" th:checked="${userInfo.userRole eq 'ROLE_ADMIN,ROLE_USER'}">
|
||||||
|
관리자</label>
|
||||||
|
<label style="font-size: 12px">
|
||||||
|
<input type="radio" name="userRole" value="ROLE_USER" th:checked="${userInfo.userRole eq 'ROLE_USER'}">
|
||||||
|
일반사용자</label>
|
||||||
<div class="mb-3 row">
|
<div class="mb-3 row">
|
||||||
|
<input type="hidden" name="userSeq" id="userSeq" class="userSeq" th:value="${userInfo.userSeq}">
|
||||||
<div class="mb-3 mt-3 row">
|
<div class="mb-3 mt-3 row">
|
||||||
<label for="userId" class="col-sm-2 col-form-label text-center ">아이디</label>
|
<label for="userId" class="col-sm-2 col-form-label text-center ">아이디</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<input type="text" class="form-control" id="userId" name="userId" th:value="${userInfo.userId}" autocomplete="off">
|
<input type="text" class="form-control" id="userId" name="userId" th:value="${userInfo.userId}" autocomplete="off" readonly>
|
||||||
<label for="userId" style="font-size: 12px">6~20자 사이의 알파벳, 숫자를 입력하세요</label>
|
<label for="userId" style="font-size: 12px">6~20자 사이의 알파벳, 숫자를 입력하세요</label>
|
||||||
</div>
|
</div>
|
||||||
<label for="userNm" class="col-sm-2 col-form-label text-center">이름</label>
|
<label for="userNm" class="col-sm-2 col-form-label text-center">이름</label>
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="userInfoTr" th:each="userInfo:${userInfoList}">
|
<tr class="userInfoTr" th:each="userInfo:${userInfoList}">
|
||||||
<input type="hidden" class="userSeq" th:value="${userInfo.userSeq}">
|
<input type="hidden" name="userSeq" class="userSeq" th:value="${userInfo.userSeq}">
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" id="userChk" name="userChk" class="userInfoCheckBox" th:value="${userInfo.userSeq}">
|
<input type="checkbox" id="userChk" name="userChk" class="userInfoCheckBox" th:value="${userInfo.userSeq}">
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -164,7 +164,7 @@
|
||||||
<div class="modal-dialog modal-lg modal-dialog-scrollable">
|
<div class="modal-dialog modal-lg modal-dialog-scrollable">
|
||||||
<div class="modal-content" id="userEditModalContent">
|
<div class="modal-content" id="userEditModalContent">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title" id="menuEditModalLabel">외사경찰 등록</h5>
|
<h5 class="modal-title" id="menuEditModalLabel">외사경찰 수정</h5>
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
@ -173,8 +173,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn" id="deleteBtn" style='background-color : red;float:left;'>삭제</button>
|
||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
||||||
<button type="button" class="btn btn-primary" id="saveAuthBtn">저장</button>
|
<button type="button" class="btn btn-primary" id="updateBtn">저장</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue