|
@@ -1,10 +1,10 @@
|
|
|
package com.its.op.service.its.facility;
|
|
|
|
|
|
import com.its.op.dao.repository.its.facility.TbFcltSubjPartInRepository;
|
|
|
+import com.its.op.dto.its.common.NewIdLongDto;
|
|
|
import com.its.op.dto.its.facility.TbFcltSubjPartDto;
|
|
|
import com.its.op.dto.its.facility.TbFcltSubjPartInDto;
|
|
|
import com.its.op.entity.its.facility.TbFcltSubjPartIn;
|
|
|
-import com.its.op.entity.its.facility.TbFcltSubjPartInKey;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -24,7 +24,7 @@ public class TbFcltSubjPartInService {
|
|
|
private final TbFcltSubjPartService partService;
|
|
|
|
|
|
// 데이터 1건 조회, 없으면 exception
|
|
|
- private TbFcltSubjPartIn requireOne(TbFcltSubjPartInKey id) throws NoSuchElementException {
|
|
|
+ private TbFcltSubjPartIn requireOne(Long id) throws NoSuchElementException {
|
|
|
Optional<TbFcltSubjPartIn> info = this.repo.findById(id);
|
|
|
if (info.isPresent()) {
|
|
|
return info.get();
|
|
@@ -50,8 +50,7 @@ public class TbFcltSubjPartInService {
|
|
|
public TbFcltSubjPartInDto mergeInfo(TbFcltSubjPartInDto.TbFcltSubjPartInUpdReq req) {
|
|
|
TbFcltSubjPartIn subjPart = null;
|
|
|
try {
|
|
|
- TbFcltSubjPartInKey key = new TbFcltSubjPartInKey(req.getPartNmbr(), req.getInDt());
|
|
|
- subjPart = requireOne(key);
|
|
|
+ subjPart = requireOne(req.getInSeq());
|
|
|
} catch (Exception e) {
|
|
|
log.info("New Data: {}", req);
|
|
|
}
|
|
@@ -74,14 +73,14 @@ public class TbFcltSubjPartInService {
|
|
|
|
|
|
// 정보 삭제-개별, 데이터 존재하지 않으면 Exception
|
|
|
@Transactional
|
|
|
- public TbFcltSubjPartInDto deleteById(TbFcltSubjPartInKey id) {
|
|
|
- TbFcltSubjPartIn entity = requireOne(id);
|
|
|
+ public TbFcltSubjPartInDto deleteById(Long inSeq) {
|
|
|
+ TbFcltSubjPartIn entity = requireOne(inSeq);
|
|
|
|
|
|
- this.repo.deleteById(id);
|
|
|
+ this.repo.deleteById(inSeq);
|
|
|
|
|
|
- TbFcltSubjPartDto part = this.partService.findById(id.getPartNmbr());
|
|
|
+ TbFcltSubjPartDto part = this.partService.findById(entity.getPartNmbr());
|
|
|
int validCnt = part.getValidCnt() - entity.getInCnt();
|
|
|
- this.partService.updateValidCount(id.getPartNmbr(), validCnt);
|
|
|
+ this.partService.updateValidCount(entity.getPartNmbr(), validCnt);
|
|
|
|
|
|
return entity.toDto();
|
|
|
}
|
|
@@ -105,4 +104,11 @@ public class TbFcltSubjPartInService {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional(readOnly = true)
|
|
|
+ public NewIdLongDto getNewNmbr() {
|
|
|
+ Long newId = this.repo.getNewNmbr();
|
|
|
+ return NewIdLongDto.builder().newId(newId).build();
|
|
|
+ }
|
|
|
+
|
|
|
}
|