//需要字段名一致 List<UserCheckData> userCheckDataList = null;
List<UserCheckPO> list = userCheckPORepository.findAll(); if(CollectionUtils.isNotEmpty(list)){ userCheckDataList = list.stream().map(userCheckPO -> { UserCheckData userCheckData = new UserCheckData(); //将userCheckPO拷贝给userCheckData BeanUtils.copyProperties(userCheckPO, userCheckData); return userCheckData; }).collect(Collectors.toList()); }
方法1 为转载
转载地址:https://www.cnblogs.com/java-h/p/14212205.html
方法2:
outGoodsVehicleRouteDataTResult.setVehicleRouteInfos(outBoardGoodsListDataResponseBO.
getOutBoardGoodsListResponseBOList().stream().map(OutBoardListQueryConverter::
OutBoardGoodsListResponseBO2VehicleGoodsRouteInfoDTO).collect(Collectors.toList()));
public static VehicleRouteInfoDTO outBoardListResponseBO2VehicleRouteInfoDTO(OutBoardListResponseBO bo) { if (bo == null) { return null; } VehicleRouteInfoDTO vehicleRouteInfoDTO = new VehicleRouteInfoDTO(); vehicleRouteInfoDTO.setGoodsPointNo(bo.getGoodsPointNo()); vehicleRouteInfoDTO.setRelationGridId(bo.getRelationGridId()); vehicleRouteInfoDTO.setUserPreReceiptDate(bo.getUserPreReceiptDate()); vehicleRouteInfoDTO.setUserDemandQuantity(bo.getUserDemandQuantity()); vehicleRouteInfoDTO.setPlanSowQuantity(bo.getPlanSowQuantity()); vehicleRouteInfoDTO.setSowedQuantity(bo.getSowedQuantity()); vehicleRouteInfoDTO.setCloseContainerQuantity(bo.getCloseContainerQuantity()); vehicleRouteInfoDTO.setEntruckingOrderQuantity(bo.getEntruckingOrderQuantity()); vehicleRouteInfoDTO.setShippedQuantity(bo.getShippedQuanti
o2o