diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java index 9986c7e61..c98d7f3ac 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java @@ -192,7 +192,9 @@ public class ProductSpuServiceImpl implements ProductSpuService { if (CollUtil.isEmpty(ids)) { return Collections.emptyList(); } - return productSpuMapper.selectBatchIds(ids); + Map spuMap = convertMap(productSpuMapper.selectBatchIds(ids), ProductSpuDO::getId); + // 需要按照 ids 顺序返回。例如说:店铺装修选择了 [3, 1, 2] 三个商品,返回结果还是 [3, 1, 2] 这样的顺序 + return convertList(ids, spuMap::get); } @Override