enhance crud jenis pengadaan

This commit is contained in:
dirgantarasiahaan
2023-05-25 00:46:50 +07:00
parent 28f17d5b54
commit f96c8d2f17
12 changed files with 340 additions and 53 deletions

View File

@@ -0,0 +1,32 @@
package com.iconplus.smartproc.service.jenispengadaan;
import com.iconplus.smartproc.exception.BusinessException;
import com.iconplus.smartproc.helper.service.BaseService;
import com.iconplus.smartproc.model.request.JenisPengadaanRequest;
import com.iconplus.smartproc.model.response.JenisPengadaanResponse;
import com.iconplus.smartproc.repository.JenisPengadaanRepository;
import org.springframework.stereotype.Service;
@Service
public class GetJenisPengadaanService implements BaseService<JenisPengadaanRequest, JenisPengadaanResponse> {
private JenisPengadaanRepository jenisPengadaanRepository;
public GetJenisPengadaanService(JenisPengadaanRepository jenisPengadaanRepository) {
this.jenisPengadaanRepository = jenisPengadaanRepository;
}
@Override
public JenisPengadaanResponse execute(JenisPengadaanRequest input) {
var jenisPengadaan = jenisPengadaanRepository.findByIdAndIsDeleteFalse(input.getId())
.orElseThrow(() -> new BusinessException("err", "err", "err"));
return JenisPengadaanResponse.builder()
.id(jenisPengadaan.getId())
.jenisPengadaan(jenisPengadaan.getJenisPengadaan())
.keterangan(jenisPengadaan.getKeterangan())
.isActive(jenisPengadaan.getIsActive())
.isDelete(jenisPengadaan.getIsDelete())
.build();
}
}