huangzhen
2023-10-20 5c72b20bee11513c06cdfb30c52cd0a4016a7102
src/main/java/com/gkhy/fourierSpecialGasMonitor/service/impl/GasThresholdServiceImpl.java
@@ -26,6 +26,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
 * @author Mr.huang
@@ -58,9 +59,12 @@
        Result success = Result.success();
        List<GasThreshold> gasThresholds = gasThresholdRepository.findAll();
        if (!CollectionUtils.isEmpty(gasThresholds)){
            List<GasThresholdListRespDTO> respDTOS = new ArrayList<>();
            BeanUtils.copyProperties(gasThresholds,respDTOS);
            success.setData(respDTOS);
            List<GasThresholdListRespDTO> collect = gasThresholds.stream().map(gasThreshold -> {
                GasThresholdListRespDTO dto = new GasThresholdListRespDTO();
                BeanUtils.copyProperties(gasThreshold, dto);
                return dto;
            }).collect(Collectors.toList());
            success.setData(collect);
        }
        return success;
    }