외사정보보고 삭제기능 추가. 내용 기본 높이 수정.

sri 내용 기본 높이 수정
master
강석 최 2023-04-24 10:44:58 +09:00
parent 16870fc2a0
commit 99bb9bd90f
8 changed files with 53 additions and 14 deletions

View File

@ -91,7 +91,6 @@ public class FaRptController {
faRptBoard.setWrtUserNm(loginUser.getUserNm()); faRptBoard.setWrtUserNm(loginUser.getUserNm());
faRptBoard.setWrtDt(LocalDateTime.now()); faRptBoard.setWrtDt(LocalDateTime.now());
} }
mav.addObject("frCategoryList", codeMgtService.selectCodeMgtList("FRC"));
mav.addObject("faRpt", faRptBoard); mav.addObject("faRpt", faRptBoard);
return mav; return mav;
} }
@ -122,4 +121,10 @@ public class FaRptController {
mav.addObject("userList", userList); mav.addObject("userList", userList);
return mav; return mav;
} }
@PostMapping("/deleteFaRpt")
@ResponseBody
public void deleteFaRpt (@RequestBody FaRptBoard faRpt){
faRptService.deleteFaRpt(faRpt.getFaRptKey());
}
} }

View File

@ -2,8 +2,12 @@ package com.dbnt.faisp.main.faRpt.repository;
import com.dbnt.faisp.main.faRpt.model.FaRptBoard; import com.dbnt.faisp.main.faRpt.model.FaRptBoard;
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;
public interface FaRptBoardRepository extends JpaRepository<FaRptBoard, Integer> { public interface FaRptBoardRepository extends JpaRepository<FaRptBoard, Integer> {
@Modifying(clearAutomatically = true)
@Query("update FaRptBoard set status = :status where faRptKey = :faRptKey")
void bulkModifyingByFaRptKeyToStatus(Integer faRptKey, String status);
} }

View File

@ -145,4 +145,9 @@ public class FaRptService extends BaseService {
public FileInfo selectFaRptFile(Integer faRptKey, Integer fileSeq) { public FileInfo selectFaRptFile(Integer faRptKey, Integer fileSeq) {
return faRptFileRepository.findById(new FaRptFile.FaRptFileId(faRptKey, fileSeq)).orElse(null); return faRptFileRepository.findById(new FaRptFile.FaRptFileId(faRptKey, fileSeq)).orElse(null);
} }
@Transactional
public void deleteFaRpt(Integer faRptKey) {
faRptBoardRepository.bulkModifyingByFaRptKeyToStatus(faRptKey, "DST008");
}
} }

View File

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

View File

