huangzhen
2023-10-19 1f69ad0de4a0abf9b50599146d8f9b6a22e803a3
src/main/java/com/gkhy/fourierSpecialGasMonitor/service/impl/GasCategoryServiceImpl.java
@@ -24,6 +24,7 @@
import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
@@ -213,8 +214,11 @@
        searchResult.setTotal(pageResult.getTotalElements());
        searchResult.setPages(pageResult.getTotalPages());
        if (!CollectionUtils.isEmpty(pageResult.getContent())){
            List<FindGasCategoryPageRespDTO> respDTOS = new ArrayList<>();
            BeanUtils.copyProperties(pageResult.getContent(),respDTOS);
            List<FindGasCategoryPageRespDTO> respDTOS = pageResult.getContent().stream().map(gasCategory -> {
                FindGasCategoryPageRespDTO dto = new FindGasCategoryPageRespDTO();
                BeanUtils.copyProperties(gasCategory,dto);
                return dto;
            }).collect(Collectors.toList());
            searchResult.setData(respDTOS);
        }
        return searchResult;