견문삭제기능 추가

공용게시판 td 조정
master
강석 최 2023-04-24 09:39:38 +09:00
parent df115a3b87
commit 16870fc2a0
8 changed files with 65 additions and 10 deletions

View File

@ -6,6 +6,7 @@ import com.dbnt.faisp.main.fpiMgt.affair.model.AffairBoard;
import com.dbnt.faisp.main.fpiMgt.affair.model.AffairRating; import com.dbnt.faisp.main.fpiMgt.affair.model.AffairRating;
import com.dbnt.faisp.main.fpiMgt.affair.service.AffairService; import com.dbnt.faisp.main.fpiMgt.affair.service.AffairService;
import com.dbnt.faisp.main.organMgt.service.OrganConfigService; import com.dbnt.faisp.main.organMgt.service.OrganConfigService;
import com.dbnt.faisp.main.publicBoard.model.PublicBoard;
import com.dbnt.faisp.main.userInfo.model.UserInfo; import com.dbnt.faisp.main.userInfo.model.UserInfo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.core.annotation.AuthenticationPrincipal;
@ -196,4 +197,11 @@ public class AffairController { // 첩보수집활동 > 외사경찰 견문관
mav.addObject("affairRating", affairService.getAffairRating(affairBoard, affairBoard.getWrtOrgan())); mav.addObject("affairRating", affairService.getAffairRating(affairBoard, affairBoard.getWrtOrgan()));
return mav; return mav;
} }
@PostMapping("/deleteAffair")
@ResponseBody
public void deleteAffair (@RequestBody AffairBoard affair){
affairService.deleteAffair(affair.getAffairKey());
}
} }

View File

@ -2,6 +2,8 @@ package com.dbnt.faisp.main.fpiMgt.affair.repository;
import com.dbnt.faisp.main.fpiMgt.affair.model.AffairRating; import com.dbnt.faisp.main.fpiMgt.affair.model.AffairRating;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import java.util.List; import java.util.List;
@ -9,5 +11,7 @@ import java.util.List;
public interface AffairRatingRepository extends JpaRepository<AffairRating, AffairRating.AffairRatingId> { public interface AffairRatingRepository extends JpaRepository<AffairRating, AffairRating.AffairRatingId> {
List<AffairRating> findByAffairKeyOrderByRatingOrganAsc(Integer affairKey); List<AffairRating> findByAffairKeyOrderByRatingOrganAsc(Integer affairKey);
void deleteByAffairKey(Integer affairKey); @Modifying(clearAutomatically = true)
@Query("update AffairRating set affairStatus = :affairStatus where affairKey = :affairKey")
void bulkModifyingByAffairKeyToAffairStatus(Integer affairKey, String affairStatus);
} }

View File

@ -355,4 +355,9 @@ public class AffairService extends BaseService { // 견문보고
public List<DashboardAffair> selectApprvStayList(DashboardAffair affair) { public List<DashboardAffair> selectApprvStayList(DashboardAffair affair) {
return affairMapper.selectApprvStayList(affair); return affairMapper.selectApprvStayList(affair);
} }
@Transactional
public void deleteAffair(Integer affairKey) {
affairRatingRepository.bulkModifyingByAffairKeyToAffairStatus(affairKey, "DST008");
}
} }

View File

@ -6,6 +6,7 @@
<mapper namespace="com.dbnt.faisp.main.fpiMgt.affair.mapper.AffairMapper"> <mapper namespace="com.dbnt.faisp.main.fpiMgt.affair.mapper.AffairMapper">
<sql id="selectAffairBoardWhere"> <sql id="selectAffairBoardWhere">
<where> <where>
c.affair_status &lt;> 'DST008'
<if test='affairCategory != null and affairCategory != ""'> <if test='affairCategory != null and affairCategory != ""'>
and a.affair_category = #{affairCategory} and a.affair_category = #{affairCategory}
</if> </if>

View File

@ -228,6 +228,29 @@ $(document).on('click', '#fileDownBtn', function (){
} }
}) })
$(document).on('click', '#deleteBtn', function (){
if(confirm("삭제하시겠습니까?\n되돌릴 수 없습니다.")){
contentFade("in");
$.ajax({
type : 'POST',
data : JSON.stringify({affairKey: $("#viewModalAffairKey").val()}),
url : "/affair/deleteAffair",
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 getAffairViewModal(affairKey){ function getAffairViewModal(affairKey){
$.ajax({ $.ajax({
url: '/affair/affairViewModal', url: '/affair/affairViewModal',

View File

@ -342,7 +342,8 @@
<button type="button" class="btn btn-secondary" id="affairPrintBtn" th:data-affairkey="${affair.affairKey}">인쇄</button> <button type="button" class="btn btn-secondary" id="affairPrintBtn" th:data-affairkey="${affair.affairKey}">인쇄</button>
</th:block> </th:block>
<th:block th:if="${userOrgan eq 'OG001' and accessAuth eq 'ACC003'}"> <th:block th:if="${userOrgan eq 'OG001' and accessAuth eq 'ACC003'}">
<!--본청 관리자 상시 수정 허용--> <!--본청 관리자 상시 수정, 삭제 허용-->
<button type="button" class="btn btn-danger" id="deleteBtn">삭제</button>
<button type="button" class="btn btn-warning" id="modifyRatingViewBtn">결재정보수정</button> <button type="button" class="btn btn-warning" id="modifyRatingViewBtn">결재정보수정</button>
<button type="button" class="btn btn-warning" id="editAffairBtn">본문 수정</button> <button type="button" class="btn btn-warning" id="editAffairBtn">본문 수정</button>
</th:block> </th:block>
@ -352,6 +353,7 @@
<!--승인 상태가 아닐 때--> <!--승인 상태가 아닐 때-->
<th:block th:if="${userSeq eq affair.wrtUserSeq}"> <th:block th:if="${userSeq eq affair.wrtUserSeq}">
<!--작성자일 경우 수정 허용--> <!--작성자일 경우 수정 허용-->
<button type="button" class="btn btn-danger" id="deleteBtn">삭제</button>
<button type="button" class="btn btn-warning" id="editAffairBtn">본문 수정</button> <button type="button" class="btn btn-warning" id="editAffairBtn">본문 수정</button>
</th:block> </th:block>
</th:block> </th:block>

View File

@ -81,18 +81,24 @@
<input type="hidden" class="planKey" th:value="${board.publicKey}"> <input type="hidden" class="planKey" th:value="${board.publicKey}">
<!--<td><input type="checkbox" class="trChkBox"></td>--> <!--<td><input type="checkbox" class="trChkBox"></td>-->
<td th:text="${cnt.count}"></td> <td th:text="${cnt.count}"></td>
<td align="left" th:text="${board.title}"></td> <td class="text-start" th:text="${board.title}"></td>
<td th:text="${board.fileCnt eq null?'파일 없음':#strings.concat(board.fileCnt,' 건')}"></td> <td th:text="${board.fileCnt eq null?'파일 없음':#strings.concat(board.fileCnt,' 건')}"></td>
<td th:text="${board.commentCnt eq null?'0':board.commentCnt}"></td> <td th:text="${board.commentCnt eq null?'0':board.commentCnt}"></td>
<td>
<th:block th:each="commonCode:${session.commonCode.get('OG')}"> <th:block th:each="commonCode:${session.commonCode.get('OG')}">
<td th:if="${board.wrtOrgan eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td> <th:block th:if="${board.wrtOrgan eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></th:block>
</th:block> </th:block>
</td>
<td>
<th:block th:each="commonCode:${session.commonCode.get(board.wrtOrgan)}"> <th:block th:each="commonCode:${session.commonCode.get(board.wrtOrgan)}">
<td th:if="${board.wrtPart eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td> <th:block th:if="${board.wrtPart eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></th:block>
</th:block> </th:block>
</td>
<td>
<th:block th:each="commonCode:${session.commonCode.get('JT')}"> <th:block th:each="commonCode:${session.commonCode.get('JT')}">
<td th:if="${board.wrtUserGrd eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td> <th:block th:if="${board.wrtUserGrd eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></th:block>
</th:block> </th:block>
</td>
<td th:text="${board.wrtUserNm}"></td> <td th:text="${board.wrtUserNm}"></td>
<td th:text="${#temporals.format(board.wrtDt, 'yyyy-MM-dd HH:mm')}"></td> <td th:text="${#temporals.format(board.wrtDt, 'yyyy-MM-dd HH:mm')}"></td>
</tr> </tr>

View File

@ -82,18 +82,24 @@
<input type="hidden" class="planKey" th:value="${qna.publicKey}"> <input type="hidden" class="planKey" th:value="${qna.publicKey}">
<!--<td><input type="checkbox" class="trChkBox"></td>--> <!--<td><input type="checkbox" class="trChkBox"></td>-->
<td th:text="${cnt.count}"></td> <td th:text="${cnt.count}"></td>
<td align="left" th:text="${qna.title}"></td> <td class="text-start" th:text="${qna.title}"></td>
<td th:text="${qna.fileCnt eq null?'파일 없음':#strings.concat(qna.fileCnt,' 건')}"></td> <td th:text="${qna.fileCnt eq null?'파일 없음':#strings.concat(qna.fileCnt,' 건')}"></td>
<td th:text="${qna.commentCnt eq null?'0':qna.commentCnt}"></td> <td th:text="${qna.commentCnt eq null?'0':qna.commentCnt}"></td>
<td>
<th:block th:each="commonCode:${session.commonCode.get('OG')}"> <th:block th:each="commonCode:${session.commonCode.get('OG')}">
<td th:if="${qna.wrtOrgan eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td> <th:block th:if="${qna.wrtOrgan eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></th:block>
</th:block> </th:block>
</td>
<td>
<th:block th:each="commonCode:${session.commonCode.get(qna.wrtOrgan)}"> <th:block th:each="commonCode:${session.commonCode.get(qna.wrtOrgan)}">
<td th:if="${qna.wrtPart eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td> <th:block th:if="${qna.wrtPart eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></th:block>
</th:block> </th:block>
</td>
<td>
<th:block th:each="commonCode:${session.commonCode.get('JT')}"> <th:block th:each="commonCode:${session.commonCode.get('JT')}">
<td th:if="${qna.wrtUserGrd eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td> <th:block th:if="${qna.wrtUserGrd eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></th:block>
</th:block> </th:block>
</td>
<td th:text="${qna.wrtUserNm}"></td> <td th:text="${qna.wrtUserNm}"></td>
<td th:text="${#temporals.format(qna.wrtDt, 'yyyy-MM-dd HH:mm')}"></td> <td th:text="${#temporals.format(qna.wrtDt, 'yyyy-MM-dd HH:mm')}"></td>
</tr> </tr>