주요사건처리현황 3차
parent
90911da1ed
commit
d858c0ebac
|
|
@ -93,9 +93,9 @@ public class MajorStatusController {
|
|||
|
||||
@PostMapping("/deleteContent")
|
||||
@ResponseBody
|
||||
public void deleteContent(@AuthenticationPrincipal UserInfo loginUser, @RequestBody List<MajorStatus> majorStatuses){
|
||||
public void deleteContent(@RequestBody MajorStatus majorStatus){
|
||||
|
||||
majorStatusService.deleteContent(majorStatuses,loginUser);
|
||||
majorStatusService.deleteContent(majorStatus);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,4 +11,6 @@ public interface MajorFileRepository extends JpaRepository<MajorFile, MajorFile.
|
|||
List<MajorFile> findByMajorKey(Integer majorKey);
|
||||
Optional<MajorFile> findTopByMajorKeyOrderByFileSeq(Integer majorKey);
|
||||
|
||||
void deleteByMajorKey(Integer majorKey);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
public interface MajorStatusRepository extends JpaRepository<MajorStatus, Integer> {
|
||||
|
||||
void deleteByMajorKey(Integer majorKey);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.dbnt.faisp.config.BaseService;
|
|||
import com.dbnt.faisp.config.FileInfo;
|
||||
import com.dbnt.faisp.main.counterIntelligence.activityCase.model.ActivityCaseFile;
|
||||
import com.dbnt.faisp.main.equip.model.Equip;
|
||||
import com.dbnt.faisp.main.fipTarget.model.VulnFile;
|
||||
import com.dbnt.faisp.main.ivsgtMgt.boardInvestigation.model.BoardInvestigation;
|
||||
import com.dbnt.faisp.main.ivsgtMgt.boardInvestigation.model.IvsgtFile;
|
||||
import com.dbnt.faisp.main.ivsgtMgt.majorStatus.mapper.MajorStatusMapper;
|
||||
|
|
@ -86,14 +87,17 @@ public class MajorStatusService extends BaseService {
|
|||
}
|
||||
}
|
||||
|
||||
public void deleteContent(MajorStatus majorStatus){
|
||||
|
||||
public void deleteContent(List<MajorStatus> majorStatuses, UserInfo loginUser){
|
||||
|
||||
for(MajorStatus majorStatus : majorStatuses){
|
||||
|
||||
majorStatusRepository.deleteByMajorKey(majorStatus.getMajorKey());
|
||||
//파일삭제
|
||||
List<MajorFile> MajorFileList = majorFileRepository.findByMajorKey(majorStatus.getMajorKey());
|
||||
if(MajorFileList != null) {
|
||||
for(MajorFile file: MajorFileList){
|
||||
deleteStoredFile(new File(file.getSavePath(), file.getConvNm()));
|
||||
}
|
||||
|
||||
}
|
||||
majorFileRepository.deleteByMajorKey(majorStatus.getMajorKey());
|
||||
majorStatusRepository.deleteById(majorStatus.getMajorKey());
|
||||
}
|
||||
|
||||
private void deleteMajorFile(Integer majorKey, List<Integer> deleteFileSeq) {
|
||||
|
|
|
|||
|
|
@ -41,49 +41,61 @@ $(function(){
|
|||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).on('click', '#delectMajorBtn', function (){
|
||||
if(confirm("선택한 대상을 삭제처리 하시겠습니까?")){
|
||||
const checkArr = [];
|
||||
$('input:checkbox[name=equChk]:checked').each(function (idx, el){
|
||||
checkArr.push({});
|
||||
const target = $(el);
|
||||
checkArr[idx].equKey = Number(target.parents('tr').find('.majorKey').val());
|
||||
})
|
||||
deleteMajor(checkArr);
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
// $(document).on('click', '#deleteEquip', function (){
|
||||
// if(confirm("선택한 대상을 삭제처리 하시겠습니까?")){
|
||||
// const checkArr = [];
|
||||
// checkArr.push({});
|
||||
// checkArr[0].equKey = Number($('#mEquKey').val());
|
||||
// deleteEquip(checkArr);
|
||||
// }
|
||||
// })
|
||||
|
||||
function deleteMajor(checkArr){
|
||||
$(document).on('click', '#deleteMajorBtn', function (){
|
||||
const majorKey = $('input[name=majorKey]').val();
|
||||
console.log(majorKey);
|
||||
if(confirm("삭제하시겠습니까?")){
|
||||
contentFade("in");
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : "/ivsgt/deleteContent",
|
||||
data : JSON.stringify(checkArr),
|
||||
data : JSON.stringify({majorKey:majorKey}),
|
||||
contentType: 'application/json',
|
||||
beforeSend: function (xhr){
|
||||
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
|
||||
},
|
||||
success : function() {
|
||||
alert("삭제처리 되었습니다.");
|
||||
success : function(data) {
|
||||
alert("삭제 처리되었습니다.");
|
||||
location.reload();
|
||||
},
|
||||
error : function(xhr, status) {
|
||||
alert("삭제처리에 실패하였습니다");
|
||||
alert("삭제 처리에 실패하였습니다");
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// $(document).on('click', '#delectMajorBtn', function (){
|
||||
// if(confirm("선택한 대상을 삭제처리 하시겠습니까?")){
|
||||
// const checkArr = [];
|
||||
// $('input:checkbox[name=equChk]:checked').each(function (idx, el){
|
||||
// checkArr.push({});
|
||||
// const target = $(el);
|
||||
// checkArr[idx].equKey = Number(target.parents('tr').find('.majorKey').val());
|
||||
// })
|
||||
// deleteMajor(checkArr);
|
||||
//
|
||||
// }
|
||||
// })
|
||||
|
||||
// function deleteMajor(checkArr){
|
||||
// $.ajax({
|
||||
// type : 'POST',
|
||||
// url : "/ivsgt/deleteContent",
|
||||
// data : JSON.stringify(checkArr),
|
||||
// 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("삭제처리에 실패하였습니다");
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
function getEditModal(majorKey){
|
||||
$.ajax({
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
</th:block>
|
||||
<div layout:fragment="content">
|
||||
<main>
|
||||
<h4>주요사건처리현황t</h4>
|
||||
<h4>주요사건처리현황</h4>
|
||||
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
|
||||
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
|
||||
<div class="row mx-0">
|
||||
|
|
|
|||
|
|
@ -76,5 +76,6 @@
|
|||
<th:block th:if="${userSeq eq majorStatus.wrtUserSeq}"><!--작성자일 경우 수정 허용-->
|
||||
<button type="button" class="btn btn-warning" id="editBtn" th:data-majorkey="${majorStatus.majorKey}">수정</button>
|
||||
</th:block>
|
||||
<button type="button" class="btn btn-danger" id="deleteMajorBtn">삭제</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
||||
</div>
|
||||
Loading…
Reference in New Issue