huangzhen
2023-12-19 2dd2e7f54db7149965acaa11d933f85b31fbd59c
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;
    }