외사대상목표 > 외사분실 삭제 기능 추가.

master
강석 최 2023-05-08 15:46:21 +09:00
parent 9455c8e8cb
commit da56efe8eb
6 changed files with 17 additions and 64 deletions

View File

@ -5,20 +5,15 @@ import com.dbnt.faisp.main.fipTarget.model.PartInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
public interface PartInfoRepository extends JpaRepository<PartInfo, PartInfo.PartInfoId> {
PartInfo findFirstByOrderByPiSeqDesc();
void deleteByPiSeq(Integer piSeq);
@Modifying(clearAutomatically = true)
@Query("update PartInfo set piState = :piState where piSeq = :piSeq")
void bulkModifyingByPiSeqToPiState(Integer piSeq, String piState);
}

View File

@ -4,24 +4,15 @@ package com.dbnt.faisp.main.fipTarget.repository;
import com.dbnt.faisp.main.fipTarget.model.PartWork;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
public interface PartWorkRepository extends JpaRepository<PartWork, PartWork.PartWorkId> {
PartWork findTopByPiSeqOrderByPwSeqDesc(Integer piSeq);
void deleteByPwSeqAndPiSeq(Integer pwSeq, Integer piSeq);
void deleteByPiSeq(Integer piSeq);
@Modifying(clearAutomatically = true)
@Query("update PartWork set status = :status where pwSeq = :pwSeq and piSeq = :piSeq")
void bulkModifyingByPwSeqAndPiSeqToStatus(Integer pwSeq, Integer piSeq, String status);
}

View File

@ -195,25 +195,7 @@ public class FipTargetService extends BaseService {
@Transactional
public void deletePartInfo(PartInfo partInfo) {
//외사실적 파일,데이터삭제
List<PartWorkFile> partWorkFileList = partWorkFileRepository.findByPiSeq(partInfo.getPiSeq());
if(partWorkFileList != null) {
for(PartWorkFile file: partWorkFileList){
deleteStoredFile(new File(file.getFilePath(), file.getConvNm()));
partWorkFileRepository.deleteByPwSeqAndPiSeq(file.getPwSeq(),file.getPiSeq());
}
}
partWorkRepository.deleteByPiSeq(partInfo.getPiSeq());
//외사분실운영현황파일삭제
List<PartInfoFile> partInfoFileList= selectPartInfoFile(partInfo);
for(PartInfoFile file: partInfoFileList){
if(file.getOrigNm() != null){
deleteStoredFile(new File(file.getFilePath(), file.getConvNm()));
}
}
partInfoFileRepository.deleteByPiSeq(partInfo.getPiSeq());
partInfoRepository.deleteByPiSeq(partInfo.getPiSeq());
partInfoRepository.bulkModifyingByPiSeqToPiState(partInfo.getPiSeq(), "DST008");
}
public PartInfoFile selectPartInfoFileDown(Integer fileSeq, Integer piSeq, Integer versionNo) {
@ -312,15 +294,7 @@ public class FipTargetService extends BaseService {
@Transactional
public void deletePartWork(PartWork partWork) {
//파일삭제
List<PartWorkFile> partWorkFileList= partWorkFileRepository.findByPwSeqAndPiSeq(partWork.getPwSeq(),partWork.getPiSeq());
if(partWorkFileList != null) {
for(PartWorkFile file: partWorkFileList){
deleteStoredFile(new File(file.getFilePath(), file.getConvNm()));
}
}
partWorkFileRepository.deleteByPwSeqAndPiSeq(partWork.getPwSeq(),partWork.getPiSeq());
partWorkRepository.deleteByPwSeqAndPiSeq(partWork.getPwSeq(),partWork.getPiSeq());
partWorkRepository.bulkModifyingByPwSeqAndPiSeqToStatus(partWork.getPwSeq(), partWork.getPiSeq(), "DST008");
}
public PartWorkFile selectPartWorkFileDown(Integer fileSeq, Integer pwSeq, Integer piSeq) {

View File

@ -58,8 +58,8 @@
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
<include refid="selectPartInfoListWhere"></include>
and pi.version_no = b.lastVer
<include refid="selectPartInfoListWhere"></include>
order by pi_seq desc
<if test='excel != "Y"'>
limit #{rowCnt} offset #{firstIndex}

View File

@ -158,7 +158,7 @@
<div class="modal-footer justify-content-between bg-light">
<div class="col-auto">
<!-- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>-->
<!--<button type="button" class="btn btn-danger" id="deletePartInfo">삭제</button>-->
<button type="button" class="btn btn-danger" id="deletePartInfo">삭제</button>
</div>
<div class="col-auto">
<button type="button" class="btn btn-warning" id="mSaveTempBtn">임시저장</button>

View File

@ -81,15 +81,8 @@
</form>
</div>
<div class="modal-footer justify-content-between bg-light">
<div class="col-auto">
<!--
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
-->
<th:block th:if="${userSeq eq pwInfo.wrtUserSeq} or ${accessAuth eq 'ACC003'}">
<button type="button" class="btn btn-danger" id="deletePartWork">삭제</button>
</th:block>
</div>
<th:block th:if="${userSeq eq pwInfo.wrtUserSeq} or ${accessAuth eq 'ACC003'}"><!--작성자 관리자일 경우 수정 허용-->
<th:block th:if="${userSeq eq pwInfo.wrtUserSeq} or ${accessAuth eq 'ACC003'}">
<button type="button" class="btn btn-danger" id="deletePartWork">삭제</button>
<button type="button" class="btn btn-warning" id="updateBtn">수정</button>
</th:block>
</div>