话不多少,上代码 下面则是套餐名称可能是多个则进行逗号进行连接
//加载所有的套餐
List allCombos = productComboService.selectProductComboList(new ProductCombo());
Map commboMap = allCombos.stream().collect(Collectors.toMap(ProductCombo::getId, ProductCombo::getName));
List list = orderService.selectOrderList(order);
if(CollectionUtils.isNotEmpty(list)) {
list.forEach(el -> {
String comboIds = el.getComboId();
if(StringUtils.isEmpty(comboIds)) {
el.setComboName("-");
} else {
String comboname = Arrays.stream(comboIds.split(","))
.map(comboId -> commboMap.get(Long.valueOf(comboId))).collect(Collectors.joining(","));
el.setComboName(comboName);
}
});
}