공용게시판 게시물 삭제 기능 추가.
parent
f41bb94ead
commit
df115a3b87
|
|
@ -71,7 +71,6 @@ public class PublicBoardController {
|
|||
mav.addObject("referenceList", publicBoardService.selectContentList(publicBoard));
|
||||
publicBoard.setContentCnt(publicBoardService.selectContentListCnt(publicBoard));
|
||||
publicBoard.setPaginationInfo();
|
||||
mav.addObject("tabStatusList", codeMgtService.selectCodeMgtList("RPC"));
|
||||
mav.addObject("searchParams", publicBoard);
|
||||
return mav;
|
||||
}
|
||||
|
|
@ -142,6 +141,7 @@ public class PublicBoardController {
|
|||
}
|
||||
publicBoard = publicBoardService.selectPublicBoard(publicBoard.getPublicKey());
|
||||
mav.addObject("userSeq", loginUser.getUserSeq());
|
||||
mav.addObject("userRole", loginUser.getUserRole());
|
||||
mav.addObject("info", publicBoard);
|
||||
return mav;
|
||||
}
|
||||
|
|
@ -173,4 +173,10 @@ public class PublicBoardController {
|
|||
public void deleteComment (@RequestBody PublicComment comment){
|
||||
publicBoardService.deleteComment(comment.getPublicKey(), comment.getCommentKey());
|
||||
}
|
||||
|
||||
@PostMapping("/deletePublicBoard")
|
||||
@ResponseBody
|
||||
public void deletePublicBoard (@RequestBody PublicBoard board){
|
||||
publicBoardService.deletePublicBoard(board.getPublicKey());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,8 +46,10 @@ public class PublicBoard extends BaseModel {
|
|||
private LocalDateTime wrtDt;
|
||||
@Column(name = "organ_chk")
|
||||
private String organChk;
|
||||
@Column(name = "tab_status")
|
||||
private String tabStatus;
|
||||
@Column(name = "selected_tab")
|
||||
private String selectedTab;
|
||||
@Column(name = "status")
|
||||
private String status;
|
||||
|
||||
@Transient
|
||||
private Integer fileCnt;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,13 @@ package com.dbnt.faisp.main.publicBoard.repository;
|
|||
|
||||
import com.dbnt.faisp.main.publicBoard.model.PublicBoard;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
|
||||
public interface PublicBoardRepository extends JpaRepository<PublicBoard, Integer> {
|
||||
|
||||
@Modifying(clearAutomatically = true)
|
||||
@Query("update PublicBoard set status = :status where publicKey = :publicKey")
|
||||
void bulkModifyingByPublicKeyToStatus(Integer publicKey, String status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,6 +104,11 @@ public class PublicBoardService extends BaseService {
|
|||
publicCommentRepository.deleteById(new PublicComment.PublicCommentId(publicKey, commentKey));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deletePublicBoard(Integer publicKey) {
|
||||
publicBoardRepository.bulkModifyingByPublicKeyToStatus(publicKey, "DST008");
|
||||
}
|
||||
|
||||
public FileInfo selectPublicFile(Integer publicKey, Integer fileSeq){
|
||||
return publicFileRepository.findById(new PublicFile.PublicFileId(publicKey, fileSeq)).orElse(null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<mapper namespace="com.dbnt.faisp.main.publicBoard.mapper.PublicBoardMapper">
|
||||
<sql id="selectContentListWhere">
|
||||
<where>
|
||||
status <> 'DST008'
|
||||
<if test='publicType != null and publicType != ""'>
|
||||
and a.public_type = #{publicType}
|
||||
</if>
|
||||
|
|
@ -24,8 +25,8 @@
|
|||
<if test='endDate != null and endDate != ""'>
|
||||
and a.wrt_dt <= #{endDate}::date+1
|
||||
</if>
|
||||
<if test='tabStatus != null and tabStatus != ""'>
|
||||
and a.tab_status = #{tabStatus}
|
||||
<if test='selectedTab != null and selectedTab != ""'>
|
||||
and a.selected_tab = #{selectedTab}
|
||||
</if>
|
||||
<if test="downOrganCdList != null or upOrganCdList != null">
|
||||
and a.public_key in (
|
||||
|
|
|
|||
|
|
@ -79,6 +79,29 @@ $(document).on('click', '.deleteCommentBtn', function (){
|
|||
})
|
||||
})
|
||||
|
||||
$(document).on('click', '#deleteBtn', function (){
|
||||
if(confirm("삭제하시겠습니까?\n되돌릴 수 없습니다.")){
|
||||
contentFade("in");
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
data : JSON.stringify({publicKey: $("#viewModalPublicKey").val()}),
|
||||
url : "/publicBoard/deletePublicBoard",
|
||||
contentType: 'application/json',
|
||||
beforeSend: function (xhr){
|
||||
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
|
||||
},
|
||||
success : function(result) {
|
||||
alert("삭제되었습니다.");
|
||||
location.reload();
|
||||
},
|
||||
error : function(xhr, status) {
|
||||
alert("삭제를 실패하였습니다.")
|
||||
contentFade("out");
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
function getEditModal(publicKey, publicType){
|
||||
$.ajax({
|
||||
url: '/publicBoard/editModal',
|
||||
|
|
@ -156,7 +179,7 @@ function contentCheck(formId){
|
|||
flag = false;
|
||||
}
|
||||
if($("#publicType").val()==="PLB003"){
|
||||
if(!$("#tabStatus").val()){
|
||||
if(!$("#selectedTab").val()){
|
||||
alert("분류를 선택해주세요.")
|
||||
flag = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
$(document).on('click', '.referenceTab', function (){
|
||||
location.href = "/publicBoard/referencePage?tabStatus="+$(this).attr('data-tabcd')
|
||||
location.href = "/publicBoard/referencePage?selectedTab="+$(this).attr('data-tabcd')
|
||||
})
|
||||
|
||||
$(document).on('click', '#addReferenceBtn', function (){
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
<a href="/publicBoard/boardPage" class="nav-link link-dark">게시판</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/publicBoard/referencePage?tabStatus=RPC001" class="nav-link link-dark">자료실</a>
|
||||
<a href="/publicBoard/referencePage?selectedTab=RPC001" class="nav-link link-dark">자료실</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/publicBoard/qnaPage" class="nav-link link-dark">Q&A</a>
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@
|
|||
<div class="dashtit">
|
||||
<div class="row justify-content-between">
|
||||
<div class="col-auto">자료실</div>
|
||||
<div class="col-auto"><a href="/publicBoard/referencePage?tabStatus=RPC001" class="link-dark"><img src="img/dashboard/plus.png" alt="자료실 더보기 아이콘" /></a></div>
|
||||
<div class="col-auto"><a href="/publicBoard/referencePage?selectedTab=RPC001" class="link-dark"><img src="img/dashboard/plus.png" alt="자료실 더보기 아이콘" /></a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -162,6 +162,9 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-light">
|
||||
<th:block th:if="${#strings.contains(userRole, 'ROLE_SUB_ADMIN') or userSeq eq info.wrtUserSeq}"><!--관리자 or 작성자일 경우 삭제 허용-->
|
||||
<button type="button" class="btn btn-danger" id="deleteBtn">삭제</button>
|
||||
</th:block>
|
||||
<th:block th:if="${userSeq eq info.wrtUserSeq}"><!--작성자일 경우 수정 허용-->
|
||||
<button type="button" class="btn btn-warning" id="editBtn">수정</button>
|
||||
</th:block>
|
||||
|
|
|
|||
|
|
@ -89,15 +89,21 @@
|
|||
<td align="left" th:text="${notice.title}"></td>
|
||||
<td th:text="${notice.fileCnt eq null?'파일 없음':#strings.concat(notice.fileCnt,' 건')}"></td>
|
||||
<td th:text="${notice.commentCnt eq null?'0':notice.commentCnt}"></td>
|
||||
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
|
||||
<td th:if="${notice.wrtOrgan eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
|
||||
<td>
|
||||
<th:block th:each="code:${session.commonCode.get('OG')}">
|
||||
<th:block th:if="${notice.wrtOrgan eq code.itemCd}" th:text="${code.itemValue}"></th:block>
|
||||
</th:block>
|
||||
<th:block th:each="commonCode:${session.commonCode.get(notice.wrtOrgan)}">
|
||||
<td th:if="${notice.wrtPart eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
|
||||
</td>
|
||||
<td>
|
||||
<th:block th:each="code:${session.commonCode.get(notice.wrtOrgan)}">
|
||||
<th:block th:if="${notice.wrtPart eq code.itemCd}" th:text="${code.itemValue}"></th:block>
|
||||
</th:block>
|
||||
<th:block th:each="commonCode:${session.commonCode.get('JT')}">
|
||||
<td th:if="${notice.wrtUserGrd eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
|
||||
</td>
|
||||
<td>
|
||||
<th:block th:each="code:${session.commonCode.get('JT')}">
|
||||
<th:block th:if="${notice.wrtUserGrd eq code.itemCd}" th:text="${code.itemValue}"></th:block>
|
||||
</th:block>
|
||||
</td>
|
||||
<td th:text="${notice.wrtUserNm}"></td>
|
||||
<td th:text="${#temporals.format(notice.wrtDt, 'yyyy-MM-dd HH:mm')}"></td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -162,6 +162,9 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-light">
|
||||
<th:block th:if="${#strings.contains(userRole, 'ROLE_ADMIN') or userSeq eq info.wrtUserSeq}"><!--최상위 관리자 or 작성자일 경우 삭제 허용-->
|
||||
<button type="button" class="btn btn-danger" id="deleteBtn">삭제</button>
|
||||
</th:block>
|
||||
<th:block th:if="${userSeq eq info.wrtUserSeq}"><!--작성자일 경우 수정 허용-->
|
||||
<button type="button" class="btn btn-warning" id="editBtn">수정</button>
|
||||
</th:block>
|
||||
|
|
|
|||
|
|
@ -162,6 +162,9 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-light">
|
||||
<th:block th:if="${#strings.contains(userRole, 'ROLE_SUB_ADMIN') or userSeq eq info.wrtUserSeq}"><!--관리자 or 작성자일 경우 삭제 허용-->
|
||||
<button type="button" class="btn btn-danger" id="deleteBtn">삭제</button>
|
||||
</th:block>
|
||||
<th:block th:if="${userSeq eq info.wrtUserSeq}"><!--작성자일 경우 수정 허용-->
|
||||
<button type="button" class="btn btn-warning" id="editBtn">수정</button>
|
||||
</th:block>
|
||||
|
|
|
|||
|
|
@ -32,20 +32,11 @@
|
|||
<input type="checkbox" id="organChk" name="organChk" value="T" th:checked="${info.organChk eq 'T'}">
|
||||
</div>
|
||||
<label for="organChk" class="col-sm-2 col-form-label col-form-label-sm text-left">소속관서에만 노출</label>
|
||||
<!-- <div class="col-sm-2" >-->
|
||||
<!-- <select class="form-select form-select-sm" name="tabStatusList" id="tabStatusList" style="font-size: 1rem">-->
|
||||
<!-- <option value="">메뉴 선택-</option>-->
|
||||
<!-- <th:block th:each="tab:${tab.get('RPC')}">-->
|
||||
<!-- <option th:value="${tab.itemCd}" th:text="${tab.itemValue}"-->
|
||||
<!-- th:selected=""></option>-->
|
||||
<!-- </th:block>-->
|
||||
<!-- </select>-->
|
||||
<!-- </div>-->
|
||||
<div class="col-sm-2">
|
||||
<select class="form-select form-select-sm" name="tabStatus" id="tabStatus">
|
||||
<select class="form-select form-select-sm" name="selectedTab" id="selectedTab">
|
||||
<option value="">분류 선택</option>
|
||||
<th:block th:each="commonCode:${session.commonCode.get('RPC')}">
|
||||
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}">
|
||||
<th:block th:each="code:${session.commonCode.get('RPC')}">
|
||||
<option th:value="${code.itemCd}" th:text="${code.itemValue}">
|
||||
</option>
|
||||
</th:block>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -19,16 +19,16 @@
|
|||
<div class="col-12 card bg-light text-center">
|
||||
<div class="card-body">
|
||||
<ul class="nav nav-tabs" id="boardTab" role="tablist">
|
||||
<th:block th:each="tab:${tabStatusList}">
|
||||
<th:block th:each="code:${session.commonCode.get('RPC')}">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link referenceTab" th:data-tabcd="${tab.itemCd}" th:classappend="${tab.itemCd eq searchParams.tabStatus?'active':''}" data-bs-toggle="tab" type="button" role="tab" th:text="${tab.itemValue}"></button>
|
||||
<button class="nav-link referenceTab" th:data-tabcd="${code.itemCd}" th:classappend="${code.itemCd eq searchParams.selectedTab?'active':''}" data-bs-toggle="tab" type="button" role="tab" th:text="${code.itemValue}"></button>
|
||||
</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
<div class="tab-content bg-white border border-top-0 p-3" id="userContent">
|
||||
<form method="get" th:action="@{/publicBoard/referencePage}">
|
||||
<input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}">
|
||||
<input type="hidden" name="tabStatus" th:value="${searchParams.tabStatus}">
|
||||
<input type="hidden" name="selectedTab" th:value="${searchParams.selectedTab}">
|
||||
<div class="row justify-content-between py-1">
|
||||
<div class="col-auto">
|
||||
<select class="form-select form-select-sm" name="rowCnt" id="rowCnt">
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<label class="col-sm-1 col-form-label col-form-label-sm text-center">분류</label>
|
||||
<label class="col-sm-1 col-form-label col-form-label-sm text-start">
|
||||
<th:block th:each="code:${session.commonCode.get('RPC')}">
|
||||
<th:block th:if="${code.itemCd eq info.tabStatus}" th:text="${code.itemValue}"></th:block>
|
||||
<th:block th:if="${code.itemCd eq info.selectedTab}" th:text="${code.itemValue}"></th:block>
|
||||
</th:block>
|
||||
</label>
|
||||
<div class="col-sm-0"></div>
|
||||
|
|
@ -30,11 +30,11 @@
|
|||
<label class="col-sm-2 col-form-label col-form-label-sm text-start" th:text="${#temporals.format(info.wrtDt, 'yyyy-MM-dd HH:mm')}"></label>
|
||||
<label class="col-sm-1 col-form-label col-form-label-sm text-center">작성자</label>
|
||||
<label class="col-sm-2 col-form-label col-form-label-sm text-start">
|
||||
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
|
||||
<th:block th:if="${commonCode.itemCd eq info.wrtOrgan}" th:text="${commonCode.itemValue}"></th:block>
|
||||
<th:block th:each="code:${session.commonCode.get('OG')}">
|
||||
<th:block th:if="${code.itemCd eq info.wrtOrgan}" th:text="${code.itemValue}"></th:block>
|
||||
</th:block>
|
||||
<th:block th:each="commonCode:${session.commonCode.get('JT')}">
|
||||
<th:block th:if="${commonCode.itemCd eq info.wrtUserGrd}" th:text="${commonCode.itemValue}"></th:block>
|
||||
<th:block th:each="code:${session.commonCode.get('JT')}">
|
||||
<th:block th:if="${code.itemCd eq info.wrtUserGrd}" th:text="${code.itemValue}"></th:block>
|
||||
</th:block>
|
||||
<th:block th:text="${info.wrtUserNm}"></th:block>
|
||||
</label>
|
||||
|
|
@ -118,8 +118,8 @@
|
|||
<!--<th:block th:each="commonCode:${session.commonCode.get(comment.wrtOrgan)}">
|
||||
<div class="col-auto" th:if="${commonCode.itemCd eq comment.wrtPart}" th:text="${commonCode.itemValue}"></div>
|
||||
</th:block>-->
|
||||
<th:block th:each="commonCode:${session.commonCode.get('JT')}">
|
||||
<div class="col-auto" th:if="${commonCode.itemCd eq comment.wrtUserGrd}" th:text="${commonCode.itemValue}"></div>
|
||||
<th:block th:each="code:${session.commonCode.get('JT')}">
|
||||
<div class="col-auto" th:if="${code.itemCd eq comment.wrtUserGrd}" th:text="${code.itemValue}"></div>
|
||||
</th:block>
|
||||
<div class="col-auto" th:text="${comment.wrtUserNm}"></div>
|
||||
<div class="col-auto" th:text="${#temporals.format(comment.wrtDt, 'yyyy-MM-dd HH:mm')}"></div>
|
||||
|
|
@ -145,14 +145,14 @@
|
|||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="row">
|
||||
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
|
||||
<div class="col-auto" th:if="${commonCode.itemCd eq childComment.wrtOrgan}" th:text="${commonCode.itemValue}"></div>
|
||||
<th:block th:each="code:${session.commonCode.get('OG')}">
|
||||
<div class="col-auto" th:if="${code.itemCd eq childComment.wrtOrgan}" th:text="${code.itemValue}"></div>
|
||||
</th:block>
|
||||
<!--<th:block th:each="commonCode:${session.commonCode.get(childComment.wrtOrgan)}">
|
||||
<div class="col-auto" th:if="${commonCode.itemCd eq childComment.wrtPart}" th:text="${commonCode.itemValue}"></div>
|
||||
</th:block>-->
|
||||
<th:block th:each="commonCode:${session.commonCode.get('JT')}">
|
||||
<div class="col-auto" th:if="${commonCode.itemCd eq childComment.wrtUserGrd}" th:text="${commonCode.itemValue}"></div>
|
||||
<th:block th:each="code:${session.commonCode.get('JT')}">
|
||||
<div class="col-auto" th:if="${code.itemCd eq childComment.wrtUserGrd}" th:text="${code.itemValue}"></div>
|
||||
</th:block>
|
||||
<div class="col-auto" th:text="${childComment.wrtUserNm}"></div>
|
||||
<div class="col-auto" th:text="${#temporals.format(childComment.wrtDt, 'yyyy-MM-dd HH:mm')}"></div>
|
||||
|
|
@ -168,6 +168,9 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-light">
|
||||
<th:block th:if="${#strings.contains(userRole, 'ROLE_SUB_ADMIN') or userSeq eq info.wrtUserSeq}"><!--관리자 or 작성자일 경우 삭제 허용-->
|
||||
<button type="button" class="btn btn-danger" id="deleteBtn">삭제</button>
|
||||
</th:block>
|
||||
<th:block th:if="${userSeq eq info.wrtUserSeq}"><!--작성자일 경우 수정 허용-->
|
||||
<button type="button" class="btn btn-warning" id="editBtn">수정</button>
|
||||
</th:block>
|
||||
|
|
|
|||
Loading…
Reference in New Issue