|
|
@@ -88,8 +88,22 @@ public class GoodsRuleServiceImpl extends ServiceImpl<GoodsRuleMapper, GoodsRule
|
|
|
@Override
|
|
|
public Result info() {
|
|
|
List<GoodsRule> all = baseMapper.selectList(null);
|
|
|
- for (GoodsRule r : all) {
|
|
|
- r.setRuleValue(goodsRuleValueService.selectGoodsRuleValue(r.getId()));
|
|
|
+ List<Long> idList = all.stream().map(GoodsRule::getId).collect(Collectors.toList());
|
|
|
+ if (idList.size()>0) {
|
|
|
+ List<GoodsRuleValue> goodsRuleValueList = goodsRuleValueService.list(new QueryWrapper<GoodsRuleValue>().in("rule_id", idList));
|
|
|
+ Map<Long, ArrayList<GoodsRuleValue>> map = goodsRuleValueList.stream().collect(Collectors.toMap(
|
|
|
+ GoodsRuleValue::getRuleId,
|
|
|
+ goodsAttrValue -> new ArrayList<>(Collections.singletonList(goodsAttrValue)),
|
|
|
+ (oldList, newList) -> {
|
|
|
+ oldList.addAll(newList);
|
|
|
+ return oldList;
|
|
|
+ }
|
|
|
+ ));
|
|
|
+ for (GoodsRule r : all) {
|
|
|
+// r.setRuleValue(goodsRuleValueService.selectGoodsRuleValue(r.getId()));
|
|
|
+ r.setRuleValue(map.get(r.getId()));
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
return Result.success().put("data",all);
|
|
|
}
|