Commit c10ea9d9de6101e257c9e13d27f4b452f7950310
1 parent
24a56bb4
移除ProductSku相关的status属性,修改Property
Showing
1 changed file
with
10 additions
and
1 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/ProductPropertyConvert.java
| 1 | 1 | package cn.iocoder.yudao.module.product.convert.property; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 5 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 5 | 6 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyAndValueRespVO; |
| ... | ... | @@ -11,9 +12,12 @@ import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyVa |
| 11 | 12 | import org.mapstruct.Mapper; |
| 12 | 13 | import org.mapstruct.factory.Mappers; |
| 13 | 14 | |
| 15 | +import java.util.Collections; | |
| 14 | 16 | import java.util.List; |
| 15 | 17 | import java.util.Map; |
| 16 | 18 | |
| 19 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 20 | + | |
| 17 | 21 | /** |
| 18 | 22 | * 属性项 Convert |
| 19 | 23 | * |
| ... | ... | @@ -38,7 +42,12 @@ public interface ProductPropertyConvert { |
| 38 | 42 | Map<Long, List<ProductPropertyValueDO>> valueMap = CollectionUtils.convertMultiMap(values, ProductPropertyValueDO::getPropertyId); |
| 39 | 43 | return CollectionUtils.convertList(keys, key -> { |
| 40 | 44 | ProductPropertyAndValueRespVO respVO = convert02(key); |
| 41 | - respVO.setValues(convertList02(valueMap.get(key.getId()))); | |
| 45 | + // 如果属性值为空value不为null,返回空列表 | |
| 46 | + if (CollUtil.isEmpty(values)) { | |
| 47 | + respVO.setValues(Collections.emptyList()); | |
| 48 | + }else { | |
| 49 | + respVO.setValues(convertList02(valueMap.get(key.getId()))); | |
| 50 | + } | |
| 42 | 51 | return respVO; |
| 43 | 52 | }); |
| 44 | 53 | } | ... | ... |