diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.http b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.http new file mode 100644 index 000000000..6069ed666 --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.http @@ -0,0 +1,7 @@ +### /product-spu/page 成功(全部) +GET {{baseUrl}}/product-spu/page?pageNo=1&pageSize=10 +Content-Type: application/x-www-form-urlencoded +Authorization: Bearer {{accessToken}} + +### + diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.java index deb9ad365..dabc28651 100644 --- a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.java +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.java @@ -23,7 +23,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success; * 商品 SPU Controller */ @RestController -@RequestMapping("/product_spu") +@RequestMapping("/product-spu") @Api(tags = "商品 SPU") @Validated public class ProductSpuController { diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuCreateReqVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuCreateReqVO.java index 4fdfca20e..0bbcfbed0 100644 --- a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuCreateReqVO.java +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuCreateReqVO.java @@ -6,6 +6,7 @@ import lombok.Data; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; +import java.util.List; @ApiModel("商品 SPU创建 Request VO") @Data @@ -25,10 +26,10 @@ public class ProductSpuCreateReqVO { private Integer cid; @ApiModelProperty(value = "商品主图地址", required = true) @NotEmpty(message = "商品主图地址不能为空") - private String picUrls; + private List picUrls; @ApiModelProperty(value = "是否上架商品", required = true) @NotNull(message = "是否上架商品不能为空") - private Integer visible; + private Boolean visible; @ApiModelProperty(value = "排序字段", required = true) @NotNull(message = "排序字段不能为空") private Integer sort; diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuRespVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuRespVO.java index 95836b790..5e4e94d13 100644 --- a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuRespVO.java +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuRespVO.java @@ -19,9 +19,9 @@ public class ProductSpuRespVO { @ApiModelProperty(value = "分类编号", required = true) private Integer cid; @ApiModelProperty(value = "商品主图地址", required = true) - private String picUrls; + private List picUrls; @ApiModelProperty(value = "是否上架商品", required = true) - private Integer visible; + private Boolean visible; @ApiModelProperty(value = "排序字段", required = true) private Integer sort; @ApiModelProperty(value = "价格", required = true) diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuUpdateReqVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuUpdateReqVO.java index 0498a9a66..985b4bae1 100644 --- a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuUpdateReqVO.java +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuUpdateReqVO.java @@ -6,6 +6,7 @@ import lombok.Data; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; +import java.util.List; @ApiModel("商品 SPU更新 Request VO") @Data @@ -28,10 +29,10 @@ public class ProductSpuUpdateReqVO { private Integer cid; @ApiModelProperty(value = "商品主图地址", required = true) @NotEmpty(message = "商品主图地址不能为空") - private String picUrls; + private List picUrls; @ApiModelProperty(value = "是否上架商品", required = true) @NotNull(message = "是否上架商品不能为空") - private Integer visible; + private Boolean visible; @ApiModelProperty(value = "排序字段", required = true) @NotNull(message = "排序字段不能为空") private Integer sort; diff --git a/order/order-rpc-api/pom.xml b/order/order-rpc-api/pom.xml deleted file mode 100644 index d8c4aa5f7..000000000 --- a/order/order-rpc-api/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - order - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - order-rpc-api - - - - - cn.iocoder.mall - order-biz-api - 1.0-SNAPSHOT - - - - - javax.validation - validation-api - - - org.projectlombok - lombok - - - - - - - diff --git a/order/order-rpc-api/src/main/java/cn/iocoder/mall/order/rpc/package-info.java b/order/order-rpc-api/src/main/java/cn/iocoder/mall/order/rpc/package-info.java deleted file mode 100644 index 5f974723b..000000000 --- a/order/order-rpc-api/src/main/java/cn/iocoder/mall/order/rpc/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * 提供 order 服务的 RPC 接口的定义,提供内部调用 - */ -package cn.iocoder.mall.order.rpc; diff --git a/order/order-rpc/pom.xml b/order/order-rpc/pom.xml deleted file mode 100644 index bc7aac411..000000000 --- a/order/order-rpc/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - order - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - order-rpc - - - - - cn.iocoder.mall - order-rpc-api - 1.0-SNAPSHOT - - - cn.iocoder.mall - order-biz - 1.0-SNAPSHOT - - - - - com.alibaba.cloud - spring-cloud-starter-dubbo - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - - - diff --git a/order/order-rpc/src/main/java/cn/iocoder/mall/order/rpc/package-info.java b/order/order-rpc/src/main/java/cn/iocoder/mall/order/rpc/package-info.java deleted file mode 100644 index ac5570aeb..000000000 --- a/order/order-rpc/src/main/java/cn/iocoder/mall/order/rpc/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * 提供 order 服务的 RPC 接口的实现,提供内部调用 - */ -package cn.iocoder.mall.order.rpc; diff --git a/order/order-rpc/src/main/resources/rpc-local.yaml b/order/order-rpc/src/main/resources/rpc-local.yaml deleted file mode 100644 index e056170af..000000000 --- a/order/order-rpc/src/main/resources/rpc-local.yaml +++ /dev/null @@ -1,14 +0,0 @@ -spring: - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: s1.iocoder.cn:8848 # Nacos 服务器地址 - namespace: local # Nacos 命名空间 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: - address: spring-cloud://s1.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 diff --git a/order/order-rpc/src/main/resources/rpc-test.yaml b/order/order-rpc/src/main/resources/rpc-test.yaml deleted file mode 100644 index d3d0e9e69..000000000 --- a/order/order-rpc/src/main/resources/rpc-test.yaml +++ /dev/null @@ -1,14 +0,0 @@ -spring: - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: s1.iocoder.cn:8848 # Nacos 服务器地址 - namespace: test # Nacos 命名空间 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: - address: spring-cloud://s1.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 diff --git a/order/order-rpc/src/main/resources/rpc.yaml b/order/order-rpc/src/main/resources/rpc.yaml deleted file mode 100644 index 8c8b6b591..000000000 --- a/order/order-rpc/src/main/resources/rpc.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# Dubbo 配置项 -dubbo: - # Spring Cloud Alibaba Dubbo 专属配置 - cloud: - subscribed-services: '' # 设置订阅的应用列表,默认为 * 订阅所有应用 - # Dubbo 提供者的协议 - protocol: - name: dubbo - port: -1 - # Dubbo 提供服务的扫描基础包 - scan: - base-packages: cn.iocoder.mall.order.rpc.rpc - # Dubbo 服务提供者的配置 - provider: - filter: -exception - SystemLogRPC: - version: 1.0.0 - OAuth2RPC: - version: 1.0.0 - AuthorizationRPC: - version: 1.0.0 - AdminRPC: - version: 1.0.0 - UserRPC: - version: 1.0.0 - UserAddressRPC: - version: 1.0.0 - - # Dubbo 服务消费者的配置 - consumer: - SystemLogRPC: # 用于 AccessLogInterceptor 等拦截器,记录 HTTP API 请求的访问日志 - version: 1.0.0 - OAuth2RPC: # 用于 AccountAuthInterceptor 拦截器,执行认证 - version: 1.0.0 - AuthorizationRPC: # 用于 AccountAuthInterceptor 拦截器,执行鉴权(权限验证) - version: 1.0.0 - AdminRPC: - version: 1.0.0 - UserRPC: - version: 1.0.0 diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuCreateReqDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuCreateReqDTO.java index 2395162da..b3289f576 100644 --- a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuCreateReqDTO.java +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuCreateReqDTO.java @@ -5,6 +5,7 @@ import lombok.experimental.Accessors; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; +import java.io.Serializable; import java.util.List; /** @@ -12,7 +13,7 @@ import java.util.List; */ @Data @Accessors(chain = true) -public class ProductSpuCreateReqDTO { +public class ProductSpuCreateReqDTO implements Serializable { /** * SPU 名字 @@ -43,7 +44,7 @@ public class ProductSpuCreateReqDTO { * 是否上架商品 */ @NotNull(message = "是否上架商品不能为空") - private Integer visible; + private Boolean visible; /** * 排序字段 */ diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuRespDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuRespDTO.java index f38cfe003..b0210d267 100644 --- a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuRespDTO.java +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuRespDTO.java @@ -3,6 +3,7 @@ package cn.iocoder.mall.productservice.rpc.spu.dto; import lombok.Data; import lombok.experimental.Accessors; +import java.io.Serializable; import java.util.Date; import java.util.List; @@ -11,7 +12,7 @@ import java.util.List; */ @Data @Accessors(chain = true) -public class ProductSpuRespDTO { +public class ProductSpuRespDTO implements Serializable { /** * 商品 SPU 编号 @@ -40,7 +41,7 @@ public class ProductSpuRespDTO { /** * 是否上架商品 */ - private Integer visible; + private Boolean visible; /** * 排序字段 */ diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuUpdateReqDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuUpdateReqDTO.java index cfc281799..8ce7d5a3e 100644 --- a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuUpdateReqDTO.java +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuUpdateReqDTO.java @@ -5,6 +5,7 @@ import lombok.experimental.Accessors; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; +import java.io.Serializable; import java.util.List; /** @@ -12,7 +13,7 @@ import java.util.List; */ @Data @Accessors(chain = true) -public class ProductSpuUpdateReqDTO { +public class ProductSpuUpdateReqDTO implements Serializable { /** * 商品 SPU 编号 @@ -48,7 +49,7 @@ public class ProductSpuUpdateReqDTO { * 是否上架商品 */ @NotNull(message = "是否上架商品不能为空") - private Integer visible; + private Boolean visible; /** * 排序字段 */ diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/spu/ProductSpuConvert.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/spu/ProductSpuConvert.java index bc2b0e042..3a5619d4b 100644 --- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/spu/ProductSpuConvert.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/spu/ProductSpuConvert.java @@ -1,5 +1,6 @@ package cn.iocoder.mall.productservice.convert.spu; +import cn.iocoder.common.framework.util.StringUtils; import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.productservice.dal.mysql.dataobject.spu.ProductSpuDO; import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuCreateReqDTO; @@ -12,6 +13,8 @@ import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuPageBO; import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuUpdateBO; import com.baomidou.mybatisplus.core.metadata.IPage; import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Named; import org.mapstruct.factory.Mappers; import java.util.List; @@ -21,14 +24,18 @@ public interface ProductSpuConvert { ProductSpuConvert INSTANCE = Mappers.getMapper(ProductSpuConvert.class); + @Mapping(source = "picUrls", target = "picUrls", qualifiedByName = "translatePicUrlsFromStringList") ProductSpuDO convert(ProductSpuCreateBO bean); + @Mapping(source = "picUrls", target = "picUrls", qualifiedByName = "translatePicUrlsFromString") ProductSpuBO convert(ProductSpuDO bean); + @Mapping(source = "picUrls", target = "picUrls", qualifiedByName = "translatePicUrlsFromStringList") ProductSpuDO convert(ProductSpuUpdateBO bean); List convertList(List list); + @Mapping(source = "records", target = "list") PageResult convertPage(IPage page); ProductSpuCreateBO convert(ProductSpuCreateReqDTO bean); @@ -43,4 +50,14 @@ public interface ProductSpuConvert { PageResult convertPage(PageResult page); + @Named("translatePicUrlsFromString") + default List translatePicUrlsFromString(String picUrls) { + return StringUtils.split(picUrls, ","); + } + + @Named("translatePicUrlsFromStringList") + default String translatePicUrlsFromString(List picUrls) { + return StringUtils.join(picUrls, ","); + } + } diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSkuDO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSkuDO.java index 9f7d7e66c..6a84db151 100644 --- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSkuDO.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSkuDO.java @@ -1,6 +1,7 @@ package cn.iocoder.mall.productservice.dal.mysql.dataobject.spu; import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -8,6 +9,7 @@ import lombok.experimental.Accessors; /** * 商品 SKU */ +@TableName("product_sku") @Data @EqualsAndHashCode(callSuper = true) @Accessors(chain = true) diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSpuDO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSpuDO.java index 7e9dfb4f3..1fd18129b 100644 --- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSpuDO.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSpuDO.java @@ -1,6 +1,7 @@ package cn.iocoder.mall.productservice.dal.mysql.dataobject.spu; import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -10,6 +11,7 @@ import lombok.experimental.Accessors; * * TODO 芋艿,后面增加商品普通参数。例如说,正面材料,背面材料,屏幕尺寸。 */ +@TableName("product_spu") @Data @EqualsAndHashCode(callSuper = true) @Accessors(chain = true) diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuBO.java index d752180c6..5bf311054 100644 --- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuBO.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuBO.java @@ -40,7 +40,7 @@ public class ProductSpuBO { /** * 是否上架商品 */ - private Integer visible; + private Boolean visible; /** * 排序字段 */ diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuCreateBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuCreateBO.java index 60f1892d5..7944c68ab 100644 --- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuCreateBO.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuCreateBO.java @@ -43,7 +43,7 @@ public class ProductSpuCreateBO { * 是否上架商品 */ @NotNull(message = "是否上架商品不能为空") - private Integer visible; + private Boolean visible; /** * 排序字段 */ diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuUpdateBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuUpdateBO.java index aaf1faa36..f7f93cafe 100644 --- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuUpdateBO.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuUpdateBO.java @@ -48,7 +48,7 @@ public class ProductSpuUpdateBO { * 是否上架商品 */ @NotNull(message = "是否上架商品不能为空") - private Integer visible; + private Boolean visible; /** * 排序字段 */