product:优化代码实现,简化重复判空

This commit is contained in:
YunaiV
2023-10-22 21:44:05 +08:00
parent 728308cbc0
commit a778c25075
13 changed files with 13 additions and 245 deletions

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.product.api.comment.dto;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
@ -15,6 +16,7 @@ public class ProductCommentCreateReqDTO {
/**
* 商品 SKU 编号
*/
@NotNull(message = "商品 SKU 编号不能为空")
private Long skuId;
/**
* 订单编号
@ -25,21 +27,20 @@ public class ProductCommentCreateReqDTO {
*/
private Long orderItemId;
/**
* 评分星级 1-5 分
*/
private Integer scores;
/**
* 描述星级 1-5 分
*/
@NotNull(message = "描述星级不能为空")
private Integer descriptionScores;
/**
* 服务星级 1-5 分
*/
@NotNull(message = "服务星级不能为空")
private Integer benefitScores;
/**
* 评论内容
*/
@NotNull(message = "评论内容不能为空")
private String content;
/**
* 评论图片地址数组,以逗号分隔最多上传 9 张
@ -49,11 +50,12 @@ public class ProductCommentCreateReqDTO {
/**
* 是否匿名
*/
@NotNull(message = "是否匿名不能为空")
private Boolean anonymous;
/**
* 评价人
*/
@NotNull(message = "评价人不能为空")
private Long userId;
}

View File

@ -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);
}

View File

@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.product.api.spu.dto;
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
import lombok.Data;
import java.util.List;
// TODO @LeeYan9: ProductSpuRespDTO
/**
* 商品 SPU 信息 Response DTO
@ -26,55 +24,22 @@ public class ProductSpuRespDTO {
* 商品名称
*/
private String name;
/**
* 关键字
*/
private String keyword;
/**
* 单位
*
* 对应 product_unit 数据字典
*/
private Integer unit;
/**
* 商品简介
*/
private String introduction;
/**
* 商品详情
*/
private String description;
// TODO @芋艿:是不是要删除
/**
* 商品条码(一维码)
*/
private String barCode;
/**
* 商品分类编号
*/
private Long categoryId;
/**
* 商品品牌编号
*/
private Long brandId;
/**
* 商品封面图
*/
private String picUrl;
/**
* 商品轮播图
*/
private List<String> sliderPicUrls;
/**
* 商品视频
*/
private String videoUrl;
/**
* 排序字段
*/
private Integer sort;
/**
* 商品状态
* <p>
@ -124,22 +89,6 @@ public class ProductSpuRespDTO {
*/
private Integer giveIntegral;
// ========== 统计相关字段 =========
/**
* 商品销量
*/
private Integer salesCount;
/**
* 虚拟销量
*/
private Integer virtualSalesCount;
/**
* 商品点击量
*/
private Integer clickCount;
// ========== 分销相关字段 =========
/**

View File

@ -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;
}
}