|
@@ -91,22 +91,25 @@ public class ItemService {
|
|
for (SupportReference supportReference : supportReferenceList) {
|
|
for (SupportReference supportReference : supportReferenceList) {
|
|
supportIdList.add(supportReference.getTid());
|
|
supportIdList.add(supportReference.getTid());
|
|
}
|
|
}
|
|
|
|
+
|
|
if (!CollectionUtils.isEmpty(supportIdList)) {
|
|
if (!CollectionUtils.isEmpty(supportIdList)) {
|
|
List<MerchantProduct> merchantProductList = merchantProductRepository.findByPidsAndMerchantId(supportIdList, merchantId);
|
|
List<MerchantProduct> merchantProductList = merchantProductRepository.findByPidsAndMerchantId(supportIdList, merchantId);
|
|
List<String> idList = new ArrayList<>();
|
|
List<String> idList = new ArrayList<>();
|
|
merchantProductList.forEach(item -> idList.add(item.getPid()));
|
|
merchantProductList.forEach(item -> idList.add(item.getPid()));
|
|
- List<Support> supportList = supportRepository.findByIds(idList, BaseStatusEnum.NORMAL);
|
|
|
|
- Map<String, Support> supportMap = ListUtil.convert(supportList, "id", Support.class);
|
|
|
|
- List<ItemVo> itemVoList = new ArrayList<>();
|
|
|
|
- for (String itemId : supportIdList) {
|
|
|
|
- Support item = supportMap.get(itemId);
|
|
|
|
- if (item == null) {
|
|
|
|
- continue;
|
|
|
|
|
|
+ if (!idList.isEmpty()) {
|
|
|
|
+ List<Support> supportList = supportRepository.findByIds(idList, BaseStatusEnum.NORMAL);
|
|
|
|
+ Map<String, Support> supportMap = ListUtil.convert(supportList, "id", Support.class);
|
|
|
|
+ List<ItemVo> itemVoList = new ArrayList<>();
|
|
|
|
+ for (String itemId : supportIdList) {
|
|
|
|
+ Support item = supportMap.get(itemId);
|
|
|
|
+ if (item == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ ItemVo itemVo = convert(item);
|
|
|
|
+ itemVoList.add(itemVo);
|
|
}
|
|
}
|
|
- ItemVo itemVo = convert(item);
|
|
|
|
- itemVoList.add(itemVo);
|
|
|
|
|
|
+ supportItemVo.setRelatedSupports(itemVoList);
|
|
}
|
|
}
|
|
- supportItemVo.setRelatedSupports(itemVoList);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|