enhance crud jenis pengadaan
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.iconplus.smartproc.service.jenispengadaan;
|
||||
|
||||
import com.iconplus.smartproc.exception.BusinessException;
|
||||
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||
import com.iconplus.smartproc.helper.service.BaseService;
|
||||
import com.iconplus.smartproc.model.request.JenisPengadaanRequest;
|
||||
import com.iconplus.smartproc.repository.JenisPengadaanRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class DeleteJenisPengadaanService implements BaseService<JenisPengadaanRequest, EmptyResponse> {
|
||||
|
||||
private JenisPengadaanRepository jenisPengadaanRepository;
|
||||
public DeleteJenisPengadaanService(JenisPengadaanRepository jenisPengadaanRepository) {
|
||||
this.jenisPengadaanRepository = jenisPengadaanRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmptyResponse execute(JenisPengadaanRequest input) {
|
||||
var jenisPengadaan = jenisPengadaanRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||
.orElseThrow(() -> new BusinessException("err", "err", "err"));
|
||||
jenisPengadaan.setIsDelete(true);
|
||||
jenisPengadaanRepository.save(jenisPengadaan);
|
||||
return new EmptyResponse();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user