//需要字段名一致
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()); }
// 从数据库中查询出的对象集合 List<OperationStation> operationStations = operationStationJoinMapper.selectJoinByExample(example); // 判端是否为空 if (CollectionUtils.isNotEmpty(operationStations)) { // 进行拆解封装 List<StationDictVO> stationDictVOS = operationStations.stream().map(operationStation -> { StationDictVO stationDictVO = new StationDictVO(); stationDictVO.setStationId(operationStation.getStationId()); stationDictVO.setStationName(operationStation.getStationName()); return stationDictVO; }).collect(Collectors.toList()); }