forked from YunaiV/yudao-cloud
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
YunaiV
committed
Jul 27, 2020
1 parent
be4b34c
commit e107b42
Showing
49 changed files
with
553 additions
and
1,042 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
...rc/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuAndSkuCreateReqDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package cn.iocoder.mall.productservice.rpc.spu.dto; | ||
|
||
import lombok.Data; | ||
import lombok.experimental.Accessors; | ||
|
||
import javax.validation.Valid; | ||
import javax.validation.constraints.Min; | ||
import javax.validation.constraints.NotEmpty; | ||
import javax.validation.constraints.NotNull; | ||
import java.io.Serializable; | ||
import java.util.List; | ||
|
||
/** | ||
* 商品 SPU 和 SKU 创建 Request DTO | ||
*/ | ||
@Data | ||
@Accessors(chain = true) | ||
public class ProductSpuAndSkuCreateReqDTO implements Serializable { | ||
|
||
/** | ||
* SKU 信息 | ||
*/ | ||
@Data | ||
@Accessors(chain = true) | ||
public static class Sku implements Serializable { | ||
|
||
/** | ||
* 规格值数组 | ||
*/ | ||
@NotNull(message = "规格值数组不能为空") | ||
private List<Integer> attrValueIds; | ||
/** | ||
* 价格,单位:分 | ||
*/ | ||
@NotNull(message = "价格不能为空") | ||
@Min(value = 1L, message = "最小价格为 1") | ||
private Integer price; | ||
/** | ||
* 库存数量 | ||
*/ | ||
@NotNull(message = "库存数量不能为空") | ||
@Min(value = 1L, message = "最小库存为 1") | ||
private Integer quantity; | ||
|
||
} | ||
|
||
// ========== 基本信息 ========= | ||
/** | ||
* SPU 名字 | ||
*/ | ||
@NotEmpty(message = "SPU 名字不能为空") | ||
private String name; | ||
/** | ||
* 卖点 | ||
*/ | ||
@NotEmpty(message = "卖点不能为空") | ||
private String sellPoint; | ||
/** | ||
* 描述 | ||
*/ | ||
@NotEmpty(message = "描述不能为空") | ||
private String description; | ||
/** | ||
* 分类编号 | ||
*/ | ||
@NotNull(message = "分类编号不能为空") | ||
private Integer cid; | ||
/** | ||
* 商品主图地址 | ||
*/ | ||
@NotEmpty(message = "商品主图地址不能为空") | ||
private List<String> picUrls; | ||
|
||
// ========== 其他信息 ========= | ||
/** | ||
* 是否上架商品 | ||
*/ | ||
@NotNull(message = "是否上架商品不能为空") | ||
private Boolean visible; | ||
|
||
// ========== SKU ========= | ||
|
||
/** | ||
* SKU 数组 | ||
*/ | ||
@NotNull(message = "SKU 不能为空") | ||
@Valid | ||
private List<Sku> skus; | ||
|
||
} |
64 changes: 0 additions & 64 deletions
64
...-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuCreateReqDTO.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...rvice-app/src/main/java/cn/iocoder/mall/productservice/convert/sku/ProductSkuConvert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package cn.iocoder.mall.productservice.convert.sku; | ||
|
||
import cn.iocoder.common.framework.util.StringUtils; | ||
import cn.iocoder.mall.productservice.dal.mysql.dataobject.spu.ProductSkuDO; | ||
import cn.iocoder.mall.productservice.service.sku.bo.ProductSkuCreateOrUpdateBO; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
import org.mapstruct.Named; | ||
import org.mapstruct.factory.Mappers; | ||
|
||
import java.util.List; | ||
|
||
@Mapper | ||
public interface ProductSkuConvert { | ||
|
||
ProductSkuConvert INSTANCE = Mappers.getMapper(ProductSkuConvert.class); | ||
|
||
List<ProductSkuDO> convertList(List<ProductSkuCreateOrUpdateBO> list); | ||
|
||
@Mapping(source = "attrValueIds", target = "attrs", qualifiedByName = "translatePicUrlsFromStringList") | ||
ProductSkuDO convertList(ProductSkuCreateOrUpdateBO bean); | ||
|
||
@Named("translateAttrValueIdsFromString") | ||
default List<String> translateAttrValueIdsFromString(String attrValueIdsStar) { | ||
return StringUtils.split(attrValueIdsStar, ","); | ||
} | ||
|
||
@Named("translateAttrValueIdsFromList") | ||
default String translateAttrValueIdsFromList(List<Integer> attrValueIds) { | ||
return StringUtils.join(attrValueIds, ","); | ||
} | ||
|
||
} |
Oops, something went wrong.