EntityWrapper<OrderProduction> wrapper = new EntityWrapper<>();
wrapper.eq("bill_No", billNo);
//这是查询出来的集合
List<OrderProductionMat> orderProductionMats = orderProductionMatService.queryList(wrapper);
//通过stream流将orderProductionMats中某些字段放到OrderProductionSplit集合的某些对应字段中
List<OrderProductionSplit> orderProductionSplits = orderProductionMats.stream().map(orderProductionMat -> {
OrderProductionSplit orderProductionSplit = new OrderProductionSplit();
orderProductionSplit.setBillNo(orderProductionMat.getBillNo());
orderProductionSplit.setMaterialCode(orderProductionMat.getMatCode());
orderProductionSplit.setMaterialName(orderProductionMat.getMatName());
return orderProductionSplit;
}).collect(Collectors.toList());
return list;
参考:Java使用Stream流将一个集合里的某些字段转换为另外一个对象集合(属性名不需要一致)_calmtho的博客-CSDN博客