mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-02-21 19:50:32 +08:00
product:优化代码实现,简化重复判空
This commit is contained in:
parent
728308cbc0
commit
a778c25075
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.product.api.comment.dto;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,6 +16,7 @@ public class ProductCommentCreateReqDTO {
|
|||||||
/**
|
/**
|
||||||
* 商品 SKU 编号
|
* 商品 SKU 编号
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "商品 SKU 编号不能为空")
|
||||||
private Long skuId;
|
private Long skuId;
|
||||||
/**
|
/**
|
||||||
* 订单编号
|
* 订单编号
|
||||||
@ -25,21 +27,20 @@ public class ProductCommentCreateReqDTO {
|
|||||||
*/
|
*/
|
||||||
private Long orderItemId;
|
private Long orderItemId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 评分星级 1-5 分
|
|
||||||
*/
|
|
||||||
private Integer scores;
|
|
||||||
/**
|
/**
|
||||||
* 描述星级 1-5 分
|
* 描述星级 1-5 分
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "描述星级不能为空")
|
||||||
private Integer descriptionScores;
|
private Integer descriptionScores;
|
||||||
/**
|
/**
|
||||||
* 服务星级 1-5 分
|
* 服务星级 1-5 分
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "服务星级不能为空")
|
||||||
private Integer benefitScores;
|
private Integer benefitScores;
|
||||||
/**
|
/**
|
||||||
* 评论内容
|
* 评论内容
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "评论内容不能为空")
|
||||||
private String content;
|
private String content;
|
||||||
/**
|
/**
|
||||||
* 评论图片地址数组,以逗号分隔最多上传 9 张
|
* 评论图片地址数组,以逗号分隔最多上传 9 张
|
||||||
@ -49,11 +50,12 @@ public class ProductCommentCreateReqDTO {
|
|||||||
/**
|
/**
|
||||||
* 是否匿名
|
* 是否匿名
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "是否匿名不能为空")
|
||||||
private Boolean anonymous;
|
private Boolean anonymous;
|
||||||
/**
|
/**
|
||||||
* 评价人
|
* 评价人
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "评价人不能为空")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.product.api.property;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品属性值 API 接口
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
public interface ProductPropertyValueApi {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据编号数组,获得属性值列表
|
|
||||||
*
|
|
||||||
* @param ids 编号数组
|
|
||||||
* @return 属性值明细列表
|
|
||||||
*/
|
|
||||||
List<ProductPropertyValueDetailRespDTO> getPropertyValueDetailList(Collection<Long> ids);
|
|
||||||
|
|
||||||
}
|
|
@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.product.api.spu.dto;
|
|||||||
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
|
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
// TODO @LeeYan9: ProductSpuRespDTO
|
// TODO @LeeYan9: ProductSpuRespDTO
|
||||||
/**
|
/**
|
||||||
* 商品 SPU 信息 Response DTO
|
* 商品 SPU 信息 Response DTO
|
||||||
@ -26,55 +24,22 @@ public class ProductSpuRespDTO {
|
|||||||
* 商品名称
|
* 商品名称
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
/**
|
|
||||||
* 关键字
|
|
||||||
*/
|
|
||||||
private String keyword;
|
|
||||||
/**
|
/**
|
||||||
* 单位
|
* 单位
|
||||||
*
|
*
|
||||||
* 对应 product_unit 数据字典
|
* 对应 product_unit 数据字典
|
||||||
*/
|
*/
|
||||||
private Integer unit;
|
private Integer unit;
|
||||||
/**
|
|
||||||
* 商品简介
|
|
||||||
*/
|
|
||||||
private String introduction;
|
|
||||||
/**
|
|
||||||
* 商品详情
|
|
||||||
*/
|
|
||||||
private String description;
|
|
||||||
// TODO @芋艿:是不是要删除
|
|
||||||
/**
|
|
||||||
* 商品条码(一维码)
|
|
||||||
*/
|
|
||||||
private String barCode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品分类编号
|
* 商品分类编号
|
||||||
*/
|
*/
|
||||||
private Long categoryId;
|
private Long categoryId;
|
||||||
/**
|
|
||||||
* 商品品牌编号
|
|
||||||
*/
|
|
||||||
private Long brandId;
|
|
||||||
/**
|
/**
|
||||||
* 商品封面图
|
* 商品封面图
|
||||||
*/
|
*/
|
||||||
private String picUrl;
|
private String picUrl;
|
||||||
/**
|
|
||||||
* 商品轮播图
|
|
||||||
*/
|
|
||||||
private List<String> sliderPicUrls;
|
|
||||||
/**
|
|
||||||
* 商品视频
|
|
||||||
*/
|
|
||||||
private String videoUrl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 排序字段
|
|
||||||
*/
|
|
||||||
private Integer sort;
|
|
||||||
/**
|
/**
|
||||||
* 商品状态
|
* 商品状态
|
||||||
* <p>
|
* <p>
|
||||||
@ -124,22 +89,6 @@ public class ProductSpuRespDTO {
|
|||||||
*/
|
*/
|
||||||
private Integer giveIntegral;
|
private Integer giveIntegral;
|
||||||
|
|
||||||
// ========== 统计相关字段 =========
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品销量
|
|
||||||
*/
|
|
||||||
private Integer salesCount;
|
|
||||||
/**
|
|
||||||
* 虚拟销量
|
|
||||||
*/
|
|
||||||
private Integer virtualSalesCount;
|
|
||||||
/**
|
|
||||||
* 商品点击量
|
|
||||||
*/
|
|
||||||
private Integer clickCount;
|
|
||||||
|
|
||||||
|
|
||||||
// ========== 分销相关字段 =========
|
// ========== 分销相关字段 =========
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.product.enums.group;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品分组的样式枚举
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum ProductGroupStyleEnum implements IntArrayValuable {
|
|
||||||
|
|
||||||
ONE(1, "每列一个"),
|
|
||||||
TWO(2, "每列两个"),
|
|
||||||
THREE(2, "每列三个"),;
|
|
||||||
|
|
||||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductGroupStyleEnum::getStyle).toArray();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表样式
|
|
||||||
*/
|
|
||||||
private final Integer style;
|
|
||||||
/**
|
|
||||||
* 状态名
|
|
||||||
*/
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] array() {
|
|
||||||
return ARRAYS;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.product.api.property;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.product.convert.property.ProductPropertyValueConvert;
|
|
||||||
import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品属性值 API 实现类
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Validated
|
|
||||||
public class ProductPropertyValueApiImpl implements ProductPropertyValueApi {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private ProductPropertyValueService productPropertyValueService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ProductPropertyValueDetailRespDTO> getPropertyValueDetailList(Collection<Long> ids) {
|
|
||||||
return ProductPropertyValueConvert.INSTANCE.convertList02(
|
|
||||||
productPropertyValueService.getPropertyValueDetailList(ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
package cn.iocoder.yudao.module.product.api.sku;
|
package cn.iocoder.yudao.module.product.api.sku;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
|
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
|
||||||
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO;
|
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO;
|
||||||
import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert;
|
import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert;
|
||||||
@ -11,7 +10,6 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,18 +33,12 @@ public class ProductSkuApiImpl implements ProductSkuApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProductSkuRespDTO> getSkuList(Collection<Long> ids) {
|
public List<ProductSkuRespDTO> getSkuList(Collection<Long> ids) {
|
||||||
if (CollUtil.isEmpty(ids)) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
List<ProductSkuDO> skus = productSkuService.getSkuList(ids);
|
List<ProductSkuDO> skus = productSkuService.getSkuList(ids);
|
||||||
return ProductSkuConvert.INSTANCE.convertList04(skus);
|
return ProductSkuConvert.INSTANCE.convertList04(skus);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProductSkuRespDTO> getSkuListBySpuId(Collection<Long> spuIds) {
|
public List<ProductSkuRespDTO> getSkuListBySpuId(Collection<Long> spuIds) {
|
||||||
if (CollUtil.isEmpty(spuIds)) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
List<ProductSkuDO> skus = productSkuService.getSkuListBySpuId(spuIds);
|
List<ProductSkuDO> skus = productSkuService.getSkuListBySpuId(spuIds);
|
||||||
return ProductSkuConvert.INSTANCE.convertList04(skus);
|
return ProductSkuConvert.INSTANCE.convertList04(skus);
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,6 @@ public class ProductSpuApiImpl implements ProductSpuApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProductSpuRespDTO> getSpuList(Collection<Long> ids) {
|
public List<ProductSpuRespDTO> getSpuList(Collection<Long> ids) {
|
||||||
if (CollectionUtil.isEmpty(ids)) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
return ProductSpuConvert.INSTANCE.convertList2(spuService.getSpuList(ids));
|
return ProductSpuConvert.INSTANCE.convertList2(spuService.getSpuList(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,22 +1,14 @@
|
|||||||
package cn.iocoder.yudao.module.product.convert.property;
|
package cn.iocoder.yudao.module.product.convert.property;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
|
||||||
import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO;
|
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
|
|
||||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO;
|
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO;
|
||||||
import cn.iocoder.yudao.module.product.service.property.bo.ProductPropertyValueDetailRespBO;
|
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 属性值 Convert
|
* 属性值 Convert
|
||||||
@ -38,18 +30,4 @@ public interface ProductPropertyValueConvert {
|
|||||||
|
|
||||||
PageResult<ProductPropertyValueRespVO> convertPage(PageResult<ProductPropertyValueDO> page);
|
PageResult<ProductPropertyValueRespVO> convertPage(PageResult<ProductPropertyValueDO> page);
|
||||||
|
|
||||||
default List<ProductPropertyValueDetailRespBO> convertList(List<ProductPropertyValueDO> values, List<ProductPropertyDO> keys) {
|
|
||||||
Map<Long, ProductPropertyDO> keyMap = convertMap(keys, ProductPropertyDO::getId);
|
|
||||||
return CollectionUtils.convertList(values, value -> {
|
|
||||||
ProductPropertyValueDetailRespBO valueDetail = new ProductPropertyValueDetailRespBO()
|
|
||||||
.setValueId(value.getId()).setValueName(value.getName());
|
|
||||||
// 设置属性项
|
|
||||||
MapUtils.findAndThen(keyMap, value.getPropertyId(),
|
|
||||||
key -> valueDetail.setPropertyId(key.getId()).setPropertyName(key.getName()));
|
|
||||||
return valueDetail;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ProductPropertyValueDetailRespDTO> convertList02(List<ProductPropertyValueDetailRespBO> list);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.Produc
|
|||||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO;
|
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO;
|
||||||
import cn.iocoder.yudao.module.product.service.property.bo.ProductPropertyValueDetailRespBO;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -56,14 +55,6 @@ public interface ProductPropertyValueService {
|
|||||||
*/
|
*/
|
||||||
List<ProductPropertyValueDO> getPropertyValueListByPropertyId(Collection<Long> propertyIds);
|
List<ProductPropertyValueDO> getPropertyValueListByPropertyId(Collection<Long> propertyIds);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据编号数组,获得属性值列表
|
|
||||||
*
|
|
||||||
* @param ids 编号数组
|
|
||||||
* @return 属性值明细列表
|
|
||||||
*/
|
|
||||||
List<ProductPropertyValueDetailRespBO> getPropertyValueDetailList(Collection<Long> ids);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据属性项编号,活的属性值数量
|
* 根据属性项编号,活的属性值数量
|
||||||
*
|
*
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package cn.iocoder.yudao.module.product.service.property;
|
package cn.iocoder.yudao.module.product.service.property;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.product.convert.property.ProductPropertyValueConvert;
|
import cn.iocoder.yudao.module.product.convert.property.ProductPropertyValueConvert;
|
||||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
|
|
||||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO;
|
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO;
|
||||||
import cn.iocoder.yudao.module.product.dal.mysql.property.ProductPropertyValueMapper;
|
import cn.iocoder.yudao.module.product.dal.mysql.property.ProductPropertyValueMapper;
|
||||||
import cn.iocoder.yudao.module.product.service.property.bo.ProductPropertyValueDetailRespBO;
|
|
||||||
import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
|
import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -17,11 +14,9 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
|
||||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_EXISTS;
|
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_EXISTS;
|
||||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_NOT_EXISTS;
|
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_NOT_EXISTS;
|
||||||
|
|
||||||
@ -99,23 +94,6 @@ public class ProductPropertyValueServiceImpl implements ProductPropertyValueServ
|
|||||||
return productPropertyValueMapper.selectListByPropertyId(propertyIds);
|
return productPropertyValueMapper.selectListByPropertyId(propertyIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ProductPropertyValueDetailRespBO> getPropertyValueDetailList(Collection<Long> ids) {
|
|
||||||
// 获得属性值列表
|
|
||||||
if (CollUtil.isEmpty(ids)) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
List<ProductPropertyValueDO> values = productPropertyValueMapper.selectBatchIds(ids);
|
|
||||||
if (CollUtil.isEmpty(values)) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
// 获得属性项列表
|
|
||||||
List<ProductPropertyDO> keys = productPropertyService.getPropertyList(
|
|
||||||
convertSet(values, ProductPropertyValueDO::getPropertyId));
|
|
||||||
// 组装明细
|
|
||||||
return ProductPropertyValueConvert.INSTANCE.convertList(values, keys);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getPropertyValueCountByPropertyId(Long propertyId) {
|
public Integer getPropertyValueCountByPropertyId(Long propertyId) {
|
||||||
return productPropertyValueMapper.selectCountByPropertyId(propertyId);
|
return productPropertyValueMapper.selectCountByPropertyId(propertyId);
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.product.service.property.bo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品属性项的明细 Response BO
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ProductPropertyValueDetailRespBO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 属性的编号
|
|
||||||
*/
|
|
||||||
private Long propertyId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 属性的名称
|
|
||||||
*/
|
|
||||||
private String propertyName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 属性值的编号
|
|
||||||
*/
|
|
||||||
private Long valueId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 属性值的名称
|
|
||||||
*/
|
|
||||||
private String valueName;
|
|
||||||
|
|
||||||
}
|
|
@ -153,6 +153,9 @@ public class ProductSkuServiceImpl implements ProductSkuService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProductSkuDO> getSkuListBySpuId(Collection<Long> spuIds) {
|
public List<ProductSkuDO> getSkuListBySpuId(Collection<Long> spuIds) {
|
||||||
|
if (CollUtil.isEmpty(spuIds)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
return productSkuMapper.selectListBySpuId(spuIds);
|
return productSkuMapper.selectListBySpuId(spuIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,6 +216,9 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProductSpuDO> getSpuList(Collection<Long> ids) {
|
public List<ProductSpuDO> getSpuList(Collection<Long> ids) {
|
||||||
|
if (CollUtil.isEmpty(ids)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
return productSpuMapper.selectBatchIds(ids);
|
return productSpuMapper.selectBatchIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user