获取商品SKU详情接口,增加字段
This commit is contained in:
parent
e569e04739
commit
ab41db4aaa
|
|
@ -1,5 +1,6 @@
|
|||
package com.czg.service.product.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
|
|
@ -101,8 +102,9 @@ public class UProductServiceImpl extends ServiceImpl<ProductMapper, Product> imp
|
|||
List<ShopProductVo> productList = new ArrayList<>();
|
||||
for (Long productId : productIdList) {
|
||||
ShopProductVo product = productKv.get(productId);
|
||||
ShopProductVo prod = BeanUtil.copyProperties(product, ShopProductVo.class);
|
||||
if (product != null) {
|
||||
productList.add(product);
|
||||
productList.add(prod);
|
||||
}
|
||||
}
|
||||
// 1-价格从高到低; 2-价格从低到高; 3-销量由高到低;4-销量由低到高;
|
||||
|
|
@ -148,6 +150,8 @@ public class UProductServiceImpl extends ServiceImpl<ProductMapper, Product> imp
|
|||
// throw new CzgException("商品SKU不可售或不存在");
|
||||
if (data != null) {
|
||||
data.setStockNumber(ObjUtil.defaultIfNull(product.getStockNumber(), 0));
|
||||
data.setIsSoldStock(product.getIsSoldStock());
|
||||
data.setIsSale(product.getIsSale());
|
||||
return data;
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue