✨ MALL:简化 SPU 的 VO 转化
parent
fe5c5e4223
commit
f6c8159dac
@ -1,22 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.property.vo.value;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 商品属性值的明细 Response VO")
|
||||
@Data
|
||||
public class ProductPropertyValueDetailRespVO {
|
||||
|
||||
@Schema(description = "属性的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long propertyId;
|
||||
|
||||
@Schema(description = "属性的名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "颜色")
|
||||
private String propertyName;
|
||||
|
||||
@Schema(description = "属性值的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long valueId;
|
||||
|
||||
@Schema(description = "属性值的名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "红色")
|
||||
private String valueName;
|
||||
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.sku;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "管理后台 - 商品 SKU")
|
||||
@RestController
|
||||
@RequestMapping("/product/sku")
|
||||
@Validated
|
||||
public class ProductSkuController {
|
||||
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.sku.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 商品 SKU 创建/更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ProductSkuCreateOrUpdateReqVO extends ProductSkuBaseVO {
|
||||
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.sku.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 商品 SKU Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ProductSkuRespVO extends ProductSkuBaseVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 商品 SPU 创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ProductSpuCreateReqVO extends ProductSpuBaseVO {
|
||||
|
||||
// ========== SKU 相关字段 =========
|
||||
|
||||
@Schema(description = "SKU 数组")
|
||||
@Valid
|
||||
private List<ProductSkuCreateOrUpdateReqVO> skus;
|
||||
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 商品 SPU 详细 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ProductSpuDetailRespVO extends ProductSpuRespVO {
|
||||
|
||||
// ========== SKU 相关字段 =========
|
||||
|
||||
@Schema(description = "SKU 数组")
|
||||
private List<ProductSkuRespVO> skus;
|
||||
|
||||
}
|
||||
@ -1,90 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.module.product.enums.DictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 商品 Spu Excel 导出 VO TODO 暂定
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Data
|
||||
public class ProductSpuExcelVO {
|
||||
|
||||
@ExcelProperty("商品编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("商品名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("关键字")
|
||||
private String keyword;
|
||||
|
||||
@ExcelProperty("商品简介")
|
||||
private String introduction;
|
||||
|
||||
@ExcelProperty("商品详情")
|
||||
private String description;
|
||||
|
||||
@ExcelProperty("条形码")
|
||||
private String barCode;
|
||||
|
||||
@ExcelProperty("商品分类编号")
|
||||
private Long categoryId;
|
||||
|
||||
@ExcelProperty("商品品牌编号")
|
||||
private Long brandId;
|
||||
|
||||
@ExcelProperty("商品封面图")
|
||||
private String picUrl;
|
||||
|
||||
@ExcelProperty("排序字段")
|
||||
private Integer sort;
|
||||
|
||||
@ExcelProperty(value = "商品状态", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.PRODUCT_SPU_STATUS)
|
||||
private Integer status;
|
||||
|
||||
@ExcelProperty("规格类型")
|
||||
private Boolean specType;
|
||||
|
||||
@ExcelProperty("商品价格")
|
||||
private Integer price;
|
||||
|
||||
@ExcelProperty("市场价")
|
||||
private Integer marketPrice;
|
||||
|
||||
@ExcelProperty("成本价")
|
||||
private Integer costPrice;
|
||||
|
||||
@ExcelProperty("库存")
|
||||
private Integer stock;
|
||||
|
||||
@ExcelProperty("物流配置模板编号")
|
||||
private Long deliveryTemplateId;
|
||||
|
||||
@ExcelProperty("赠送积分")
|
||||
private Integer giveIntegral;
|
||||
|
||||
@ExcelProperty("分销类型")
|
||||
private Boolean subCommissionType;
|
||||
|
||||
@ExcelProperty("商品销量")
|
||||
private Integer salesCount;
|
||||
|
||||
@ExcelProperty("虚拟销量")
|
||||
private Integer virtualSalesCount;
|
||||
|
||||
@ExcelProperty("商品点击量")
|
||||
private Integer browseCount;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@ -1,43 +1,126 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.MoneyConvert;
|
||||
import cn.iocoder.yudao.module.product.enums.DictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 商品 SPU Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ProductSpuRespVO extends ProductSpuBaseVO {
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ProductSpuRespVO {
|
||||
|
||||
@Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "111")
|
||||
@ExcelProperty("商品编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "清凉小短袖")
|
||||
@ExcelProperty("商品名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "关键字", requiredMode = Schema.RequiredMode.REQUIRED, example = "清凉丝滑不出汗")
|
||||
@ExcelProperty("关键字")
|
||||
private String keyword;
|
||||
|
||||
@Schema(description = "商品简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "清凉小短袖简介")
|
||||
@ExcelProperty("商品简介")
|
||||
private String introduction;
|
||||
|
||||
@Schema(description = "商品详情", requiredMode = Schema.RequiredMode.REQUIRED, example = "清凉小短袖详情")
|
||||
@ExcelProperty("商品详情")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "商品分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("商品分类编号")
|
||||
private Long categoryId;
|
||||
|
||||
@Schema(description = "商品品牌编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("商品品牌编号")
|
||||
private Long brandId;
|
||||
|
||||
@Schema(description = "商品封面图", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xx.png")
|
||||
@ExcelProperty("商品封面图")
|
||||
private String picUrl;
|
||||
|
||||
@Schema(description = "商品轮播图", requiredMode = Schema.RequiredMode.REQUIRED, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]")
|
||||
private List<String> sliderPicUrls;
|
||||
|
||||
@Schema(description = "排序字段", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("排序字段")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "商品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty(value = "商品状态", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.PRODUCT_SPU_STATUS)
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "商品创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2023-05-24 00:00:00")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
// ========== SKU 相关字段 =========
|
||||
|
||||
@Schema(description = "规格类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
@ExcelProperty("规格类型")
|
||||
private Boolean specType;
|
||||
|
||||
@Schema(description = "商品价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "1999")
|
||||
@ExcelProperty(value = "商品价格", converter = MoneyConvert.class)
|
||||
private Integer price;
|
||||
|
||||
@Schema(description = "商品销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000")
|
||||
private Integer salesCount;
|
||||
|
||||
@Schema(description = "市场价,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "199")
|
||||
@ExcelProperty(value = "市场价", converter = MoneyConvert.class)
|
||||
private Integer marketPrice;
|
||||
|
||||
@Schema(description = "成本价,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "19")
|
||||
@ExcelProperty(value = "成本价", converter = MoneyConvert.class)
|
||||
private Integer costPrice;
|
||||
|
||||
@Schema(description = "商品库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000")
|
||||
@ExcelProperty("库存")
|
||||
private Integer stock;
|
||||
|
||||
@Schema(description = "商品创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2023-05-24 00:00:00")
|
||||
private LocalDateTime createTime;
|
||||
@Schema(description = "SKU 数组")
|
||||
private List<ProductSkuRespVO> skus;
|
||||
|
||||
@Schema(description = "商品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer status;
|
||||
// ========== 物流相关字段 =========
|
||||
|
||||
@Schema(description = "配送方式数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private List<Integer> deliveryTypes;
|
||||
|
||||
@Schema(description = "物流配置模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "111")
|
||||
@ExcelProperty("物流配置模板编号")
|
||||
private Long deliveryTemplateId;
|
||||
|
||||
// ========== 营销相关字段 =========
|
||||
|
||||
@Schema(description = "赠送积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "111")
|
||||
@ExcelProperty("赠送积分")
|
||||
private Integer giveIntegral;
|
||||
|
||||
@Schema(description = "分销类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
@ExcelProperty("分销类型")
|
||||
private Boolean subCommissionType;
|
||||
|
||||
// ========== 统计相关字段 =========
|
||||
|
||||
@Schema(description = "商品销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000")
|
||||
@ExcelProperty("商品销量")
|
||||
private Integer salesCount;
|
||||
|
||||
@Schema(description = "虚拟销量", example = "66")
|
||||
@ExcelProperty("虚拟销量")
|
||||
private Integer virtualSalesCount;
|
||||
|
||||
@Schema(description = "浏览量", requiredMode = Schema.RequiredMode.REQUIRED, example = "888")
|
||||
@ExcelProperty("商品点击量")
|
||||
private Integer browseCount;
|
||||
|
||||
}
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 商品 SPU 更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ProductSpuUpdateReqVO extends ProductSpuBaseVO {
|
||||
|
||||
@Schema(description = "商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "商品编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "商品销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1999")
|
||||
private Integer salesCount;
|
||||
|
||||
@Schema(description = "浏览量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1999")
|
||||
private Integer browseCount;
|
||||
|
||||
@Schema(description = "商品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@InEnum(ProductSpuStatusEnum.class)
|
||||
private Integer status;
|
||||
|
||||
// ========== SKU 相关字段 =========
|
||||
|
||||
@Schema(description = "SKU 数组")
|
||||
@Valid
|
||||
private List<ProductSkuCreateOrUpdateReqVO> skus;
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue