첩보수집활동 > 외사경찰 견문관리 > 계획수립 삭제기능 추가.

master
강석 최 2023-05-08 18:06:02 +09:00
parent 7152ceca7b
commit c9a5e64646
6 changed files with 57 additions and 9 deletions

View File

@ -208,6 +208,12 @@ public class PlanController { // 첩보수집활동 > 외사경찰 견문관리
return planService.planStateChange(apprv);
}
@PostMapping("/deletePlan")
@ResponseBody
public void deletePlan(@RequestBody PlanBoard planBoard){
planService.deletePlan(planBoard.getPlanKey());
}
@GetMapping("/planBoardJson")
public PlanBoard planBoardJson(PlanBoard planBoard, HttpSession session){
Map<String, List<CodeMgt>> codeMap = (Map<String, List<CodeMgt>>) session.getAttribute("commonCode");

View File

@ -2,8 +2,13 @@ package com.dbnt.faisp.main.fpiMgt.affairPlan.repository;
import com.dbnt.faisp.main.fpiMgt.affairPlan.model.PlanBoard;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
public interface PlanBoardRepository extends JpaRepository<PlanBoard, Integer> {
@Modifying(clearAutomatically = true)
@Query("update PlanBoard set planState = :planState where planKey = :planKey")
void bulkModifyingByPlanKeyToStatus(Integer planKey, String planState);
}

View File

@ -157,4 +157,9 @@ public class PlanService extends BaseService { // 월간계획
planBoard.setWrtUserGrd(Utils.searchCodeValue(planBoard.getWrtUserGrd(), codeMap.get("JT")));
return planBoard;
}
@Transactional
public void deletePlan(Integer planKey) {
planBoardRepository.bulkModifyingByPlanKeyToStatus(planKey, "DST008");
}
}

View File

@ -6,6 +6,7 @@
<mapper namespace="com.dbnt.faisp.main.fpiMgt.affairPlan.mapper.PlanMapper">
<sql id="selectPlanBoardListWhere">
<where>
plan_state &lt;> 'DST008'
<if test='wrtUserSeq != null and wrtUserSeq != ""'>
and a.wrt_user_seq = #{wrtUserSeq}
</if>

View File

@ -34,6 +34,29 @@ $(document).on('click', '#editPlanBtn', function (){
getPlanEditModal(Number($("#planViewBody").find("[name='planKey']").val()));
})
$(document).on('click', '#deletePlanBtn', function (){
if(confirm("삭제하시겠습니까?\n되돌릴 수 없습니다.")){
contentFade("in");
$.ajax({
type : 'POST',
data : JSON.stringify({planKey: $("#viewModalPlanKey").val()}),
url : "/affairPlan/deletePlan",
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");
}
})
}
})
$(document).on('click', '#planAddBtn', function (){
$("#planDiv").append("<input type='text' class='form-control' name='planInfos'>")
})

View File

@ -164,15 +164,23 @@
</div>
</div>
<th:block th:if="${modalType ne 'viewOnly'}">
<div class="modal-footer bg-light">
<th:block th:if="${plan.planState eq 'DST006'}">
<button type="button" class="btn btn-secondary" id="planPrintBtn" th:data-plankey="${plan.planKey}">인쇄</button>
</th:block>
<th:block th:unless="${plan.planState eq 'DST004' or plan.planState eq 'DST006'}"><!--승인 상태일때는 수정 불가-->
<th:block th:if="${userSeq eq plan.wrtUserSeq or accessAuth eq 'ACC003'}"><!--작성자일 경우 수정 허용--><!--관리자일 경우 수정 허용-->
<button type="button" class="btn btn-warning" id="editPlanBtn">수정</button>
<div class="modal-footer justify-content-between bg-light">
<div class="col-auto">
<th:block th:unless="${plan.planState eq 'DST004' or plan.planState eq 'DST006'}"><!--승인 상태일때는 수정 불가-->
<th:block th:if="${userSeq eq plan.wrtUserSeq or accessAuth eq 'ACC003'}"><!--작성자일 경우 수정 허용--><!--관리자일 경우 수정 허용-->
<button type="button" class="btn btn-danger" id="deletePlanBtn">삭제</button>
</th:block>
</th:block>
</th:block>
<!-- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>-->
</div>
<div class="col-auto">
<th:block th:if="${plan.planState eq 'DST006'}">
<button type="button" class="btn btn-secondary" id="planPrintBtn" th:data-plankey="${plan.planKey}">인쇄</button>
</th:block>
<th:block th:unless="${plan.planState eq 'DST004' or plan.planState eq 'DST006'}"><!--승인 상태일때는 수정 불가-->
<th:block th:if="${userSeq eq plan.wrtUserSeq or accessAuth eq 'ACC003'}"><!--작성자일 경우 수정 허용--><!--관리자일 경우 수정 허용-->
<button type="button" class="btn btn-warning" id="editPlanBtn">수정</button>
</th:block>
</th:block>
</div>
</div>
</th:block>