@ -92,6 +92,29 @@ $(document).on('click', '#reSendBtn', function (){
getFaRptEditModal(faRpt); getFaRptEditModal(faRpt);
}) })
$(document).on('click', '#deleteBtn', function (){
if(confirm("삭제하시겠습니까?\n되돌릴 수 없습니다.")){
contentFade("in");
$.ajax({
type : 'POST',
data : JSON.stringify({faRptKey: $(this).attr('data-farptkey')}),
url : "/faRpt/deleteFaRpt",
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 getFaRptViewModal(faRptKey){ function getFaRptViewModal(faRptKey){
$.ajax({ $.ajax({
url: '/faRpt/faRptViewModal', url: '/faRpt/faRptViewModal',

View File

@ -32,8 +32,8 @@
<div class="col-sm-4"> <div class="col-sm-4">
<select class="form-select form-select-sm" id="faRptType" name="faRptType"> <select class="form-select form-select-sm" id="faRptType" name="faRptType">
<option value="">선택해주세요.</option> <option value="">선택해주세요.</option>
<th:block th:each="frCategory:${frCategoryList}"> <th:block th:each="code:${session.commonCode.get('FRC')}">
<option th:value="${frCategory.itemCd}" th:text="${frCategory.itemValue}" th:selected="${frCategory.itemCd eq faRpt.faRptType}"></option> <option th:if="${code.useChk eq 'T'}" th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq faRpt.faRptType}"></option>
</th:block> </th:block>
</select> </select>
</div> </div>
@ -100,14 +100,14 @@
<input type="hidden" class="userNm" th:value="${readUser.userNm}"> <input type="hidden" class="userNm" th:value="${readUser.userNm}">
<div class="col-1 rowSeq" th:text="${idx.index+1}"></div> <div class="col-1 rowSeq" th:text="${idx.index+1}"></div>
<div class="col-9"> <div class="col-9">
<th:block th:each="commonCode:${session.commonCode.get('OG')}"> <th:block th:each="code:${session.commonCode.get('OG')}">
<th:block th:if="${commonCode.itemCd eq readUser.ogCd}" th:text="${commonCode.itemValue}"></th:block> <th:block th:if="${code.itemCd eq readUser.ogCd}" th:text="${code.itemValue}"></th:block>
</th:block> </th:block>
<th:block th:each="commonCode:${session.commonCode.get(readUser.ogCd)}"> <th:block th:each="commonCode:${session.commonCode.get(readUser.ogCd)}">
<th:block th:if="${commonCode.itemCd eq readUser.ofcCd}" th:text="${commonCode.itemValue}"></th:block> <th:block th:if="${code.itemCd eq readUser.ofcCd}" th:text="${code.itemValue}"></th:block>
</th:block> </th:block>
<!--<th:block th:each="commonCode:${session.commonCode.get('JT')}"> <!--<th:block th:each="code:${session.commonCode.get('JT')}">
<th:block th:if="${commonCode.itemCd eq readUser.titleCd}" th:text="|${commonCode.itemValue} ${readUser.userNm}|"></th:block> <th:block th:if="${code.itemCd eq readUser.titleCd}" th:text="${code.itemValue}"></th:block>
</th:block>--> </th:block>-->
<th:block th:text="${readUser.userNm}"></th:block> <th:block th:text="${readUser.userNm}"></th:block>
</div> </div>

View File

@ -37,7 +37,7 @@
<hr class="my-1"> <hr class="my-1">
<div class="row mb-1 justify-content-center"> <div class="row mb-1 justify-content-center">
<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-center">내용</label>
<div class="col-sm-11 form-control-sm" th:utext="${faRpt.content}"></div> <div class="col-sm-11 form-control-sm view-modal-content" th:utext="${faRpt.content}"></div>
</div> </div>
<hr class="my-1"> <hr class="my-1">
<div class="row mb-1"> <div class="row mb-1">
@ -113,7 +113,8 @@
</div> </div>
</div> </div>
<div class="modal-footer bg-light"> <div class="modal-footer bg-light">
<th:block th:if="${userSeq eq faRpt.wrtUserSeq and accessAuth eq 'ACC003'}"> <th:block th:if="${userSeq eq faRpt.wrtUserSeq or accessAuth eq 'ACC003'}">
<button type="button" class="btn btn-danger" id="deleteBtn" th:data-farptkey="${faRpt.faRptKey}">삭제</button>
<button type="button" class="btn btn-warning" id="editFaRptBtn" th:data-farptkey="${faRpt.faRptKey}">수정</button> <button type="button" class="btn btn-warning" id="editFaRptBtn" th:data-farptkey="${faRpt.faRptKey}">수정</button>
</th:block> </th:block>
<th:block th:each="readUser:${faRpt.readUserList}"> <th:block th:each="readUser:${faRpt.readUserList}">

View File

@ -54,7 +54,7 @@
<hr class="my-1"> <hr class="my-1">
<div class="row mb-1 justify-content-center"> <div class="row mb-1 justify-content-center">
<label for="content" class="col-sm-1 col-form-label col-form-label-sm text-center fw-bold">내용</label> <label for="content" class="col-sm-1 col-form-label col-form-label-sm text-center fw-bold">내용</label>
<div class="col-sm-11 form-control-sm" id="content" th:utext="${faSri.content}"></div> <div class="col-sm-11 form-control-sm view-modal-content" id="content" th:utext="${faSri.content}"></div>
</div> </div>
<th:block th:if="${faSri.refKey ne null}"> <th:block th:if="${faSri.refKey ne null}">
<hr class="my-1"> <hr class="my-1">
@ -131,8 +131,8 @@
</div> </div>
<div class="modal-footer justify-content-between bg-light"> <div class="modal-footer justify-content-between bg-light">
<div class="col-auto"> <div class="col-auto">
<th:block th:unless="${faSri.status eq 'DST008'}"> <th:block th:if="${userSeq eq faSri.wrtUserSeq or accessAuth eq 'ACC003'}">
<button type="button" class="btn btn-danger" id="deleteSri" th:if="${userSeq eq faSri.wrtUserSeq} and ${accessAuth eq 'ACC003'}" th:data-fasrikey="${faSri.faSriKey}">삭제</button> <button type="button" class="btn btn-danger" id="deleteSri" th:data-fasrikey="${faSri.faSriKey}">삭제</button>
</th:block> </th:block>
</div> </div>
<div class="col-auto"> <div class="col-auto">