enhance crud jenis pengadaan
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
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 PutUpdateJenisPengadaanService implements BaseService<JenisPengadaanRequest, JenisPengadaanResponse> {
|
||||
|
||||
private JenisPengadaanRepository jenisPengadaanRepository;
|
||||
public PutUpdateJenisPengadaanService(JenisPengadaanRepository jenisPengadaanRepository) {
|
||||
this.jenisPengadaanRepository = jenisPengadaanRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JenisPengadaanResponse execute(JenisPengadaanRequest input) {
|
||||
var jenisPengadaan = jenisPengadaanRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||
.orElseThrow(() -> new BusinessException("err", "err", "err"));
|
||||
jenisPengadaan.setJenisPengadaan(input.getJenisPengadaan());
|
||||
jenisPengadaan.setKeterangan(input.getKeterangan());
|
||||
jenisPengadaan.setIsActive(input.getIsActive());
|
||||
jenisPengadaanRepository.save(jenisPengadaan);
|
||||
return JenisPengadaanResponse.builder()
|
||||
.id(jenisPengadaan.getId())
|
||||
.build();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user