외사수사관리 > 사건보고서 삭제 기능 추가.

외사방첩관리 > 방첩공작 삭제 기능 추가.
master
강석 최 2023-05-08 10:50:16 +09:00
parent f01974b28c
commit 06168d71de
9 changed files with 49 additions and 16 deletions

View File

@ -1,21 +1,11 @@
package com.dbnt.faisp.main.budget;
import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
import com.dbnt.faisp.main.codeMgt.service.CodeMgtService;
import com.dbnt.faisp.main.faRpt.model.FaRptBoard;
import com.dbnt.faisp.main.faRpt.model.FaRptReadUser;
import com.dbnt.faisp.main.faRpt.service.FaRptService;
import com.dbnt.faisp.main.userInfo.model.UserInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/budget")

View File

@ -91,13 +91,13 @@ public class CounterIntelligenceController {
@PostMapping("/deleteCiWork")
public Integer deleteCiWork(@AuthenticationPrincipal UserInfo loginUser, CounterIntelligenceWork ciWork){
String accessAuth = authMgtService.selectAccessConfigList
(loginUser.getUserSeq(), "/counterIntelligence/ciWorkList").get(0).getAccessAuth();
if(accessAuth.equals("ACC003")){
// String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/counterIntelligence/ciWorkList").get(0).getAccessAuth();
return ciService.deleteCiWork(ciWork.getCiwKey());
/*if(accessAuth.equals("ACC003")){
return ciService.deleteCiWork(ciWork.getCiwKey());
}else{
return 0;
}
}*/
}
@GetMapping("/CiWorkStatistics")
public ModelAndView ciWorkStatistics(@AuthenticationPrincipal UserInfo loginUser, CiWorkStatistics ciWorkStatistics){

View File

@ -128,7 +128,7 @@ public class CounterIntelligenceService extends BaseService {
@Transactional
public Integer deleteCiWork(Integer ciwKey) {
CounterIntelligenceWork ciWork = ciwRepository.findById(ciwKey).orElse(null);
CounterIntelligenceWork ciWork = ciwRepository.findById(ciwKey).orElse(new CounterIntelligenceWork());
ciWork.setStatus("DST008");
return ciwKey;
}

View File

@ -100,4 +100,10 @@ public class IvsgtController {
return mav;
}
@PostMapping("/deleteIvsgtReport")
@ResponseBody
public void deleteIvsgtReport(@RequestBody InvestigationBoard ivsgtReport){
ivsgtService.deleteIvsgtReport(ivsgtReport.getIvsgtKey());
}
}

View File

@ -2,7 +2,12 @@ package com.dbnt.faisp.main.ivsgtMgt.boardInvestigation.repository;
import com.dbnt.faisp.main.ivsgtMgt.boardInvestigation.model.InvestigationBoard;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
public interface InvestigationBoardRepository extends JpaRepository<InvestigationBoard, Integer> {
@Modifying(clearAutomatically = true)
@Query("update InvestigationBoard set status = :status where ivsgtKey = :ivsgtKey")
void bulkModifyingByIvsgtKeyToStatus(Integer ivsgtKey, String status);
}

View File

@ -113,4 +113,9 @@ public class IvsgtService extends BaseService {
public FileInfo selectIvsgtFile(Integer parentKey, Integer fileSeq) {
return ivsgtFileRepository.findById(new InvestigationFile.InvestigationFileId(parentKey, fileSeq)).orElse(null);
}
@Transactional
public void deleteIvsgtReport(Integer ivsgtKey) {
ivsgtboardRepository.bulkModifyingByIvsgtKeyToStatus(ivsgtKey, "DST008");
}
}

View File

@ -6,6 +6,7 @@
<mapper namespace="com.dbnt.faisp.main.ivsgtMgt.boardInvestigation.mapper.InvestigationBoardMapper">
<sql id="selectInvestigationBoardListWhere">
<where>
status &lt;> 'DST008'
<if test='downOrganCdList != null'>
and a.wrt_organ in
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
@ -109,5 +110,6 @@
INNER JOIN investigation_board i
ON i.ivsgt_key = a.related_report_key
WHERE a.parent_ivsgt_key = #{ivsgtKey}
and i.status &lt;> 'DST008'
</select>
</mapper>

View File

@ -7,6 +7,29 @@ $(document).on('click', '#ivsgtEditBtn', function () {
getIvsgtEditModal(Number($("#ivsgtViewBody").find("[name='ivsgtKey']").val()));
});
$(document).on('click', '#ivsgtDeleteBtn', function (){
if(confirm("삭제하시겠습니까?\n되돌릴 수 없습니다.")){
contentFade("in");
$.ajax({
type : 'POST',
data : JSON.stringify({ivsgtKey: $("#ivsgtViewBody").find("[name='ivsgtKey']").val()}),
url : "/ivsgt/deleteIvsgtReport",
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('change', '#arrestCd', function (){
$(".arrestCd2").hide();
$("."+this.value).show();

View File

@ -132,7 +132,9 @@
</div>
<th:block th:if="${modalType ne 'viewOnly'}">
<div class="modal-footer bg-light">
<th:block th:if="${userSeq eq investigation.wrtUserSeq or accessAuth eq 'ACC003'}"><!--작성자일 경우 수정 허용--><!--관리자일 경우 수정 허용-->
<th:block th:if="${userSeq eq investigation.wrtUserSeq or accessAuth eq 'ACC003'}">
<!--작성자, 관리자일 경우 -->
<button type="button" class="btn btn-danger" id="ivsgtDeleteBtn">삭제</button>
<button type="button" class="btn btn-warning" id="ivsgtEditBtn">수정</button>
</th:block>
<!-- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>-->