Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
24f3e697
提交
24f3e697
authored
7月 25, 2020
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
商品品牌的迁移,准备和前端管理后台对接
上级
2b845968
显示空白字符变更
内嵌
并排
正在显示
75 个修改的文件
包含
792 行增加
和
2037 行删除
+792
-2037
ProductBrandController.java
...agementweb/controller/product/ProductBrandController.java
+82
-0
ProductBrandCreateReqVO.java
.../controller/product/vo/brand/ProductBrandCreateReqVO.java
+20
-0
ProductBrandPageReqVO.java
...eb/controller/product/vo/brand/ProductBrandPageReqVO.java
+6
-11
ProductBrandRespVO.java
...ntweb/controller/product/vo/brand/ProductBrandRespVO.java
+24
-0
ProductBrandUpdateReqVO.java
.../controller/product/vo/brand/ProductBrandUpdateReqVO.java
+8
-24
ProductCategoryRespVO.java
...controller/product/vo/category/ProductCategoryRespVO.java
+1
-1
ProductBrandConvert.java
...ll/managementweb/convert/product/ProductBrandConvert.java
+34
-0
ProductBrandManager.java
...ll/managementweb/manager/product/ProductBrandManager.java
+94
-0
application.yml
management-web-app/src/main/resources/application.yml
+2
-0
ProductErrorCodeConstants.java
.../mall/productservice/enums/ProductErrorCodeConstants.java
+2
-4
ProductBrandRpc.java
...ocoder/mall/productservice/rpc/brand/ProductBrandRpc.java
+63
-0
ProductBrandCreateReqDTO.java
...roductservice/rpc/brand/dto/ProductBrandCreateReqDTO.java
+10
-17
ProductBrandPageReqDTO.java
.../productservice/rpc/brand/dto/ProductBrandPageReqDTO.java
+6
-12
ProductBrandRespDTO.java
...all/productservice/rpc/brand/dto/ProductBrandRespDTO.java
+8
-21
ProductBrandUpdateReqDTO.java
...roductservice/rpc/brand/dto/ProductBrandUpdateReqDTO.java
+12
-20
ProductBrandConvert.java
...all/productservice/convert/brand/ProductBrandConvert.java
+45
-0
ProductBrandDO.java
...uctservice/dal/mysql/dataobject/brand/ProductBrandDO.java
+11
-13
ProductCategoryDO.java
...vice/dal/mysql/dataobject/category/ProductCategoryDO.java
+2
-2
ProductBrandMapper.java
...uctservice/dal/mysql/mapper/brand/ProductBrandMapper.java
+25
-0
ProductBrandManager.java
...all/productservice/manager/brand/ProductBrandManager.java
+86
-0
ProductBrandRpcImpl.java
...er/mall/productservice/rpc/brand/ProductBrandRpcImpl.java
+58
-0
ProductBrandService.java
...all/productservice/service/brand/ProductBrandService.java
+119
-0
ProductBrandBO.java
.../mall/productservice/service/brand/bo/ProductBrandBO.java
+13
-15
ProductBrandCreateBO.java
...productservice/service/brand/bo/ProductBrandCreateBO.java
+12
-17
ProductBrandPageBO.java
...l/productservice/service/brand/bo/ProductBrandPageBO.java
+27
-0
ProductBrandUpdateBO.java
...productservice/service/brand/bo/ProductBrandUpdateBO.java
+14
-20
ProductCategoryCreateBO.java
...tservice/service/category/bo/ProductCategoryCreateBO.java
+3
-0
ProductCategoryUpdateBO.java
...tservice/service/category/bo/ProductCategoryUpdateBO.java
+3
-0
application.yaml
...t/product-service-app/src/main/resources/application.yaml
+2
-0
ProductBrandConvert.java
...r/mall/product/biz/convert/brand/ProductBrandConvert.java
+0
-36
ProductBrandMapper.java
...ocoder/mall/product/biz/dao/brand/ProductBrandMapper.java
+0
-25
ProductBrandService.java
...r/mall/product/biz/service/brand/ProductBrandService.java
+0
-45
ProductBrandServiceImpl.java
...ll/product/biz/service/brand/ProductBrandServiceImpl.java
+0
-66
AdminsProductCategoryController.java
.../controller/category/AdminsProductCategoryController.java
+0
-110
ProductBrandAddRequest.java
...ll/product/rest/request/brand/ProductBrandAddRequest.java
+0
-27
ProductBrandUpdateRequest.java
...product/rest/request/brand/ProductBrandUpdateRequest.java
+0
-32
AdminsProductCategoryAddResponse.java
...t/response/category/AdminsProductCategoryAddResponse.java
+0
-43
AdminsProductCategoryTreeNodeResponse.java
...ponse/category/AdminsProductCategoryTreeNodeResponse.java
+0
-48
rest.yaml
product/product-rest/src/main/resources/rest.yaml
+0
-12
package-info.java
...c/main/java/cn/iocoder/mall/product/rpc/package-info.java
+0
-4
package-info.java
...c/main/java/cn/iocoder/mall/product/rpc/package-info.java
+0
-4
rpc-local.yaml
product/product-rpc/src/main/resources/rpc-local.yaml
+0
-14
rpc-test.yaml
product/product-rpc/src/main/resources/rpc-test.yaml
+0
-14
rpc.yaml
product/product-rpc/src/main/resources/rpc.yaml
+0
-22
ProductBrandService.java
...java/cn/iocoder/mall/product/api/ProductBrandService.java
+0
-40
ProductCategoryService.java
...a/cn/iocoder/mall/product/api/ProductCategoryService.java
+0
-42
ProductBrangPageBO.java
...va/cn/iocoder/mall/product/api/bo/ProductBrangPageBO.java
+0
-25
ProductAttrConstants.java
...coder/mall/product/api/constant/ProductAttrConstants.java
+0
-23
ProductCategoryConstants.java
...r/mall/product/api/constant/ProductCategoryConstants.java
+0
-20
ProductErrorCodeEnum.java
...coder/mall/product/api/constant/ProductErrorCodeEnum.java
+0
-54
ProductSpuConstants.java
...ocoder/mall/product/api/constant/ProductSpuConstants.java
+0
-14
ProductBrandPageDTO.java
.../cn/iocoder/mall/product/api/dto/ProductBrandPageDTO.java
+0
-36
ProductCategoryAddDTO.java
...n/iocoder/mall/product/api/dto/ProductCategoryAddDTO.java
+0
-41
ProductCategoryUpdateDTO.java
...ocoder/mall/product/api/dto/ProductCategoryUpdateDTO.java
+0
-46
DatabaseConfiguration.java
...cn/iocoder/mall/product/config/DatabaseConfiguration.java
+0
-12
ServiceExceptionConfiguration.java
...er/mall/product/config/ServiceExceptionConfiguration.java
+0
-27
ProductBrandConvert.java
.../cn/iocoder/mall/product/convert/ProductBrandConvert.java
+0
-31
ProductCategoryConvert.java
.../iocoder/mall/product/convert/ProductCategoryConvert.java
+0
-31
ProductBrandMapper.java
.../java/cn/iocoder/mall/product/dao/ProductBrandMapper.java
+0
-66
ProductCategoryMapper.java
...va/cn/iocoder/mall/product/dao/ProductCategoryMapper.java
+0
-26
ProductBrandDO.java
...va/cn/iocoder/mall/product/dataobject/ProductBrandDO.java
+0
-41
ProductCategoryDO.java
...cn/iocoder/mall/product/dataobject/ProductCategoryDO.java
+0
-48
ProductBrandServiceImpl.java
...iocoder/mall/product/service/ProductBrandServiceImpl.java
+0
-95
ProductBrandMapper.xml
...ice-impl/src/main/resources/mapper/ProductBrandMapper.xml
+0
-96
ProductCategoryMapper.xml
...-impl/src/main/resources/mapper/ProductCategoryMapper.xml
+0
-84
ProductApplication.java
.../iocoder/mall/product/application/ProductApplication.java
+0
-26
AdminsProductBrandController.java
...ation/controller/admins/AdminsProductBrandController.java
+0
-113
AdminsProductCategoryController.java
...on/controller/admins/AdminsProductCategoryController.java
+0
-126
ProductBrandConvert.java
...mall/product/application/convert/ProductBrandConvert.java
+0
-22
ProductCategoryConvert.java
...l/product/application/convert/ProductCategoryConvert.java
+0
-41
AdminsProductBrangPageVO.java
...oduct/application/vo/admins/AdminsProductBrangPageVO.java
+0
-25
AdminsProductCategoryTreeNodeVO.java
...pplication/vo/admins/AdminsProductCategoryTreeNodeVO.java
+0
-35
AdminsProductCategoryVO.java
...roduct/application/vo/admins/AdminsProductCategoryVO.java
+0
-32
application-test.yaml
...ct/product-start/src/main/resources/application-test.yaml
+0
-6
application.yaml
product/product-start/src/main/resources/application.yaml
+0
-34
没有找到文件。
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductBrandController.java
0 → 100644
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
product
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandCreateReqVO
;
import
cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandPageReqVO
;
import
cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandRespVO
;
import
cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandUpdateReqVO
;
import
cn.iocoder.mall.managementweb.manager.product.ProductBrandManager
;
import
cn.iocoder.security.annotations.RequiresPermissions
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
java.util.List
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
/**
* 商品品牌 Controller
*/
@RestController
@RequestMapping
(
"/product-brand"
)
@Api
(
tags
=
"商品品牌"
)
@Validated
public
class
ProductBrandController
{
@Autowired
private
ProductBrandManager
productBrandManager
;
@PostMapping
(
"/create"
)
@ApiOperation
(
"创建商品品牌"
)
@RequiresPermissions
(
"product:brand:create"
)
public
CommonResult
<
Integer
>
createProductBrand
(
@Valid
ProductBrandCreateReqVO
createVO
)
{
return
success
(
productBrandManager
.
createProductBrand
(
createVO
));
}
@PostMapping
(
"/update"
)
@ApiOperation
(
"更新商品品牌"
)
@RequiresPermissions
(
"product:brand:update"
)
public
CommonResult
<
Boolean
>
updateProductBrand
(
@Valid
ProductBrandUpdateReqVO
updateVO
)
{
productBrandManager
.
updateProductBrand
(
updateVO
);
return
success
(
true
);
}
@PostMapping
(
"/delete"
)
@ApiOperation
(
"删除商品品牌"
)
@ApiImplicitParam
(
name
=
"productBrandId"
,
value
=
"商品品牌编号"
,
required
=
true
)
@RequiresPermissions
(
"product:brand:delete"
)
public
CommonResult
<
Boolean
>
deleteProductBrand
(
@RequestParam
(
"productBrandId"
)
Integer
productBrandId
)
{
productBrandManager
.
deleteProductBrand
(
productBrandId
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@ApiOperation
(
"获得商品品牌"
)
@ApiImplicitParam
(
name
=
"productBrandId"
,
value
=
"商品品牌编号"
,
required
=
true
)
@RequiresPermissions
(
"product:brand:page"
)
public
CommonResult
<
ProductBrandRespVO
>
getProductBrand
(
@RequestParam
(
"productBrandId"
)
Integer
productBrandId
)
{
return
success
(
productBrandManager
.
getProductBrand
(
productBrandId
));
}
@GetMapping
(
"/list"
)
@ApiOperation
(
"获得商品品牌列表"
)
@ApiImplicitParam
(
name
=
"productBrandIds"
,
value
=
"商品品牌编号列表"
,
required
=
true
)
@RequiresPermissions
(
"product:brand:page"
)
public
CommonResult
<
List
<
ProductBrandRespVO
>>
listProductBrands
(
@RequestParam
(
"productBrandIds"
)
List
<
Integer
>
productBrandIds
)
{
return
success
(
productBrandManager
.
listProductBrands
(
productBrandIds
));
}
@GetMapping
(
"/page"
)
@ApiOperation
(
"获得商品品牌分页"
)
@RequiresPermissions
(
"product:brand:page"
)
public
CommonResult
<
PageResult
<
ProductBrandRespVO
>>
pageProductBrand
(
ProductBrandPageReqVO
pageVO
)
{
return
success
(
productBrandManager
.
pageProductBrand
(
pageVO
));
}
}
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandCreateReqVO.java
0 → 100644
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
product
.
vo
.
brand
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@ApiModel
(
"商品品牌创建 Request VO"
)
@Data
public
class
ProductBrandCreateReqVO
{
@ApiModelProperty
(
value
=
"品牌名称"
,
required
=
true
,
example
=
"这个商品品牌很吊"
)
private
String
name
;
@ApiModelProperty
(
value
=
"品牌描述"
,
example
=
"这个商品描述很吊"
)
private
String
description
;
@ApiModelProperty
(
value
=
"品牌名图片"
,
example
=
"http://www.iocoder.cn/xx.jpg"
)
private
String
picUrl
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
example
=
"1"
,
notes
=
"见 CommonStatusEnum 枚举"
)
private
Integer
status
;
}
product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandPageRequest
.java
→
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandPageReqVO
.java
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
product
.
rest
.
request
.
brand
;
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
product
.
vo
.
brand
;
import
cn.iocoder.common.framework.vo.PageParam
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
@ApiModel
(
"商品
- 品牌模块 - 品牌分页 Request
"
)
@ApiModel
(
"商品
品牌分页 Request VO
"
)
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
public
class
ProductBrandPageRequest
extends
PageParam
{
public
class
ProductBrandPageReqVO
extends
PageParam
{
@ApiModelProperty
(
name
=
"name"
,
value
=
"品牌名称"
,
required
=
true
,
example
=
"安踏
"
)
@ApiModelProperty
(
value
=
"品牌名称"
,
required
=
true
,
notes
=
"模糊匹配"
,
example
=
"这个商品品牌很吊
"
)
private
String
name
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
example
=
"1"
,
notes
=
"见 CommonStatusEnum 枚举"
)
private
Integer
status
;
@ApiModelProperty
(
name
=
"name"
,
value
=
"品牌描述"
,
required
=
true
,
example
=
"安踏拖鞋"
)
private
String
description
;
@ApiModelProperty
(
name
=
"name"
,
value
=
"状态 1开启 2禁用"
,
required
=
true
,
example
=
"1"
)
private
String
status
;
}
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandRespVO.java
0 → 100644
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
product
.
vo
.
brand
;
import
lombok.*
;
import
io.swagger.annotations.*
;
import
java.util.*
;
@ApiModel
(
"商品品牌 Response VO"
)
@Data
public
class
ProductBrandRespVO
{
@ApiModelProperty
(
value
=
"品牌编号"
,
required
=
true
,
example
=
"1024"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"品牌名称"
,
required
=
true
,
example
=
"这个商品品牌很吊"
)
private
String
name
;
@ApiModelProperty
(
value
=
"品牌描述"
,
example
=
"这个商品描述很吊"
)
private
String
description
;
@ApiModelProperty
(
value
=
"品牌名图片"
,
example
=
"http://www.iocoder.cn/xx.jpg"
)
private
String
picUrl
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
example
=
"1"
,
notes
=
"见 CommonStatusEnum 枚举"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
)
private
Date
createTime
;
}
product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductBrand
VO.java
→
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandUpdateReq
VO.java
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
product
.
application
.
vo
.
admins
;
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
product
.
vo
.
brand
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
* 商品品牌 VO
*/
@ApiModel
(
value
=
"商品品牌 VO"
)
@ApiModel
(
"商品品牌更新 Request VO"
)
@Data
@Accessors
(
chain
=
true
)
public
class
AdminsProductBrandVO
{
public
class
ProductBrandUpdateReqVO
{
/**
* 品牌编号
*/
@ApiModelProperty
(
value
=
"品牌编号"
,
required
=
true
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"品牌编号"
,
required
=
true
,
example
=
"1024"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"名称"
,
required
=
true
,
example
=
"安踏"
)
@ApiModelProperty
(
value
=
"品牌名称"
,
required
=
true
,
example
=
"这个商品品牌很吊"
)
private
String
name
;
@ApiModelProperty
(
value
=
"描述"
,
required
=
true
,
example
=
"安踏拖鞋"
)
@ApiModelProperty
(
value
=
"品牌描述"
,
example
=
"这个商品描述很吊"
)
private
String
description
;
@ApiModelProperty
(
value
=
"图片地址"
,
required
=
true
,
example
=
"http://www.iocoder.cn"
)
@ApiModelProperty
(
value
=
"品牌名图片"
,
example
=
"http://www.iocoder.cn/xx.jpg"
)
private
String
picUrl
;
@ApiModelProperty
(
value
=
"状态 1-开启 2-禁用"
,
required
=
true
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
example
=
"1"
,
notes
=
"见 CommonStatusEnum 枚举"
)
private
Integer
status
;
}
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryRespVO.java
浏览文件 @
24f3e697
...
...
@@ -16,7 +16,7 @@ public class ProductCategoryRespVO {
private
Integer
pid
;
@ApiModelProperty
(
value
=
"分类名称"
,
required
=
true
,
example
=
"手机"
)
private
String
name
;
@ApiModelProperty
(
value
=
"分类描述"
,
required
=
true
,
example
=
"这个商品很吊"
)
@ApiModelProperty
(
value
=
"分类描述"
,
required
=
true
,
example
=
"这个商品
分类
很吊"
)
private
String
description
;
@ApiModelProperty
(
value
=
"分类图片"
,
notes
=
"一般情况下,只有根分类才有图片"
,
example
=
"http://www.iocoder.cn/xx.jpg"
)
private
String
picUrl
;
...
...
management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductBrandConvert.java
0 → 100644
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
managementweb
.
convert
.
product
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandCreateReqVO
;
import
cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandPageReqVO
;
import
cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandRespVO
;
import
cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandUpdateReqVO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
@Mapper
public
interface
ProductBrandConvert
{
ProductBrandConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductBrandConvert
.
class
);
ProductBrandCreateReqDTO
convert
(
ProductBrandCreateReqVO
bean
);
ProductBrandUpdateReqDTO
convert
(
ProductBrandUpdateReqVO
bean
);
ProductBrandRespVO
convert
(
ProductBrandRespDTO
bean
);
List
<
ProductBrandRespVO
>
convertList
(
List
<
ProductBrandRespDTO
>
list
);
PageResult
<
ProductBrandRespVO
>
convertPage
(
PageResult
<
ProductBrandRespDTO
>
page
);
ProductBrandPageReqDTO
convert
(
ProductBrandPageReqVO
bean
);
}
management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductBrandManager.java
0 → 100644
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
managementweb
.
manager
.
product
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandCreateReqVO
;
import
cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandPageReqVO
;
import
cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandRespVO
;
import
cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandUpdateReqVO
;
import
cn.iocoder.mall.managementweb.convert.product.ProductBrandConvert
;
import
cn.iocoder.mall.productservice.rpc.brand.ProductBrandRpc
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO
;
import
org.apache.dubbo.config.annotation.Reference
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* 商品品牌 Manager
*/
@Service
public
class
ProductBrandManager
{
@Reference
(
version
=
"${dubbo.consumer.ProductBrandRpc.version}"
)
private
ProductBrandRpc
productBrandRpc
;
/**
* 创建商品品牌
*
* @param createVO 创建商品品牌 VO
* @return 商品品牌
*/
public
Integer
createProductBrand
(
ProductBrandCreateReqVO
createVO
)
{
CommonResult
<
Integer
>
createProductBrandResult
=
productBrandRpc
.
createProductBrand
(
ProductBrandConvert
.
INSTANCE
.
convert
(
createVO
));
createProductBrandResult
.
checkError
();
return
createProductBrandResult
.
getData
();
}
/**
* 更新商品品牌
*
* @param updateVO 更新商品品牌 VO
*/
public
void
updateProductBrand
(
ProductBrandUpdateReqVO
updateVO
)
{
CommonResult
<
Boolean
>
updateProductBrandResult
=
productBrandRpc
.
updateProductBrand
(
ProductBrandConvert
.
INSTANCE
.
convert
(
updateVO
));
updateProductBrandResult
.
checkError
();
}
/**
* 删除商品品牌
*
* @param productBrandId 商品品牌编号
*/
public
void
deleteProductBrand
(
Integer
productBrandId
)
{
CommonResult
<
Boolean
>
deleteProductBrandResult
=
productBrandRpc
.
deleteProductBrand
(
productBrandId
);
deleteProductBrandResult
.
checkError
();
}
/**
* 获得商品品牌
*
* @param productBrandId 商品品牌编号
* @return 商品品牌
*/
public
ProductBrandRespVO
getProductBrand
(
Integer
productBrandId
)
{
CommonResult
<
ProductBrandRespDTO
>
getProductBrandResult
=
productBrandRpc
.
getProductBrand
(
productBrandId
);
getProductBrandResult
.
checkError
();
return
ProductBrandConvert
.
INSTANCE
.
convert
(
getProductBrandResult
.
getData
());
}
/**
* 获得商品品牌列表
*
* @param productBrandIds 商品品牌编号列表
* @return 商品品牌列表
*/
public
List
<
ProductBrandRespVO
>
listProductBrands
(
List
<
Integer
>
productBrandIds
)
{
CommonResult
<
List
<
ProductBrandRespDTO
>>
listProductBrandResult
=
productBrandRpc
.
listProductBrands
(
productBrandIds
);
listProductBrandResult
.
checkError
();
return
ProductBrandConvert
.
INSTANCE
.
convertList
(
listProductBrandResult
.
getData
());
}
/**
* 获得商品品牌分页
*
* @param pageVO 商品品牌分页查询
* @return 商品品牌分页结果
*/
public
PageResult
<
ProductBrandRespVO
>
pageProductBrand
(
ProductBrandPageReqVO
pageVO
)
{
CommonResult
<
PageResult
<
ProductBrandRespDTO
>>
pageProductBrandResult
=
productBrandRpc
.
pageProductBrand
(
ProductBrandConvert
.
INSTANCE
.
convert
(
pageVO
));
pageProductBrandResult
.
checkError
();
return
ProductBrandConvert
.
INSTANCE
.
convertPage
(
pageProductBrandResult
.
getData
());
}
}
management-web-app/src/main/resources/application.yml
浏览文件 @
24f3e697
...
...
@@ -51,6 +51,8 @@ dubbo:
version
:
1.0.0
ProductCategoryRpc
:
version
:
1.0.0
ProductBrandRpc
:
version
:
1.0.0
# Swagger 配置项
swagger
:
...
...
product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/enums/ProductErrorCodeConstants.java
浏览文件 @
24f3e697
...
...
@@ -12,10 +12,7 @@ public interface ProductErrorCodeConstants {
// ========== PRODUCT CATEGORY 模块 ==========
ErrorCode
PRODUCT_CATEGORY_PARENT_NOT_EXISTS
=
new
ErrorCode
(
1003001000
,
"父分类不存在"
);
ErrorCode
PRODUCT_CATEGORY_NOT_EXISTS
=
new
ErrorCode
(
1003001001
,
"商品分类不存在"
);
ErrorCode
PRODUCT_CATEGORY_STATUS_NOT_EXISTS
=
new
ErrorCode
(
1003001001
,
"商品分类状态不存在"
);
ErrorCode
PRODUCT_CATEGORY_PARENT_NOT_SELF
=
new
ErrorCode
(
1003001002
,
"不能设置自己为父分类"
);
ErrorCode
PRODUCT_CATEGORY_STATUS_EQUALS
=
new
ErrorCode
(
1002001003
,
"商品分类已经是该状态"
);
ErrorCode
PRODUCT_CATEGORY_DELETE_ONLY_DISABLE
=
new
ErrorCode
(
1002001004
,
"只有关闭的商品分类才可以删除"
);
ErrorCode
PRODUCT_CATEGORY_DELETE_ONLY_NO_CHILD
=
new
ErrorCode
(
1002001004
,
"只有无子分类的商品分类才可以删除"
);
ErrorCode
PRODUCT_CATEGORY_MUST_ENABLE
=
new
ErrorCode
(
1002001005
,
"只有开启的商品分类,才可以使用"
);
ErrorCode
PRODUCT_CATEGORY_PARENT_CAN_NOT_BE_LEVEL2
=
new
ErrorCode
(
1002001005
,
"父分类必须是一级分类"
);
...
...
@@ -36,6 +33,7 @@ public interface ProductErrorCodeConstants {
ErrorCode
PRODUCT_ATTR_VALUE_STATUS_EQUALS
=
new
ErrorCode
(
1003003005
,
"商品规格值已经是该状态"
);
// ========== PRODUCT BRAND模块 ==========
ErrorCode
PRODUCT_BRAND_EXIST
=
new
ErrorCode
(
1003004000
,
"品牌值已经存在"
);
ErrorCode
PRODUCT_BRAND_NAME_EXIST
=
new
ErrorCode
(
1003004000
,
"商品品牌的名字已经存在"
);
ErrorCode
PRODUCT_BRAND_NOT_FOUND
=
new
ErrorCode
(
1003004001
,
"商品品牌不粗糙你在"
);
}
product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandRpc.java
0 → 100644
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
productservice
.
rpc
.
brand
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO
;
import
java.util.List
;
/**
* 商品品牌 Rpc 接口
*/
public
interface
ProductBrandRpc
{
/**
* 创建商品品牌
*
* @param createDTO 创建商品品牌 DTO
* @return 商品品牌编号
*/
CommonResult
<
Integer
>
createProductBrand
(
ProductBrandCreateReqDTO
createDTO
);
/**
* 更新商品品牌
*
* @param updateDTO 更新商品品牌 DTO
*/
CommonResult
<
Boolean
>
updateProductBrand
(
ProductBrandUpdateReqDTO
updateDTO
);
/**
* 删除商品品牌
*
* @param productBrandId 商品品牌编号
*/
CommonResult
<
Boolean
>
deleteProductBrand
(
Integer
productBrandId
);
/**
* 获得商品品牌
*
* @param productBrandId 商品品牌编号
* @return 商品品牌
*/
CommonResult
<
ProductBrandRespDTO
>
getProductBrand
(
Integer
productBrandId
);
/**
* 获得商品品牌列表
*
* @param productBrandIds 商品品牌编号列表
* @return 商品品牌列表
*/
CommonResult
<
List
<
ProductBrandRespDTO
>>
listProductBrands
(
List
<
Integer
>
productBrandIds
);
/**
* 获得商品品牌分页
*
* @param pageDTO 商品品牌分页查询
* @return 商品品牌分页结果
*/
CommonResult
<
PageResult
<
ProductBrandRespDTO
>>
pageProductBrand
(
ProductBrandPageReqDTO
pageDTO
);
}
product
/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandAdd
DTO.java
→
product
-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandCreateReq
DTO.java
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
product
.
api
.
dto
;
package
cn
.
iocoder
.
mall
.
product
service
.
rpc
.
brand
.
dto
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* Product 品牌添加
DTO
*/
* 商品品牌创建 Request
DTO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductBrand
AddDTO
{
public
class
ProductBrand
CreateReqDTO
implements
Serializable
{
/**
* 名称
*
品牌
名称
*/
@NotEmpty
(
message
=
"品牌名不能为空"
)
@NotEmpty
(
message
=
"品牌名
称
不能为空"
)
private
String
name
;
/**
* 描述
*
品牌
描述
*/
@NotEmpty
(
message
=
"品牌描述不能为空"
)
private
String
description
;
/**
*
图片地址
*
品牌名图片
*/
@NotEmpty
(
message
=
"品牌图片地址不能为空"
)
private
String
picUrl
;
/**
* 状态
*
* 1-开启
* 2-禁用
*/
@NotNull
(
message
=
"
品牌
状态不能为空"
)
@NotNull
(
message
=
"状态不能为空"
)
private
Integer
status
;
}
product
/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandPage
DTO.java
→
product
-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandPageReq
DTO.java
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
product
.
biz
.
dto
.
brand
;
package
cn
.
iocoder
.
mall
.
product
service
.
rpc
.
brand
.
dto
;
import
cn.iocoder.common.framework.vo.PageParam
;
import
lombok.Data
;
...
...
@@ -6,25 +6,19 @@ import lombok.EqualsAndHashCode;
import
lombok.experimental.Accessors
;
/**
* 商品品牌分页
DTO
*/
* 商品品牌分页 Request
DTO
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
public
class
ProductBrandPageDTO
extends
PageParam
{
public
class
ProductBrandPage
Req
DTO
extends
PageParam
{
/**
*
名称
* 品牌
名称
*/
private
String
name
;
/**
* 描述
*/
private
String
description
;
/**
* 状态 1-开启 2-禁用
* 状态
*/
private
Integer
status
;
...
...
product
/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductCategoryB
O.java
→
product
-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandRespDT
O.java
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
product
.
api
.
b
o
;
package
cn
.
iocoder
.
mall
.
product
service
.
rpc
.
brand
.
dt
o
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
...
...
@@ -7,43 +7,30 @@ import java.io.Serializable;
import
java.util.Date
;
/**
* 商品分类 B
O
*/
* 商品品牌 Response DT
O
*/
@Data
@Accessors
(
chain
=
true
)
public
class
Product
CategoryB
O
implements
Serializable
{
public
class
Product
BrandRespDT
O
implements
Serializable
{
/**
*
分类编号
*
品牌编号(主键)
*/
private
Integer
id
;
/**
* 父分类编号
*
* 如果不存在父级,则 pid = 0 。
*/
private
Integer
pid
;
/**
* 名称
* 品牌名称
*/
private
String
name
;
/**
* 描述
*
品牌
描述
*/
private
String
description
;
/**
*
分类
图片
*
品牌名
图片
*/
private
String
picUrl
;
/**
* 排序值
*/
private
Integer
sort
;
/**
* 状态
*
* 1-开启
* 2-关闭
*/
private
Integer
status
;
/**
...
...
product
/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandUpdate
DTO.java
→
product
-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandUpdateReq
DTO.java
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
product
.
api
.
dto
;
package
cn
.
iocoder
.
mall
.
product
service
.
rpc
.
brand
.
dto
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* Product 品牌添加
DTO
*/
* 商品品牌更新 Request
DTO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductBrandUpdate
DTO
{
public
class
ProductBrandUpdate
ReqDTO
implements
Serializable
{
/**
*
主键
*
品牌编号
*/
@NotNull
(
message
=
"品牌
主键
不能为空"
)
@NotNull
(
message
=
"品牌
编号
不能为空"
)
private
Integer
id
;
/**
* 名称
*
品牌
名称
*/
@NotEmpty
(
message
=
"品牌名不能为空"
)
@NotEmpty
(
message
=
"品牌名
称
不能为空"
)
private
String
name
;
/**
* 描述
*
品牌
描述
*/
@NotEmpty
(
message
=
"品牌描述不能为空"
)
private
String
description
;
/**
*
图片地址
*
品牌名图片
*/
@NotEmpty
(
message
=
"品牌图片地址不能为空"
)
private
String
picUrl
;
/**
* 状态
*
* 1-开启
* 2-禁用
*/
@NotNull
(
message
=
"
品牌
状态不能为空"
)
@NotNull
(
message
=
"状态不能为空"
)
private
Integer
status
;
}
product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/brand/ProductBrandConvert.java
0 → 100644
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
productservice
.
convert
.
brand
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.productservice.dal.mysql.dataobject.brand.ProductBrandDO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO
;
import
cn.iocoder.mall.productservice.service.brand.bo.ProductBrandBO
;
import
cn.iocoder.mall.productservice.service.brand.bo.ProductBrandCreateBO
;
import
cn.iocoder.mall.productservice.service.brand.bo.ProductBrandPageBO
;
import
cn.iocoder.mall.productservice.service.brand.bo.ProductBrandUpdateBO
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
@Mapper
public
interface
ProductBrandConvert
{
ProductBrandConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductBrandConvert
.
class
);
ProductBrandDO
convert
(
ProductBrandCreateBO
bean
);
ProductBrandBO
convert
(
ProductBrandDO
bean
);
ProductBrandDO
convert
(
ProductBrandUpdateBO
bean
);
List
<
ProductBrandBO
>
convertList
(
List
<
ProductBrandDO
>
list
);
PageResult
<
ProductBrandBO
>
convertPage
(
IPage
<
ProductBrandDO
>
page
);
ProductBrandCreateBO
convert
(
ProductBrandCreateReqDTO
bean
);
ProductBrandUpdateBO
convert
(
ProductBrandUpdateReqDTO
bean
);
ProductBrandRespDTO
convert
(
ProductBrandBO
bean
);
List
<
ProductBrandRespDTO
>
convertList02
(
List
<
ProductBrandBO
>
list
);
ProductBrandPageBO
convert
(
ProductBrandPageReqDTO
bean
);
PageResult
<
ProductBrandRespDTO
>
convertPage
(
PageResult
<
ProductBrandBO
>
page
);
}
product
/product-biz/src/main/java/cn/iocoder/mall/product/biz
/dataobject/brand/ProductBrandDO.java
→
product
-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql
/dataobject/brand/ProductBrandDO.java
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
product
.
biz
.
dataobject
.
brand
;
package
cn
.
iocoder
.
mall
.
product
service
.
dal
.
mysql
.
dataobject
.
brand
;
import
cn.iocoder.mall.mybatis.core.dataobject.DeletableDO
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
/**
* Product 品牌
*/
* 商品品牌
*/
@TableName
(
"product_brand"
)
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
public
class
ProductBrandDO
extends
DeletableDO
{
/**
*
规格编号
*
品牌编号(主键)
*/
@TableId
private
Integer
id
;
/**
* 名称
*
品牌
名称
*/
private
String
name
;
/**
* 描述
*
品牌
描述
*/
private
String
description
;
/**
*
图片地址
*
品牌名图片
*/
private
String
picUrl
;
/**
* 状态
* <p>
* 1-开启
* 2-禁用
*/
private
Integer
status
;
...
...
product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/category/ProductCategoryDO.java
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
productservice
.
dal
.
mysql
.
dataobject
.
category
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.mall.mybatis.core.dataobject.
Bas
eDO
;
import
cn.iocoder.mall.mybatis.core.dataobject.
Deletabl
eDO
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
...
...
@@ -15,7 +15,7 @@ import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
public
class
ProductCategoryDO
extends
Bas
eDO
{
public
class
ProductCategoryDO
extends
Deletabl
eDO
{
/**
* 分类编号
...
...
product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/brand/ProductBrandMapper.java
0 → 100644
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
productservice
.
dal
.
mysql
.
mapper
.
brand
;
import
cn.iocoder.mall.mybatis.core.query.QueryWrapperX
;
import
cn.iocoder.mall.productservice.dal.mysql.dataobject.brand.ProductBrandDO
;
import
cn.iocoder.mall.productservice.service.brand.bo.ProductBrandPageBO
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.springframework.stereotype.Repository
;
@Repository
public
interface
ProductBrandMapper
extends
BaseMapper
<
ProductBrandDO
>
{
default
IPage
<
ProductBrandDO
>
selectPage
(
ProductBrandPageBO
pageBO
)
{
return
selectPage
(
new
Page
<>(
pageBO
.
getPageNo
(),
pageBO
.
getPageSize
()),
new
QueryWrapperX
<
ProductBrandDO
>().
likeIfPresent
(
"name"
,
pageBO
.
getName
())
.
eqIfPresent
(
"status"
,
pageBO
.
getStatus
()));
}
default
ProductBrandDO
selectByName
(
String
name
)
{
return
selectOne
(
new
QueryWrapper
<
ProductBrandDO
>().
eq
(
"name"
,
name
));
}
}
product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/brand/ProductBrandManager.java
0 → 100644
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
productservice
.
manager
.
brand
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.productservice.convert.brand.ProductBrandConvert
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO
;
import
cn.iocoder.mall.productservice.service.brand.ProductBrandService
;
import
cn.iocoder.mall.productservice.service.brand.bo.ProductBrandBO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* 商品品牌 Manager
*/
@Service
public
class
ProductBrandManager
{
@Autowired
private
ProductBrandService
productBrandService
;
/**
* 创建商品品牌
*
* @param createDTO 创建商品品牌 DTO
* @return 商品品牌
*/
public
Integer
createProductBrand
(
ProductBrandCreateReqDTO
createDTO
)
{
ProductBrandBO
productBrandBO
=
productBrandService
.
createProductBrand
(
ProductBrandConvert
.
INSTANCE
.
convert
(
createDTO
));
return
productBrandBO
.
getId
();
}
/**
* 更新商品品牌
*
* @param updateDTO 更新商品品牌 DTO
*/
public
void
updateProductBrand
(
ProductBrandUpdateReqDTO
updateDTO
)
{
productBrandService
.
updateProductBrand
(
ProductBrandConvert
.
INSTANCE
.
convert
(
updateDTO
));
}
/**
* 删除商品品牌
*
* @param productBrandId 商品品牌编号
*/
public
void
deleteProductBrand
(
Integer
productBrandId
)
{
productBrandService
.
deleteProductBrand
(
productBrandId
);
}
/**
* 获得商品品牌
*
* @param productBrandId 商品品牌编号
* @return 商品品牌
*/
public
ProductBrandRespDTO
getProductBrand
(
Integer
productBrandId
)
{
ProductBrandBO
productBrandBO
=
productBrandService
.
getProductBrand
(
productBrandId
);
return
ProductBrandConvert
.
INSTANCE
.
convert
(
productBrandBO
);
}
/**
* 获得商品品牌列表
*
* @param productBrandIds 商品品牌编号列表
* @return 商品品牌列表
*/
public
List
<
ProductBrandRespDTO
>
listProductBrands
(
List
<
Integer
>
productBrandIds
)
{
List
<
ProductBrandBO
>
productBrandBOs
=
productBrandService
.
listProductBrands
(
productBrandIds
);
return
ProductBrandConvert
.
INSTANCE
.
convertList02
(
productBrandBOs
);
}
/**
* 获得商品品牌分页
*
* @param pageDTO 商品品牌分页查询
* @return 商品品牌分页结果
*/
public
PageResult
<
ProductBrandRespDTO
>
pageProductBrand
(
ProductBrandPageReqDTO
pageDTO
)
{
PageResult
<
ProductBrandBO
>
pageResultBO
=
productBrandService
.
pageProductBrand
(
ProductBrandConvert
.
INSTANCE
.
convert
(
pageDTO
));
return
ProductBrandConvert
.
INSTANCE
.
convertPage
(
pageResultBO
);
}
}
product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandRpcImpl.java
0 → 100644
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
productservice
.
rpc
.
brand
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.productservice.manager.brand.ProductBrandManager
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO
;
import
org.apache.dubbo.config.annotation.Service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.List
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
/**
* 商品品牌 Rpc 实现类
*/
@Service
(
version
=
"${dubbo.provider.ProductBrandRpc.version}"
)
public
class
ProductBrandRpcImpl
implements
ProductBrandRpc
{
@Autowired
private
ProductBrandManager
productBrandManager
;
@Override
public
CommonResult
<
Integer
>
createProductBrand
(
ProductBrandCreateReqDTO
createDTO
)
{
return
success
(
productBrandManager
.
createProductBrand
(
createDTO
));
}
@Override
public
CommonResult
<
Boolean
>
updateProductBrand
(
ProductBrandUpdateReqDTO
updateDTO
)
{
productBrandManager
.
updateProductBrand
(
updateDTO
);
return
success
(
true
);
}
@Override
public
CommonResult
<
Boolean
>
deleteProductBrand
(
Integer
productBrandId
)
{
productBrandManager
.
deleteProductBrand
(
productBrandId
);
return
success
(
true
);
}
@Override
public
CommonResult
<
ProductBrandRespDTO
>
getProductBrand
(
Integer
productBrandId
)
{
return
success
(
productBrandManager
.
getProductBrand
(
productBrandId
));
}
@Override
public
CommonResult
<
List
<
ProductBrandRespDTO
>>
listProductBrands
(
List
<
Integer
>
productBrandIds
)
{
return
success
(
productBrandManager
.
listProductBrands
(
productBrandIds
));
}
@Override
public
CommonResult
<
PageResult
<
ProductBrandRespDTO
>>
pageProductBrand
(
ProductBrandPageReqDTO
pageDTO
)
{
return
success
(
productBrandManager
.
pageProductBrand
(
pageDTO
));
}
}
product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/ProductBrandService.java
0 → 100644
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
productservice
.
service
.
brand
;
import
cn.iocoder.common.framework.exception.util.ServiceExceptionUtil
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.productservice.convert.brand.ProductBrandConvert
;
import
cn.iocoder.mall.productservice.dal.mysql.dataobject.brand.ProductBrandDO
;
import
cn.iocoder.mall.productservice.dal.mysql.mapper.brand.ProductBrandMapper
;
import
cn.iocoder.mall.productservice.service.brand.bo.ProductBrandBO
;
import
cn.iocoder.mall.productservice.service.brand.bo.ProductBrandCreateBO
;
import
cn.iocoder.mall.productservice.service.brand.bo.ProductBrandPageBO
;
import
cn.iocoder.mall.productservice.service.brand.bo.ProductBrandUpdateBO
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
javax.validation.Valid
;
import
java.util.List
;
import
static
cn
.
iocoder
.
mall
.
productservice
.
enums
.
ProductErrorCodeConstants
.
PRODUCT_BRAND_NAME_EXIST
;
import
static
cn
.
iocoder
.
mall
.
productservice
.
enums
.
ProductErrorCodeConstants
.
PRODUCT_BRAND_NOT_FOUND
;
/**
* 商品品牌 Service
*/
@Service
@Validated
public
class
ProductBrandService
{
@Autowired
private
ProductBrandMapper
productBrandMapper
;
/**
* 创建商品品牌
*
* @param createBO 创建商品品牌 BO
* @return 商品品牌
*/
public
ProductBrandBO
createProductBrand
(
@Valid
ProductBrandCreateBO
createBO
)
{
// 校验商品品牌的名字是否已经使用
if
(
productBrandMapper
.
selectByName
(
createBO
.
getName
())
!=
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PRODUCT_BRAND_NAME_EXIST
);
}
// 插入到数据库
ProductBrandDO
productBrandDO
=
ProductBrandConvert
.
INSTANCE
.
convert
(
createBO
);
productBrandMapper
.
insert
(
productBrandDO
);
// 返回
return
ProductBrandConvert
.
INSTANCE
.
convert
(
productBrandDO
);
}
/**
* 更新商品品牌
*
* @param updateBO 更新商品品牌 BO
*/
public
void
updateProductBrand
(
@Valid
ProductBrandUpdateBO
updateBO
)
{
// 校验更新的商品品牌是否存在
if
(
productBrandMapper
.
selectById
(
updateBO
.
getId
())
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PRODUCT_BRAND_NOT_FOUND
);
}
// 校验商品品牌的名字是否已经使用
ProductBrandDO
productBrandDOByName
=
productBrandMapper
.
selectByName
(
updateBO
.
getName
());
if
(
productBrandDOByName
!=
null
&&
!
updateBO
.
getId
().
equals
(
productBrandDOByName
.
getId
()))
{
throw
ServiceExceptionUtil
.
exception
(
PRODUCT_BRAND_NAME_EXIST
);
}
// 更新到数据库
ProductBrandDO
updateObject
=
ProductBrandConvert
.
INSTANCE
.
convert
(
updateBO
);
productBrandMapper
.
updateById
(
updateObject
);
}
/**
* 删除商品品牌
*
* @param productBrandId 商品品牌编号
*/
public
void
deleteProductBrand
(
Integer
productBrandId
)
{
// 校验删除的商品品牌是否存在
if
(
productBrandMapper
.
selectById
(
productBrandId
)
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PRODUCT_BRAND_NOT_FOUND
);
}
// TODO 功能点:需要品牌下没有分类
// 标记删除
productBrandMapper
.
deleteById
(
productBrandId
);
}
/**
* 获得商品品牌
*
* @param productBrandId 商品品牌编号
* @return 商品品牌
*/
public
ProductBrandBO
getProductBrand
(
Integer
productBrandId
)
{
ProductBrandDO
productBrandDO
=
productBrandMapper
.
selectById
(
productBrandId
);
return
ProductBrandConvert
.
INSTANCE
.
convert
(
productBrandDO
);
}
/**
* 获得商品品牌列表
*
* @param productBrandIds 商品品牌编号列表
* @return 商品品牌列表
*/
public
List
<
ProductBrandBO
>
listProductBrands
(
List
<
Integer
>
productBrandIds
)
{
List
<
ProductBrandDO
>
productBrandDOs
=
productBrandMapper
.
selectBatchIds
(
productBrandIds
);
return
ProductBrandConvert
.
INSTANCE
.
convertList
(
productBrandDOs
);
}
/**
* 获得商品品牌分页
*
* @param pageBO 商品品牌分页查询
* @return 商品品牌分页结果
*/
public
PageResult
<
ProductBrandBO
>
pageProductBrand
(
ProductBrandPageBO
pageBO
)
{
IPage
<
ProductBrandDO
>
productBrandDOPage
=
productBrandMapper
.
selectPage
(
pageBO
);
return
ProductBrandConvert
.
INSTANCE
.
convertPage
(
productBrandDOPage
);
}
}
product
/product-service-api/src/main/java/cn/iocoder/mall/product/api
/bo/ProductBrandBO.java
→
product
-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand
/bo/ProductBrandBO.java
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
product
.
api
.
bo
;
package
cn
.
iocoder
.
mall
.
product
service
.
service
.
brand
.
bo
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.
io.Serializabl
e
;
import
java.
util.Dat
e
;
/**
* 商品品牌 V
O
*/
* 商品品牌 B
O
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductBrandBO
implements
Serializable
{
public
class
ProductBrandBO
{
/**
*
规格编号
*
品牌编号(主键)
*/
private
Integer
id
;
/**
* 名称
*
品牌
名称
*/
private
String
name
;
/**
* 描述
*
品牌
描述
*/
private
String
description
;
/**
*
图片地址
*
品牌名图片
*/
private
String
picUrl
;
/**
* 状态
*
* 1-开启
* 2-禁用
*/
private
Integer
status
;
/**
* 创建时间
*/
private
Date
createTime
;
}
product
/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandAddDT
O.java
→
product
-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandCreateB
O.java
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
product
.
biz
.
dto
.
brand
;
package
cn
.
iocoder
.
mall
.
product
service
.
service
.
brand
.
bo
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
...
...
@@ -7,37 +9,30 @@ import javax.validation.constraints.NotEmpty;
import
javax.validation.constraints.NotNull
;
/**
* Product 品牌添加 DT
O
*/
* 商品品牌创建 B
O
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductBrand
AddDT
O
{
public
class
ProductBrand
CreateB
O
{
/**
* 名称
*
品牌
名称
*/
@NotEmpty
(
message
=
"品牌名不能为空"
)
@NotEmpty
(
message
=
"品牌名
称
不能为空"
)
private
String
name
;
/**
* 描述
*
品牌
描述
*/
@NotEmpty
(
message
=
"品牌描述不能为空"
)
private
String
description
;
/**
*
图片地址
*
品牌名图片
*/
@NotEmpty
(
message
=
"品牌图片地址不能为空"
)
private
String
picUrl
;
/**
* 状态
*
* 1-开启
* 2-禁用
*/
@NotNull
(
message
=
"品牌状态不能为空"
)
@NotNull
(
message
=
"状态不能为空"
)
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
private
Integer
status
;
}
product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandPageBO.java
0 → 100644
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
productservice
.
service
.
brand
.
bo
;
import
cn.iocoder.common.framework.vo.PageParam
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
/**
* 商品品牌分页 BO
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
public
class
ProductBrandPageBO
extends
PageParam
{
/**
* 品牌名称
*
* 模糊匹配
*/
private
String
name
;
/**
* 状态
*/
private
Integer
status
;
}
product
/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/brand/ProductBrandUpdateDT
O.java
→
product
-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandUpdateB
O.java
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
product
.
biz
.
dto
.
brand
;
package
cn
.
iocoder
.
mall
.
product
service
.
service
.
brand
.
bo
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
...
...
@@ -7,43 +9,35 @@ import javax.validation.constraints.NotEmpty;
import
javax.validation.constraints.NotNull
;
/**
* Product 品牌添加 DT
O
*/
* 商品品牌更新 B
O
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductBrandUpdate
DT
O
{
public
class
ProductBrandUpdate
B
O
{
/**
*
主键
*
品牌编号(主键)
*/
@NotNull
(
message
=
"品牌
主键
不能为空"
)
@NotNull
(
message
=
"品牌
编号(主键)
不能为空"
)
private
Integer
id
;
/**
* 名称
*
品牌
名称
*/
@NotEmpty
(
message
=
"品牌名不能为空"
)
@NotEmpty
(
message
=
"品牌名
称
不能为空"
)
private
String
name
;
/**
* 描述
*
品牌
描述
*/
@NotEmpty
(
message
=
"品牌描述不能为空"
)
private
String
description
;
/**
*
图片地址
*
品牌名图片
*/
@NotEmpty
(
message
=
"品牌图片地址不能为空"
)
private
String
picUrl
;
/**
* 状态
*
* 1-开启
* 2-禁用
*/
@NotNull
(
message
=
"品牌状态不能为空"
)
@NotNull
(
message
=
"状态不能为空"
)
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
private
Integer
status
;
}
product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryCreateBO.java
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
productservice
.
service
.
category
.
bo
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
...
...
@@ -40,6 +42,7 @@ public class ProductCategoryCreateBO {
* 状态
*/
@NotNull
(
message
=
"状态不能为空"
)
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
private
Integer
status
;
}
product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryUpdateBO.java
浏览文件 @
24f3e697
package
cn
.
iocoder
.
mall
.
productservice
.
service
.
category
.
bo
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
...
...
@@ -45,6 +47,7 @@ public class ProductCategoryUpdateBO {
* 状态
*/
@NotNull
(
message
=
"状态不能为空"
)
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
private
Integer
status
;
}
product-service-project/product-service-app/src/main/resources/application.yaml
浏览文件 @
24f3e697
...
...
@@ -36,6 +36,8 @@ dubbo:
validation
:
true
# 开启 Provider 参数校验
ProductCategoryRpc
:
version
:
1.0.0
ProductBrandRpc
:
verion
:
1.0.0
# Dubbo 服务消费者的配置
consumer
:
ErrorCodeRpc
:
...
...
product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/brand/ProductBrandConvert.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
biz
.
convert
.
brand
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO
;
import
cn.iocoder.mall.product.biz.dataobject.brand.ProductBrandDO
;
import
cn.iocoder.mall.product.biz.dto.brand.ProductBrandAddDTO
;
import
cn.iocoder.mall.product.biz.dto.brand.ProductBrandUpdateDTO
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapping
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
@Mapper
public
interface
ProductBrandConvert
{
ProductBrandConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductBrandConvert
.
class
);
@Mapping
(
source
=
"records"
,
target
=
"list"
)
PageResult
<
ProductBrandBO
>
convertPage
(
IPage
<
ProductBrandDO
>
bean
);
@Mappings
({})
List
<
ProductBrandBO
>
convert
(
List
<
ProductBrandDO
>
brands
);
@Mappings
({})
ProductBrandBO
convert
(
ProductBrandDO
brand
);
@Mappings
({})
ProductBrandDO
convert
(
ProductBrandUpdateDTO
brand
);
@Mappings
({})
ProductBrandDO
convert
(
ProductBrandAddDTO
brand
);
}
\ No newline at end of file
product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/brand/ProductBrandMapper.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
biz
.
dao
.
brand
;
import
cn.iocoder.mall.product.biz.dataobject.brand.ProductBrandDO
;
import
cn.iocoder.mall.product.biz.dto.brand.ProductBrandPageDTO
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Repository
;
@Repository
public
interface
ProductBrandMapper
extends
BaseMapper
<
ProductBrandDO
>
{
default
IPage
<
ProductBrandDO
>
selectPageByParams
(
ProductBrandPageDTO
productBrandPageDTO
)
{
Page
<
ProductBrandDO
>
page
=
new
Page
<>(
productBrandPageDTO
.
getPageNo
(),
productBrandPageDTO
.
getPageSize
());
LambdaQueryWrapper
<
ProductBrandDO
>
queryWrapper
=
Wrappers
.<
ProductBrandDO
>
query
().
lambda
()
.
like
(
StringUtils
.
isNotBlank
(
productBrandPageDTO
.
getName
()),
ProductBrandDO:
:
getName
,
productBrandPageDTO
.
getName
())
.
like
(
StringUtils
.
isNotBlank
(
productBrandPageDTO
.
getDescription
()),
ProductBrandDO:
:
getName
,
productBrandPageDTO
.
getDescription
())
.
eq
(
null
!=
productBrandPageDTO
.
getStatus
(),
ProductBrandDO:
:
getName
,
productBrandPageDTO
.
getStatus
())
.
eq
(
ProductBrandDO:
:
getDeleted
,
false
);
return
selectPage
(
page
,
queryWrapper
);
}
}
product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandService.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
biz
.
service
.
brand
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO
;
import
cn.iocoder.mall.product.biz.dto.brand.ProductBrandAddDTO
;
import
cn.iocoder.mall.product.biz.dto.brand.ProductBrandPageDTO
;
import
cn.iocoder.mall.product.biz.dto.brand.ProductBrandUpdateDTO
;
public
interface
ProductBrandService
{
/**
* 获取品牌分页数据
*
* @param productBrandPageDTO 翻页参数
* @return
*/
PageResult
<
ProductBrandBO
>
getProductBrandPage
(
ProductBrandPageDTO
productBrandPageDTO
);
/**
* 获取品牌明细
*
* @param id 主键
* @return
*/
ProductBrandBO
getProductBrand
(
Integer
id
);
/**
* 添加品牌
*
* @param productBrandAddDTO 添加参数
* @return
*/
ProductBrandBO
addProductBrand
(
Integer
adminId
,
ProductBrandAddDTO
productBrandAddDTO
);
/**
* 更新品牌
*
* @param productBrandUpdateDTO 更新参数
* @return
*/
Boolean
updateProductBrand
(
Integer
adminId
,
ProductBrandUpdateDTO
productBrandUpdateDTO
);
}
product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandServiceImpl.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
biz
.
service
.
brand
;
import
cn.iocoder.common.framework.util.ServiceExceptionUtil
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum
;
import
cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO
;
import
cn.iocoder.mall.product.biz.convert.brand.ProductBrandConvert
;
import
cn.iocoder.mall.product.biz.dao.brand.ProductBrandMapper
;
import
cn.iocoder.mall.product.biz.dataobject.brand.ProductBrandDO
;
import
cn.iocoder.mall.product.biz.dto.brand.ProductBrandAddDTO
;
import
cn.iocoder.mall.product.biz.dto.brand.ProductBrandPageDTO
;
import
cn.iocoder.mall.product.biz.dto.brand.ProductBrandUpdateDTO
;
import
cn.iocoder.mall.product.biz.enums.ProductErrorCodeEnum
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
/**
* 商品规格 Service 实现类
*
* @see ProductBrandDO
*/
@Service
public
class
ProductBrandServiceImpl
implements
ProductBrandService
{
@Autowired
private
ProductBrandMapper
productBrandMapper
;
@Override
public
PageResult
<
ProductBrandBO
>
getProductBrandPage
(
ProductBrandPageDTO
productBrandPageDTO
)
{
IPage
<
ProductBrandDO
>
brandPage
=
productBrandMapper
.
selectPageByParams
(
productBrandPageDTO
);
return
ProductBrandConvert
.
INSTANCE
.
convertPage
(
brandPage
);
}
@Override
public
ProductBrandBO
getProductBrand
(
Integer
brandId
)
{
return
ProductBrandConvert
.
INSTANCE
.
convert
(
productBrandMapper
.
selectById
(
brandId
));
}
@Override
public
ProductBrandBO
addProductBrand
(
Integer
adminId
,
ProductBrandAddDTO
productBrandAddDTO
)
{
// 校验品牌名不重复
int
count
=
productBrandMapper
.
selectCount
(
Wrappers
.<
ProductBrandDO
>
query
().
lambda
()
.
eq
(
ProductBrandDO:
:
getName
,
productBrandAddDTO
.
getName
())
.
eq
(
ProductBrandDO:
:
getDeleted
,
false
));
if
(
count
>
0
)
{
throw
ServiceExceptionUtil
.
exception
(
ProductErrorCodeEnum
.
PRODUCT_BRAND_EXIST
.
getCode
());
}
ProductBrandDO
productBrandDO
=
ProductBrandConvert
.
INSTANCE
.
convert
(
productBrandAddDTO
);
productBrandDO
.
setCreateTime
(
new
Date
());
productBrandDO
.
setDeleted
(
DeletedStatusEnum
.
DELETED_NO
.
getValue
());
productBrandMapper
.
insert
(
productBrandDO
);
return
ProductBrandConvert
.
INSTANCE
.
convert
(
productBrandDO
);
}
@Override
public
Boolean
updateProductBrand
(
Integer
adminId
,
ProductBrandUpdateDTO
productBrandUpdateDTO
)
{
ProductBrandDO
productBrandDO
=
ProductBrandConvert
.
INSTANCE
.
convert
(
productBrandUpdateDTO
);
productBrandDO
.
setUpdateTime
(
new
Date
());
productBrandMapper
.
updateById
(
productBrandDO
);
return
true
;
}
}
product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/category/AdminsProductCategoryController.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
rest
.
controller
.
category
;
import
cn.iocoder.common.framework.enums.MallConstants
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.product.biz.bo.category.ProductCategoryBO
;
import
cn.iocoder.mall.product.biz.dto.category.ProductCategoryAddDTO
;
import
cn.iocoder.mall.product.biz.dto.category.ProductCategoryDeleteDTO
;
import
cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateDTO
;
import
cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateStatusDTO
;
import
cn.iocoder.mall.product.biz.enums.category.ProductCategoryNodeEnum
;
import
cn.iocoder.mall.product.biz.service.category.ProductCategoryService
;
import
cn.iocoder.mall.product.rest.convert.category.AdminsProductCategoryConvert
;
import
cn.iocoder.mall.product.rest.request.category.AdminsProductCategoryAddRequest
;
import
cn.iocoder.mall.product.rest.request.category.AdminsProductCategoryUpdateRequest
;
import
cn.iocoder.mall.product.rest.request.category.AdminsProductCategoryUpdateStatusRequest
;
import
cn.iocoder.mall.product.rest.response.category.AdminsProductCategoryAddResponse
;
import
cn.iocoder.mall.product.rest.response.category.AdminsProductCategoryTreeNodeResponse
;
import
cn.iocoder.mall.security.core.context.AdminSecurityContextHolder
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
/**
* @Author: jiangweifan
* @Date: 2020/5/6
* @Description: 商品分类 - API
*/
@RestController
@RequestMapping
(
MallConstants
.
ROOT_PATH_ADMIN
+
"/category"
)
@Api
(
tags
=
"管理员 - 商品分类 API"
)
public
class
AdminsProductCategoryController
{
@Autowired
private
ProductCategoryService
productCategoryService
;
@GetMapping
(
"/tree"
)
@ApiOperation
(
"获取分类树结构"
)
public
CommonResult
<
List
<
AdminsProductCategoryTreeNodeResponse
>>
tree
()
{
List
<
ProductCategoryBO
>
productCategories
=
productCategoryService
.
getAllProductCategory
();
// 创建 ProductCategoryTreeNodeVO Map
Map
<
Integer
,
AdminsProductCategoryTreeNodeResponse
>
treeNodeMap
=
productCategories
.
stream
().
collect
(
Collectors
.
toMap
(
ProductCategoryBO:
:
getId
,
AdminsProductCategoryConvert
.
INSTANCE
::
convertToTreeNodeResponse
));
// 处理父子关系
treeNodeMap
.
values
().
stream
()
.
filter
(
node
->
!
node
.
getPid
().
equals
(
ProductCategoryNodeEnum
.
ROOT
.
getId
()))
.
forEach
((
childNode
)
->
{
// 获得父节点
AdminsProductCategoryTreeNodeResponse
parentNode
=
treeNodeMap
.
get
(
childNode
.
getPid
());
if
(
parentNode
.
getChildren
()
==
null
)
{
// 初始化 children 数组
parentNode
.
setChildren
(
new
ArrayList
<>());
}
// 将自己添加到父节点中
parentNode
.
getChildren
().
add
(
childNode
);
});
// 获得到所有的根节点
List
<
AdminsProductCategoryTreeNodeResponse
>
rootNodes
=
treeNodeMap
.
values
().
stream
()
.
filter
(
node
->
node
.
getPid
().
equals
(
ProductCategoryNodeEnum
.
ROOT
.
getId
()))
.
sorted
(
Comparator
.
comparing
(
AdminsProductCategoryTreeNodeResponse:
:
getSort
))
.
collect
(
Collectors
.
toList
());
return
success
(
rootNodes
);
}
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"创建商品分类"
)
public
CommonResult
<
AdminsProductCategoryAddResponse
>
add
(
AdminsProductCategoryAddRequest
adminsProductCategoryAddRequest
)
{
// 转换 ProductCategoryAddDTO 对象
ProductCategoryAddDTO
productCategoryAddDTO
=
AdminsProductCategoryConvert
.
INSTANCE
.
convertToAddDTO
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
adminsProductCategoryAddRequest
);
// 创建商品分类
ProductCategoryBO
addProductCategoryBO
=
productCategoryService
.
addProductCategory
(
productCategoryAddDTO
);
// 返回结果
return
success
(
AdminsProductCategoryConvert
.
INSTANCE
.
convertToAddResponse
(
addProductCategoryBO
));
}
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"更新商品分类"
)
public
CommonResult
<
Boolean
>
update
(
AdminsProductCategoryUpdateRequest
adminsProductCategoryUpdateRequest
)
{
// 创建 ProductCategoryUpdateDTO 对象
ProductCategoryUpdateDTO
productCategoryUpdateDTO
=
AdminsProductCategoryConvert
.
INSTANCE
.
convertToUpdateDTO
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
adminsProductCategoryUpdateRequest
);
// 更新商品分类
return
success
(
productCategoryService
.
updateProductCategory
(
productCategoryUpdateDTO
));
}
@PostMapping
(
"/update_status"
)
@ApiOperation
(
value
=
"更新商品分类状态"
)
public
CommonResult
<
Boolean
>
updateStatus
(
AdminsProductCategoryUpdateStatusRequest
adminsProductCategoryUpdateStatusRequest
)
{
// 创建 ProductCategoryUpdateStatusDTO 对象
ProductCategoryUpdateStatusDTO
productCategoryUpdateStatusDTO
=
AdminsProductCategoryConvert
.
INSTANCE
.
convertToUpdateStatusDTO
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
adminsProductCategoryUpdateStatusRequest
);
// 更新商品分类状态
return
success
(
productCategoryService
.
updateProductCategoryStatus
(
productCategoryUpdateStatusDTO
));
}
@PostMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除商品分类"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"商品分类编号"
,
required
=
true
,
example
=
"1"
)
public
CommonResult
<
Boolean
>
delete
(
@RequestParam
(
"id"
)
Integer
id
)
{
// 创建 ProductCategoryDeleteDTO 对象
ProductCategoryDeleteDTO
productCategoryDeleteDTO
=
AdminsProductCategoryConvert
.
INSTANCE
.
convertToDeleteDTO
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
id
);
// 删除商品分类
return
success
(
productCategoryService
.
deleteProductCategory
(
productCategoryDeleteDTO
));
}
}
product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandAddRequest.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
rest
.
request
.
brand
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotEmpty
;
@ApiModel
(
"商品 - 品牌模块 - 商品品牌新增 Request"
)
@Data
@Accessors
(
chain
=
true
)
public
class
ProductBrandAddRequest
{
@ApiModelProperty
(
name
=
"name"
,
value
=
"品牌名称"
,
required
=
true
,
example
=
"安踏"
)
@NotEmpty
(
message
=
"品牌名称不能为空"
)
private
String
name
;
@ApiModelProperty
(
name
=
"description"
,
value
=
"品牌描述"
,
required
=
true
,
example
=
"安踏拖鞋"
)
private
String
description
;
@ApiModelProperty
(
name
=
"picUrl"
,
value
=
"品牌图片"
,
required
=
true
,
example
=
"http://www.iocoder.cn"
)
private
String
picUrl
;
@ApiModelProperty
(
name
=
"status"
,
value
=
"状态 1开启 2禁用"
,
required
=
true
,
example
=
"1"
)
private
Integer
status
;
}
product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/brand/ProductBrandUpdateRequest.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
rest
.
request
.
brand
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
@ApiModel
(
"商品 - 品牌模块 - 商品品牌更新 Request"
)
@Data
@Accessors
(
chain
=
true
)
public
class
ProductBrandUpdateRequest
{
@ApiModelProperty
(
name
=
"id"
,
value
=
"规格编号"
,
required
=
true
,
example
=
"1"
)
@NotNull
(
message
=
"品牌编号不能为空"
)
private
Integer
id
;
@ApiModelProperty
(
name
=
"name"
,
value
=
"品牌名称"
,
required
=
true
,
example
=
"安踏"
)
@NotEmpty
(
message
=
"品牌名称不能为空"
)
private
String
name
;
@ApiModelProperty
(
name
=
"description"
,
value
=
"品牌描述"
,
required
=
true
,
example
=
"安踏拖鞋"
)
private
String
description
;
@ApiModelProperty
(
name
=
"picUrl"
,
value
=
"品牌图片"
,
required
=
true
,
example
=
"http://www.iocoder.cn"
)
private
String
picUrl
;
@ApiModelProperty
(
name
=
"status"
,
value
=
"状态 1开启 2禁用"
,
required
=
true
,
example
=
"1"
)
private
Integer
status
;
}
product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryAddResponse.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
rest
.
response
.
category
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
/**
* @Author: jiangweifan
* @Date: 2020/5/6
* @Description: 管理员 - 商品分类 - 新增商品分类Response
*/
@ApiModel
(
"创建商品分类Response"
)
@Data
@Accessors
(
chain
=
true
)
public
class
AdminsProductCategoryAddResponse
{
@ApiModelProperty
(
value
=
"分类编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"父分类编号"
,
required
=
true
,
example
=
"0"
)
private
Integer
pid
;
@ApiModelProperty
(
value
=
"分类名"
,
required
=
true
,
example
=
"手机"
)
private
String
name
;
@ApiModelProperty
(
value
=
"描述"
,
required
=
true
,
example
=
"这个商品很吊"
)
private
String
description
;
@ApiModelProperty
(
value
=
"分类图片"
,
notes
=
"一般情况下,只有根分类才有图片"
,
example
=
"http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg"
)
private
String
picUrl
;
@ApiModelProperty
(
value
=
"排序值"
,
required
=
true
,
example
=
"10"
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
notes
=
"1-开启;2-关闭"
,
example
=
"1"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
,
example
=
"时间戳"
)
private
Date
createTime
;
}
product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryTreeNodeResponse.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
rest
.
response
.
category
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
import
java.util.List
;
/**
* @Author: jiangweifan
* @Date: 2020/5/6
* @Description: 管理员 - 商品分类 - 分类树Response
*/
@ApiModel
(
"商品分类树节点"
)
@Data
@Accessors
(
chain
=
true
)
public
class
AdminsProductCategoryTreeNodeResponse
{
@ApiModelProperty
(
value
=
"分类编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"父分类编号"
,
required
=
true
,
example
=
"0"
)
private
Integer
pid
;
@ApiModelProperty
(
value
=
"分类名"
,
required
=
true
,
example
=
"手机"
)
private
String
name
;
@ApiModelProperty
(
value
=
"描述"
,
required
=
true
,
example
=
"这个商品很吊"
)
private
String
description
;
@ApiModelProperty
(
value
=
"分类图片"
,
notes
=
"一般情况下,只有根分类才有图片"
,
example
=
"http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg"
)
private
String
picUrl
;
@ApiModelProperty
(
value
=
"排序值"
,
required
=
true
,
example
=
"10"
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
notes
=
"1-开启;2-关闭"
,
example
=
"1"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
,
example
=
"时间戳"
)
private
Date
createTime
;
@ApiModelProperty
(
value
=
"子节点数组"
)
private
List
<
AdminsProductCategoryTreeNodeResponse
>
children
;
}
product/product-rest/src/main/resources/rest.yaml
deleted
100644 → 0
浏览文件 @
2b845968
# 服务器的配置项
server
:
port
:
18081
servlet
:
context-path
:
/product-api/
# Swagger 配置项
swagger
:
title
:
商品子系统
description
:
商品子系统
version
:
1.0.0
base-package
:
cn.iocoder.mall.system.rest.controller
product/product-rpc-api/src/main/java/cn/iocoder/mall/product/rpc/package-info.java
deleted
100644 → 0
浏览文件 @
2b845968
/**
* 提供 system 服务的 RPC 接口的定义,提供内部调用
*/
package
cn
.
iocoder
.
mall
.
product
.
rpc
;
product/product-rpc/src/main/java/cn/iocoder/mall/product/rpc/package-info.java
deleted
100644 → 0
浏览文件 @
2b845968
/**
* 提供 product 服务的 RPC 接口的实现,提供内部调用
*/
package
cn
.
iocoder
.
mall
.
product
.
rpc
;
product/product-rpc/src/main/resources/rpc-local.yaml
deleted
100644 → 0
浏览文件 @
2b845968
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 服务注册中心的地址
product/product-rpc/src/main/resources/rpc-test.yaml
deleted
100644 → 0
浏览文件 @
2b845968
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 服务注册中心的地址
product/product-rpc/src/main/resources/rpc.yaml
deleted
100644 → 0
浏览文件 @
2b845968
# Dubbo 配置项
dubbo
:
# Spring Cloud Alibaba Dubbo 专属配置
cloud
:
subscribed-services
:
'
product-application'
# 设置订阅的应用列表,默认为 * 订阅所有应用
# Dubbo 提供者的协议
protocol
:
name
:
dubbo
port
:
-1
# Dubbo 提供服务的扫描基础包
scan
:
base-packages
:
cn.iocoder.mall.product.rpc.rpc
# Dubbo 服务提供者的配置
provider
:
filter
:
-exception
ProductSpuService
:
version
:
1.0.0
# Dubbo 服务消费者的配置
consumer
:
ProductSpuService
:
version
:
1.0.0
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductBrandService.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
api
;
import
cn.iocoder.mall.product.api.bo.ProductBrandBO
;
import
cn.iocoder.mall.product.api.bo.ProductBrangPageBO
;
import
cn.iocoder.mall.product.api.dto.ProductBrandAddDTO
;
import
cn.iocoder.mall.product.api.dto.ProductBrandPageDTO
;
import
cn.iocoder.mall.product.api.dto.ProductBrandUpdateDTO
;
public
interface
ProductBrandService
{
/**
* 获取品牌分页数据
* @param productBrandPageDTO 翻页参数
* @return
*/
ProductBrangPageBO
getProductBrandPage
(
ProductBrandPageDTO
productBrandPageDTO
);
/**
* 获取品牌明细
* @param id 主键
* @return
*/
ProductBrandBO
getProductBrand
(
Integer
id
);
/**
* 添加品牌
* @param productBrandAddDTO 添加参数
* @return
*/
ProductBrandBO
addProductBrand
(
Integer
adminId
,
ProductBrandAddDTO
productBrandAddDTO
);
/**
* 更新品牌
* @param productBrandUpdateDTO 更新参数
* @return
*/
Boolean
updateProductBrand
(
Integer
adminId
,
ProductBrandUpdateDTO
productBrandUpdateDTO
);
}
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductCategoryService.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
api
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.mall.product.api.bo.ProductCategoryBO
;
import
cn.iocoder.mall.product.api.dto.ProductCategoryAddDTO
;
import
cn.iocoder.mall.product.api.dto.ProductCategoryUpdateDTO
;
import
java.util.Collection
;
import
java.util.List
;
public
interface
ProductCategoryService
{
/**
* @param pid 指定父分类编号
* @return 返回指定分类编号的子产品分类们
*/
List
<
ProductCategoryBO
>
getListByPid
(
Integer
pid
);
/**
* 获得商品分类数组
*
* @param ids 商品分类编号
* @return 数组
*/
List
<
ProductCategoryBO
>
getListByIds
(
Collection
<
Integer
>
ids
);
/**
* @return 返回所有产品分类们
*/
List
<
ProductCategoryBO
>
getAll
();
ProductCategoryBO
addProductCategory
(
Integer
adminId
,
ProductCategoryAddDTO
productCategoryAddDTO
);
Boolean
updateProductCategory
(
Integer
adminId
,
ProductCategoryUpdateDTO
productCategoryUpdateDTO
);
Boolean
updateProductCategoryStatus
(
Integer
adminId
,
Integer
productCategoryId
,
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
Integer
status
);
Boolean
deleteProductCategory
(
Integer
admin
,
Integer
productCategoryId
);
}
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductBrangPageBO.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
api
.
bo
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* 商品品牌分页 BO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductBrangPageBO
implements
Serializable
{
/**
* 品牌数组
*/
private
List
<
ProductBrandBO
>
brands
;
/**
* 总数
*/
private
Integer
count
;
}
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductAttrConstants.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
api
.
constant
;
public
class
ProductAttrConstants
{
/**
* ATTR 状态 - 开启
*/
public
static
final
Integer
ATTR_STATUS_ENABLE
=
1
;
/**
* ATTR 状态 - 关闭
*/
public
static
final
Integer
ATTR_STATUS_DISABLE
=
2
;
/**
* ATTR_VALUE 状态 - 开启
*/
public
static
final
Integer
ATTR_VALUE_STATUS_ENABLE
=
1
;
/**
* ATTR_VALUE 状态 - 关闭
*/
public
static
final
Integer
ATTR_VALUE_STATUS_DISABLE
=
2
;
}
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductCategoryConstants.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
api
.
constant
;
public
class
ProductCategoryConstants
{
/**
* 状态 - 开启
*/
public
static
final
Integer
STATUS_ENABLE
=
1
;
/**
* 状态 - 关闭
*/
public
static
final
Integer
STATUS_DISABLE
=
2
;
/**
* 父分类编号 - 根节点
*/
public
static
final
Integer
PID_ROOT
=
0
;
}
\ No newline at end of file
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductErrorCodeEnum.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
api
.
constant
;
/**
* 错误码枚举类
*
* 商品系统,使用 1-003-000-000 段
*/
public
enum
ProductErrorCodeEnum
{
// ========== PRODUCT CATEGORY 模块 ==========
PRODUCT_CATEGORY_PARENT_NOT_EXISTS
(
1003001000
,
"父分类不存在"
),
PRODUCT_CATEGORY_NOT_EXISTS
(
1003001001
,
"商品分类不存在"
),
PRODUCT_CATEGORY_PARENT_NOT_SELF
(
1003001002
,
"不能设置自己为父分类"
),
PRODUCT_CATEGORY_STATUS_EQUALS
(
1002001003
,
"商品分类已经是该状态"
),
PRODUCT_CATEGORY_DELETE_ONLY_DISABLE
(
1002001004
,
"只有关闭的商品分类才可以删除"
),
PRODUCT_CATEGORY_MUST_ENABLE
(
1002001005
,
"只有开启的商品分类,才可以使用"
),
PRODUCT_CATEGORY_PARENT_CAN_NOT_BE_LEVEL2
(
1002001005
,
"父分类必须是一级分类"
),
// ========== PRODUCT SPU + SKU 模块 ==========
PRODUCT_SKU_ATTR_CANT_NOT_DUPLICATE
(
1003002000
,
"一个 Sku 下,不能有重复的规格"
),
PRODUCT_SPU_ATTR_NUMBERS_MUST_BE_EQUALS
(
1003002001
,
"一个 Spu 下的每个 Sku ,其规格数必须一致"
),
PRODUCT_SPU_SKU__NOT_DUPLICATE
(
1003002002
,
"一个 Spu 下的每个 Sku ,必须不重复"
),
PRODUCT_SPU_NOT_EXISTS
(
1003002003
,
"Spu 不存在"
),
PRODUCT_SPU_CATEGORY_MUST_BE_LEVEL2
(
1003002003
,
"Spu 只能添加在二级分类下"
),
// ========== PRODUCT ATTR + ATTR_VALUE 模块 ==========
PRODUCT_ATTR_VALUE_NOT_EXIST
(
1003003000
,
"商品属性值不存在"
),
PRODUCT_ATTR_NOT_EXIST
(
1003003001
,
"商品属性值不存在"
),
PRODUCT_ATTR_EXISTS
(
1003003002
,
"商品规格已经存在"
),
PRODUCT_ATTR_STATUS_EQUALS
(
1003003003
,
"商品规格已经是该状态"
),
PRODUCT_ATTR_VALUE_EXISTS
(
1003003004
,
"商品规格值已经存在"
),
PRODUCT_ATTR_VALUE_STATUS_EQUALS
(
1003003005
,
"商品规格值已经是该状态"
),
// ========== PRODUCT BRAND模块 ==========
PRODUCT_BRAND_EXIST
(
1003004000
,
"品牌值已经存在"
),
;
private
final
int
code
;
private
final
String
message
;
ProductErrorCodeEnum
(
int
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
public
int
getCode
()
{
return
code
;
}
public
String
getMessage
()
{
return
message
;
}
}
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductSpuConstants.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
api
.
constant
;
public
class
ProductSpuConstants
{
/**
* 状态 - 开启
*/
public
static
final
Integer
SKU_STATUS_ENABLE
=
1
;
/**
* 状态 - 关闭
*/
public
static
final
Integer
SKU_STATUS_DISABLE
=
2
;
}
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductBrandPageDTO.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
api
.
dto
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotNull
;
/**
* 商品品牌分页 DTO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductBrandPageDTO
{
/**
* 名称
*/
private
String
name
;
/**
* 描述
*/
private
String
description
;
/**
* 状态 1-开启 2-禁用
*/
private
Integer
status
;
@NotNull
(
message
=
"页码不能为空"
)
private
Integer
pageNo
;
@NotNull
(
message
=
"每页条数不能为空"
)
private
Integer
pageSize
;
}
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductCategoryAddDTO.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
api
.
dto
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotNull
;
/**
* 商品分类添加 DTO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductCategoryAddDTO
{
/**
* 父分类编号
*/
@NotNull
(
message
=
"父分类编号不能为空"
)
private
Integer
pid
;
/**
* 名称
*/
@NotNull
(
message
=
"名称不能为空"
)
private
String
name
;
/**
* 描述
*/
@NotNull
(
message
=
"描述不能为空"
)
private
String
description
;
/**
* 分类图片
*/
// @NotNull(message = "分类图片不能为空")
private
String
picUrl
;
/**
* 排序值
*/
@NotNull
(
message
=
"排序值不能为空"
)
private
Integer
sort
;
}
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductCategoryUpdateDTO.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
api
.
dto
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotNull
;
/**
* 商品分类更新 DTO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductCategoryUpdateDTO
{
/**
* 编号
*/
@NotNull
(
message
=
"编号不能为空"
)
private
Integer
id
;
/**
* 父分类编号
*/
@NotNull
(
message
=
"父分类编号不能为空"
)
private
Integer
pid
;
/**
* 名称
*/
@NotNull
(
message
=
"名称不能为空"
)
private
String
name
;
/**
* 描述
*/
@NotNull
(
message
=
"描述不能为空"
)
private
String
description
;
/**
* 分类图片
*/
// @NotNull(message = "分类图片不能为空")
private
String
picUrl
;
/**
* 排序值
*/
@NotNull
(
message
=
"排序值不能为空"
)
private
Integer
sort
;
}
product/product-service-impl/src/main/java/cn/iocoder/mall/product/config/DatabaseConfiguration.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
config
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
@Configuration
@MapperScan
(
"cn.iocoder.mall.product.dao"
)
// 扫描对应的 Mapper 接口
@EnableTransactionManagement
(
proxyTargetClass
=
true
)
// 启动事务管理。为什么使用 proxyTargetClass 参数,参见 https://blog.csdn.net/huang_550/article/details/76492600
public
class
DatabaseConfiguration
{
}
product/product-service-impl/src/main/java/cn/iocoder/mall/product/config/ServiceExceptionConfiguration.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
config
;
import
cn.iocoder.common.framework.util.ServiceExceptionUtil
;
import
cn.iocoder.mall.product.api.constant.ProductErrorCodeEnum
;
import
org.springframework.boot.context.event.ApplicationReadyEvent
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.event.EventListener
;
@Configuration
public
class
ServiceExceptionConfiguration
{
@EventListener
(
ApplicationReadyEvent
.
class
)
// 可参考 https://www.cnblogs.com/ssslinppp/p/7607509.html
public
void
initMessages
()
{
// 从 service_exception_message.properties 加载错误码的方案
// Properties properties;
// try {
// properties = PropertiesLoaderUtils.loadAllProperties("classpath:service_exception_message.properties");
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
for
(
ProductErrorCodeEnum
item
:
ProductErrorCodeEnum
.
values
())
{
ServiceExceptionUtil
.
put
(
item
.
getCode
(),
item
.
getMessage
());
}
}
}
\ No newline at end of file
product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductBrandConvert.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
convert
;
import
cn.iocoder.mall.product.api.bo.ProductBrandBO
;
import
cn.iocoder.mall.product.api.dto.ProductBrandAddDTO
;
import
cn.iocoder.mall.product.api.dto.ProductBrandUpdateDTO
;
import
cn.iocoder.mall.product.dataobject.ProductBrandDO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
@Mapper
public
interface
ProductBrandConvert
{
ProductBrandConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductBrandConvert
.
class
);
@Mappings
({})
List
<
ProductBrandBO
>
convert
(
List
<
ProductBrandDO
>
brands
);
@Mappings
({})
ProductBrandBO
convert
(
ProductBrandDO
brand
);
@Mappings
({})
ProductBrandDO
convert
(
ProductBrandUpdateDTO
brand
);
@Mappings
({})
ProductBrandDO
convert
(
ProductBrandAddDTO
brand
);
}
\ No newline at end of file
product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductCategoryConvert.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
convert
;
import
cn.iocoder.mall.product.api.bo.ProductCategoryBO
;
import
cn.iocoder.mall.product.api.dto.ProductCategoryAddDTO
;
import
cn.iocoder.mall.product.api.dto.ProductCategoryUpdateDTO
;
import
cn.iocoder.mall.product.dataobject.ProductCategoryDO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
@Mapper
public
interface
ProductCategoryConvert
{
ProductCategoryConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductCategoryConvert
.
class
);
@Mappings
({})
ProductCategoryBO
convertToBO
(
ProductCategoryDO
category
);
@Mappings
({})
List
<
ProductCategoryBO
>
convertToBO
(
List
<
ProductCategoryDO
>
categoryList
);
@Mappings
({})
ProductCategoryDO
convert
(
ProductCategoryAddDTO
productCategoryAddDTO
);
@Mappings
({})
ProductCategoryDO
convert
(
ProductCategoryUpdateDTO
productCategoryUpdateDTO
);
}
\ No newline at end of file
product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductBrandMapper.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
dao
;
import
cn.iocoder.mall.product.dataobject.ProductBrandDO
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
interface
ProductBrandMapper
{
/**
* 根据 id 获取数据
* @param id
* @return
*/
ProductBrandDO
selectById
(
@Param
(
"id"
)
Integer
id
);
/**
* 根据 name 获取数据
* @param name
* @return
*/
ProductBrandDO
selectByName
(
@Param
(
"name"
)
String
name
);
/**
* 分页查询
* @param name 名称
* @param description 描述
* @param status 状态 1开启 2禁用
* @param offset 偏移量
* @param limit 数量
* @return
*/
List
<
ProductBrandDO
>
selectListByParams
(
@Param
(
"name"
)
String
name
,
@Param
(
"description"
)
String
description
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"limit"
)
Integer
limit
);
/**
* 分页数量统计
* @param name 名称
* @param description 描述
* @param status 状态 1开启 2禁用
* @return
*/
Integer
selectListCountByParams
(
@Param
(
"name"
)
String
name
,
@Param
(
"description"
)
String
description
,
@Param
(
"status"
)
Integer
status
);
/**
* 新增数据
* @param productBrandDO
*/
void
insert
(
ProductBrandDO
productBrandDO
);
/**
* 更新数据
* @param productBrandDO
*/
void
update
(
ProductBrandDO
productBrandDO
);
}
\ No newline at end of file
product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductCategoryMapper.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
dao
;
import
cn.iocoder.mall.product.dataobject.ProductCategoryDO
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.Collection
;
import
java.util.List
;
@Repository
public
interface
ProductCategoryMapper
{
List
<
ProductCategoryDO
>
selectListByPidAndStatusOrderBySort
(
@Param
(
"pid"
)
Integer
pid
,
@Param
(
"status"
)
Integer
status
);
List
<
ProductCategoryDO
>
selectList
();
ProductCategoryDO
selectById
(
@Param
(
"id"
)
Integer
id
);
List
<
ProductCategoryDO
>
selectByIds
(
@Param
(
"ids"
)
Collection
<
Integer
>
ids
);
void
insert
(
ProductCategoryDO
productCategoryDO
);
int
update
(
ProductCategoryDO
productCategoryDO
);
}
product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductBrandDO.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
dataobject
;
import
cn.iocoder.mall.mybatis.core.dataobject.DeletableDO
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
* Product 品牌
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductBrandDO
extends
DeletableDO
{
/**
* 规格编号
*/
private
Integer
id
;
/**
* 名称
*/
private
String
name
;
/**
* 描述
*/
private
String
description
;
/**
* 图片地址
*/
private
String
picUrl
;
/**
* 状态
*
* 1-开启
* 2-禁用
*/
private
Integer
status
;
}
product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
dataobject
;
import
cn.iocoder.mall.mybatis.core.dataobject.DeletableDO
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
* 商品分类
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductCategoryDO
extends
DeletableDO
{
/**
* 分类编号
*/
private
Integer
id
;
/**
* 父分类编号
*
* 如果不存在父级,则 pid = 0 。
*/
private
Integer
pid
;
/**
* 名称
*/
private
String
name
;
/**
* 描述
*/
private
String
description
;
/**
* 分类图片
*/
private
String
picUrl
;
/**
* 排序值
*/
private
Integer
sort
;
/**
* 状态
*
* 1-开启
* 2-关闭
*/
private
Integer
status
;
}
product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductBrandServiceImpl.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
service
;
import
cn.iocoder.common.framework.util.ServiceExceptionUtil
;
import
cn.iocoder.mall.product.api.ProductBrandService
;
import
cn.iocoder.mall.product.api.bo.ProductBrandBO
;
import
cn.iocoder.mall.product.api.bo.ProductBrangPageBO
;
import
cn.iocoder.mall.product.api.constant.ProductErrorCodeEnum
;
import
cn.iocoder.mall.product.api.dto.ProductBrandAddDTO
;
import
cn.iocoder.mall.product.api.dto.ProductBrandPageDTO
;
import
cn.iocoder.mall.product.api.dto.ProductBrandUpdateDTO
;
import
cn.iocoder.mall.product.convert.ProductBrandConvert
;
import
cn.iocoder.mall.product.dao.ProductBrandMapper
;
import
cn.iocoder.mall.product.dataobject.ProductBrandDO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* 商品规格 Service 实现类
*
* @see ProductBrandDO
*/
@Service
@org
.
apache
.
dubbo
.
config
.
annotation
.
Service
(
validation
=
"true"
,
version
=
"${dubbo.provider.ProductBrandService.version}"
)
public
class
ProductBrandServiceImpl
implements
ProductBrandService
{
@Autowired
private
ProductBrandMapper
productBrandMapper
;
/**
* 获取品牌分页数据
* @param productBrandPageDTO 分页参数
* @return
*/
@Override
public
ProductBrangPageBO
getProductBrandPage
(
ProductBrandPageDTO
productBrandPageDTO
)
{
ProductBrangPageBO
productBrangPageBO
=
new
ProductBrangPageBO
();
// 查询分页数据
int
offset
=
(
productBrandPageDTO
.
getPageNo
()
-
1
)
*
productBrandPageDTO
.
getPageSize
();
productBrangPageBO
.
setBrands
(
ProductBrandConvert
.
INSTANCE
.
convert
(
productBrandMapper
.
selectListByParams
(
productBrandPageDTO
.
getName
(),
productBrandPageDTO
.
getDescription
(),
productBrandPageDTO
.
getStatus
(),
offset
,
productBrandPageDTO
.
getPageSize
())));
// 查询分页总数
productBrangPageBO
.
setCount
(
productBrandMapper
.
selectListCountByParams
(
productBrandPageDTO
.
getName
(),
productBrandPageDTO
.
getDescription
(),
productBrandPageDTO
.
getStatus
()));
return
productBrangPageBO
;
}
/**
* 获取品牌明细
* @param id 主键
* @return
*/
@Override
public
ProductBrandBO
getProductBrand
(
Integer
id
)
{
ProductBrandBO
productBrandBO
=
new
ProductBrandBO
();
productBrandBO
=
ProductBrandConvert
.
INSTANCE
.
convert
(
productBrandMapper
.
selectById
(
id
));
return
productBrandBO
;
}
/**
* 添加品牌
* @param adminId
* @param productBrandAddDTO 添加参数
* @return
*/
@Override
public
ProductBrandBO
addProductBrand
(
Integer
adminId
,
ProductBrandAddDTO
productBrandAddDTO
)
{
// 校验品牌名不重复
if
(
productBrandMapper
.
selectByName
(
productBrandAddDTO
.
getName
())
!=
null
)
{
throw
ServiceExceptionUtil
.
exception
(
ProductErrorCodeEnum
.
PRODUCT_BRAND_EXIST
.
getCode
());
}
ProductBrandDO
productBrandDO
=
new
ProductBrandDO
();
productBrandDO
=
ProductBrandConvert
.
INSTANCE
.
convert
(
productBrandAddDTO
);
productBrandMapper
.
insert
(
productBrandDO
);
return
ProductBrandConvert
.
INSTANCE
.
convert
(
productBrandDO
);
}
/**
* 更新品牌
* @param adminId
* @param productBrandUpdateDTO 更新参数
* @return
*/
@Override
public
Boolean
updateProductBrand
(
Integer
adminId
,
ProductBrandUpdateDTO
productBrandUpdateDTO
)
{
ProductBrandDO
productBrandDO
=
new
ProductBrandDO
();
productBrandDO
=
ProductBrandConvert
.
INSTANCE
.
convert
(
productBrandUpdateDTO
);
productBrandMapper
.
update
(
productBrandDO
);
return
true
;
}
}
product/product-service-impl/src/main/resources/mapper/ProductBrandMapper.xml
deleted
100644 → 0
浏览文件 @
2b845968
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"cn.iocoder.mall.product.dao.ProductBrandMapper"
>
<sql
id=
"FIELDS"
>
id, name, description, pic_url, status, create_time
</sql>
<select
id=
"selectById"
parameterType=
"Integer"
resultType=
"ProductBrandDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_brand
WHERE id = #{id}
AND deleted = 0
</select>
<select
id=
"selectByName"
parameterType=
"String"
resultType=
"ProductBrandDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_brand
WHERE name = #{name}
AND deleted = 0
</select>
<insert
id=
"insert"
parameterType=
"ProductBrandDO"
useGeneratedKeys=
"true"
keyColumn=
"id"
keyProperty=
"id"
>
INSERT INTO product_brand (
name, description, pic_url, status, create_time, deleted
) VALUES (
#{name}, #{description}, #{picUrl}, #{status}, #{createTime}, #{deleted}
)
</insert>
<update
id=
"update"
parameterType=
"ProductBrandDO"
>
UPDATE product_brand
<set>
<if
test=
"name != null"
>
name = #{name},
</if>
<if
test=
"description != null"
>
description = #{description},
</if>
<if
test=
"picUrl != null"
>
pic_url = #{picUrl},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"deleted != null"
>
deleted = #{deleted}
</if>
</set>
WHERE id = #{id}
</update>
<select
id=
"selectListByParams"
resultType=
"ProductBrandDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_brand
<where>
deleted = 0
<if
test=
"name != null"
>
AND name LIKE "%"#{name}"%"
</if>
<if
test=
"description != null"
>
AND description LIKE "%"#{description}"%"
</if>
<if
test=
"status != null"
>
AND status = #{status}
</if>
</where>
LIMIT #{offset}, #{limit}
</select>
<select
id=
"selectListCountByParams"
resultType=
"Integer"
>
SELECT
COUNT(1)
FROM product_brand
<where>
deleted = 0
<if
test=
"name != null"
>
AND name LIKE "%"#{name}"%"
</if>
<if
test=
"description != null"
>
AND description LIKE "%"#{description}"%"
</if>
<if
test=
"status != null"
>
AND status = #{status}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
product/product-service-impl/src/main/resources/mapper/ProductCategoryMapper.xml
deleted
100644 → 0
浏览文件 @
2b845968
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"cn.iocoder.mall.product.dao.ProductCategoryMapper"
>
<sql
id=
"FIELDS"
>
id, pid, name, description, pic_url,
sort, status, create_time
</sql>
<select
id=
"selectListByPidAndStatusOrderBySort"
resultType=
"ProductCategoryDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_category
WHERE pid = #{pid}
AND status = #{status}
AND deleted = 0
ORDER BY sort ASC
</select>
<select
id=
"selectList"
resultType=
"ProductCategoryDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_category
WHERE deleted = 0
</select>
<select
id=
"selectById"
parameterType=
"Integer"
resultType=
"ProductCategoryDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_category
WHERE id = #{id}
AND deleted = 0
</select>
<select
id=
"selectByIds"
resultType=
"ProductCategoryDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_category
WHERE id IN
<foreach
collection=
"ids"
item=
"id"
separator=
","
open=
"("
close=
")"
>
#{id}
</foreach>
AND deleted = 0
</select>
<insert
id=
"insert"
parameterType=
"ProductCategoryDO"
useGeneratedKeys=
"true"
keyColumn=
"id"
keyProperty=
"id"
>
INSERT INTO product_category (
pid, name, description, pic_url, sort,
status, create_time, deleted
) VALUES (
#{pid}, #{name}, #{description}, #{picUrl}, #{sort},
#{status}, #{createTime}, #{deleted}
)
</insert>
<update
id=
"update"
parameterType=
"ProductCategoryDO"
>
UPDATE product_category
<set>
<if
test=
"pid != null"
>
pid = #{pid},
</if>
<if
test=
"name != null"
>
name = #{name},
</if>
<if
test=
"description != null"
>
description = #{description},
</if>
<if
test=
"picUrl != null"
>
pic_url = #{picUrl},
</if>
<if
test=
"sort != null"
>
sort = #{sort},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"deleted != null"
>
deleted = #{deleted}
</if>
</set>
WHERE id = #{id}
</update>
</mapper>
product/product-start/src/main/java/cn/iocoder/mall/product/application/ProductApplication.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
application
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.context.config.ConfigFileApplicationListener
;
import
org.springframework.scheduling.annotation.EnableAsync
;
@SpringBootApplication
(
scanBasePackages
=
{
"cn.iocoder.mall.product"
})
@EnableAsync
(
proxyTargetClass
=
true
)
public
class
ProductApplication
{
/**
* 设置需要读取的配置文件的名字。
* 基于 {@link org.springframework.boot.context.config.ConfigFileApplicationListener#CONFIG_NAME_PROPERTY} 实现。
*/
private
static
final
String
CONFIG_NAME_VALUE
=
"biz,rest,rpc,application"
;
public
static
void
main
(
String
[]
args
)
{
// 设置环境变量
System
.
setProperty
(
ConfigFileApplicationListener
.
CONFIG_NAME_PROPERTY
,
CONFIG_NAME_VALUE
);
// 启动 Spring Boot 应用
SpringApplication
.
run
(
ProductApplication
.
class
,
args
);
}
}
product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductBrandController.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
application
.
controller
.
admins
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.product.api.ProductBrandService
;
import
cn.iocoder.mall.product.api.bo.ProductBrandBO
;
import
cn.iocoder.mall.product.api.bo.ProductBrangPageBO
;
import
cn.iocoder.mall.product.api.dto.ProductBrandAddDTO
;
import
cn.iocoder.mall.product.api.dto.ProductBrandPageDTO
;
import
cn.iocoder.mall.product.api.dto.ProductBrandUpdateDTO
;
import
cn.iocoder.mall.product.application.convert.ProductBrandConvert
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductBrandVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductBrangPageVO
;
import
cn.iocoder.mall.security.core.context.AdminSecurityContextHolder
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.dubbo.config.annotation.Reference
;
import
org.springframework.web.bind.annotation.*
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
@RestController
@RequestMapping
(
"admins/brand"
)
@Api
(
"商品品牌"
)
public
class
AdminsProductBrandController
{
@Reference
(
validation
=
"true"
,
version
=
"${dubbo.provider.ProductBrandService.version}"
)
private
ProductBrandService
productBrandService
;
@PostMapping
(
"/add"
)
@ApiOperation
(
"创建品牌"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"name"
,
value
=
"品牌名称"
,
required
=
true
,
example
=
"安踏"
),
@ApiImplicitParam
(
name
=
"description"
,
value
=
"品牌描述"
,
required
=
true
,
example
=
"安踏拖鞋"
),
@ApiImplicitParam
(
name
=
"picUrl"
,
value
=
"品牌图片"
,
required
=
true
,
example
=
"http://www.iocoder.cn"
),
@ApiImplicitParam
(
name
=
"status"
,
value
=
"状态 1开启 2禁用"
,
required
=
true
,
example
=
"1"
)
})
public
CommonResult
<
AdminsProductBrandVO
>
add
(
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"description"
)
String
description
,
@RequestParam
(
"picUrl"
)
String
picUrl
,
@RequestParam
(
"status"
)
Integer
status
)
{
// 创建 ProductBrandAddDTO 对象
ProductBrandAddDTO
productBrandAddDTO
=
new
ProductBrandAddDTO
().
setName
(
name
).
setDescription
(
description
)
.
setPicUrl
(
picUrl
).
setStatus
(
status
);
// 保存商品
ProductBrandBO
result
=
productBrandService
.
addProductBrand
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
productBrandAddDTO
);
// 返回结果
return
success
(
ProductBrandConvert
.
INSTANCE
.
convert
(
result
));
}
@PostMapping
(
"/update"
)
@ApiOperation
(
"更新商品"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"品牌主键"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"品牌名称"
,
required
=
true
,
example
=
"安踏"
),
@ApiImplicitParam
(
name
=
"description"
,
value
=
"品牌描述"
,
required
=
true
,
example
=
"安踏拖鞋"
),
@ApiImplicitParam
(
name
=
"picUrl"
,
value
=
"品牌图片"
,
required
=
true
,
example
=
"http://www.iocoder.cn"
),
@ApiImplicitParam
(
name
=
"status"
,
value
=
"状态 1开启 2禁用"
,
required
=
true
,
example
=
"1"
)
})
public
CommonResult
<
Boolean
>
update
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"description"
)
String
description
,
@RequestParam
(
"picUrl"
)
String
picUrl
,
@RequestParam
(
"status"
)
Integer
status
)
{
// 创建 productBrandUpdateDTO 对象
ProductBrandUpdateDTO
productBrandUpdateDTO
=
new
ProductBrandUpdateDTO
().
setId
(
id
).
setName
(
name
).
setDescription
(
description
)
.
setPicUrl
(
picUrl
).
setStatus
(
status
);
// 更新商品
productBrandService
.
updateProductBrand
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
productBrandUpdateDTO
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@ApiOperation
(
"获取品牌"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"品牌主键"
,
required
=
true
,
example
=
"1"
)
})
public
CommonResult
<
AdminsProductBrandVO
>
add
(
@RequestParam
(
"id"
)
Integer
id
)
{
// 保存商品
ProductBrandBO
result
=
productBrandService
.
getProductBrand
(
id
);
// 返回结果
return
success
(
ProductBrandConvert
.
INSTANCE
.
convert
(
result
));
}
@GetMapping
(
"/page"
)
@ApiOperation
(
"获得品牌分页"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"name"
,
value
=
"品牌名称"
,
required
=
true
,
example
=
"安踏"
),
@ApiImplicitParam
(
name
=
"description"
,
value
=
"品牌描述"
,
required
=
true
,
example
=
"安踏拖鞋"
),
@ApiImplicitParam
(
name
=
"status"
,
value
=
"状态 1开启 2禁用"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"页码"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"页面大小"
,
required
=
true
,
example
=
"10"
)
})
public
CommonResult
<
AdminsProductBrangPageVO
>
attrPage
(
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"description"
,
required
=
false
)
String
description
,
@RequestParam
(
value
=
"status"
,
required
=
false
)
Integer
status
,
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"1"
)
Integer
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
)
{
// 创建 ProductAttrPageDTO 对象
ProductBrandPageDTO
productBrandPageDTO
=
new
ProductBrandPageDTO
().
setName
(
name
)
.
setDescription
(
description
)
.
setStatus
(
status
)
.
setPageNo
(
pageNo
)
.
setPageSize
(
pageSize
);
// 查询分页
ProductBrangPageBO
result
=
productBrandService
.
getProductBrandPage
(
productBrandPageDTO
);
// 返回结果
return
success
(
ProductBrandConvert
.
INSTANCE
.
convert
(
result
));
}
}
product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductCategoryController.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
application
.
controller
.
admins
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.product.api.ProductCategoryService
;
import
cn.iocoder.mall.product.api.bo.ProductCategoryBO
;
import
cn.iocoder.mall.product.api.constant.ProductCategoryConstants
;
import
cn.iocoder.mall.product.api.dto.ProductCategoryAddDTO
;
import
cn.iocoder.mall.product.api.dto.ProductCategoryUpdateDTO
;
import
cn.iocoder.mall.product.application.convert.ProductCategoryConvert
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryTreeNodeVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryVO
;
import
cn.iocoder.mall.security.core.context.AdminSecurityContextHolder
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.dubbo.config.annotation.Reference
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
@RestController
@RequestMapping
(
"admins/category"
)
@Api
(
"商品分类"
)
public
class
AdminsProductCategoryController
{
@Reference
(
validation
=
"true"
,
version
=
"${dubbo.provider.ProductCategoryService.version}"
)
private
ProductCategoryService
productCategoryService
;
@GetMapping
(
"/tree"
)
@ApiOperation
(
"获得分类树结构"
)
public
CommonResult
<
List
<
AdminsProductCategoryTreeNodeVO
>>
tree
()
{
List
<
ProductCategoryBO
>
productCategories
=
productCategoryService
.
getAll
();
// 创建 ProductCategoryTreeNodeVO Map
Map
<
Integer
,
AdminsProductCategoryTreeNodeVO
>
treeNodeMap
=
productCategories
.
stream
().
collect
(
Collectors
.
toMap
(
ProductCategoryBO:
:
getId
,
ProductCategoryConvert
.
Admins
.
INSTANCE
::
convert
));
// 处理父子关系
treeNodeMap
.
values
().
stream
()
.
filter
(
node
->
!
node
.
getPid
().
equals
(
ProductCategoryConstants
.
PID_ROOT
))
.
forEach
((
childNode
)
->
{
// 获得父节点
AdminsProductCategoryTreeNodeVO
parentNode
=
treeNodeMap
.
get
(
childNode
.
getPid
());
if
(
parentNode
.
getChildren
()
==
null
)
{
// 初始化 children 数组
parentNode
.
setChildren
(
new
ArrayList
<>());
}
// 将自己添加到父节点中
parentNode
.
getChildren
().
add
(
childNode
);
});
// 获得到所有的根节点
List
<
AdminsProductCategoryTreeNodeVO
>
rootNodes
=
treeNodeMap
.
values
().
stream
()
.
filter
(
node
->
node
.
getPid
().
equals
(
ProductCategoryConstants
.
PID_ROOT
))
.
sorted
(
Comparator
.
comparing
(
AdminsProductCategoryTreeNodeVO:
:
getSort
))
.
collect
(
Collectors
.
toList
());
return
success
(
rootNodes
);
}
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"创建商品分类"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"父级分类编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"分类名字(标识)"
,
required
=
true
,
example
=
"admin/info"
),
@ApiImplicitParam
(
name
=
"description"
,
value
=
"描述"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"picUrl"
,
value
=
"分类图片"
,
example
=
"http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg/"
),
@ApiImplicitParam
(
name
=
"sort"
,
value
=
"排序"
,
required
=
true
,
example
=
"1"
),
})
public
CommonResult
<
AdminsProductCategoryVO
>
add
(
@RequestParam
(
"pid"
)
Integer
pid
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"description"
)
String
description
,
@RequestParam
(
value
=
"picUrl"
,
required
=
false
)
String
picUrl
,
@RequestParam
(
"sort"
)
Integer
sort
)
{
// 创建 ProductCategoryAddDTO 对象
ProductCategoryAddDTO
productCategoryAddDTO
=
new
ProductCategoryAddDTO
().
setPid
(
pid
).
setName
(
name
)
.
setDescription
(
description
).
setPicUrl
(
picUrl
).
setSort
(
sort
);
// 创建商品分类
ProductCategoryBO
result
=
productCategoryService
.
addProductCategory
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
productCategoryAddDTO
);
// 返回结果
return
success
(
ProductCategoryConvert
.
Admins
.
INSTANCE
.
convert2
(
result
));
}
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"更新商品分类"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"分类编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"父级分类编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"分类名字(标识)"
,
required
=
true
,
example
=
"admin/info"
),
@ApiImplicitParam
(
name
=
"description"
,
value
=
"描述"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"picUrl"
,
value
=
"分类图片"
,
example
=
"http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg/"
),
@ApiImplicitParam
(
name
=
"sort"
,
value
=
"排序"
,
required
=
true
,
example
=
"1"
),
})
public
CommonResult
<
Boolean
>
update
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"pid"
)
Integer
pid
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"description"
)
String
description
,
@RequestParam
(
value
=
"picUrl"
,
required
=
false
)
String
picUrl
,
@RequestParam
(
"sort"
)
Integer
sort
)
{
// 创建 ProductCategoryUpdateDTO 对象
ProductCategoryUpdateDTO
productCategoryAddDTO
=
new
ProductCategoryUpdateDTO
().
setId
(
id
).
setPid
(
pid
).
setName
(
name
)
.
setDescription
(
description
).
setPicUrl
(
picUrl
).
setSort
(
sort
);
// 更新商品分类
return
success
(
productCategoryService
.
updateProductCategory
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
productCategoryAddDTO
));
}
@PostMapping
(
"/update_status"
)
@ApiOperation
(
value
=
"更新商品分类状态"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"商品分类编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"status"
,
value
=
"状态。1 - 开启;2 - 禁用"
,
required
=
true
,
example
=
"1"
),
})
public
CommonResult
<
Boolean
>
updateStatus
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"status"
)
Integer
status
)
{
return
success
(
productCategoryService
.
updateProductCategoryStatus
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
id
,
status
));
}
@PostMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除商品分类"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"商品分类编号"
,
required
=
true
,
example
=
"1"
)
public
CommonResult
<
Boolean
>
delete
(
@RequestParam
(
"id"
)
Integer
id
)
{
return
success
(
productCategoryService
.
deleteProductCategory
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
id
));
}
}
product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductBrandConvert.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
application
.
convert
;
import
cn.iocoder.mall.product.api.bo.ProductBrandBO
;
import
cn.iocoder.mall.product.api.bo.ProductBrangPageBO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductBrandVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductBrangPageVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
@Mapper
public
interface
ProductBrandConvert
{
ProductBrandConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductBrandConvert
.
class
);
@Mappings
({})
AdminsProductBrandVO
convert
(
ProductBrandBO
result
);
@Mappings
({})
AdminsProductBrangPageVO
convert
(
ProductBrangPageBO
result
);
}
product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductCategoryConvert.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
application
.
convert
;
import
cn.iocoder.mall.product.api.bo.ProductCategoryBO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryTreeNodeVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryVO
;
import
cn.iocoder.mall.product.application.vo.users.UsersProductCategoryVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
public
interface
ProductCategoryConvert
{
@Mapper
interface
Users
{
Users
INSTANCE
=
Mappers
.
getMapper
(
Users
.
class
);
@Mappings
({})
UsersProductCategoryVO
convertToVO
(
ProductCategoryBO
category
);
@Mappings
({})
List
<
UsersProductCategoryVO
>
convertToVO
(
List
<
ProductCategoryBO
>
categoryList
);
}
@Mapper
interface
Admins
{
Admins
INSTANCE
=
Mappers
.
getMapper
(
Admins
.
class
);
@Mappings
({})
AdminsProductCategoryTreeNodeVO
convert
(
ProductCategoryBO
category
);
@Mappings
({})
AdminsProductCategoryVO
convert2
(
ProductCategoryBO
result
);
}
}
product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductBrangPageVO.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
application
.
vo
.
admins
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
/**
* 商品品牌分页 BO
*/
@ApiModel
(
"商品品牌分页"
)
@Data
@Accessors
(
chain
=
true
)
public
class
AdminsProductBrangPageVO
{
@ApiModelProperty
(
value
=
"品牌数组"
,
required
=
true
)
private
List
<
AdminsProductBrandVO
>
brands
;
@ApiModelProperty
(
value
=
"总数"
,
required
=
true
)
private
Integer
count
;
}
product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductCategoryTreeNodeVO.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
application
.
vo
.
admins
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
import
java.util.List
;
@ApiModel
(
"产品分类树节点 VO"
)
@Data
@Accessors
(
chain
=
true
)
public
class
AdminsProductCategoryTreeNodeVO
{
@ApiModelProperty
(
value
=
"分类编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"父分类编号"
,
required
=
true
,
example
=
"0"
)
private
Integer
pid
;
@ApiModelProperty
(
value
=
"分类名"
,
required
=
true
,
example
=
"手机"
)
private
String
name
;
@ApiModelProperty
(
value
=
"描述"
,
required
=
true
,
example
=
"这个商品很吊"
)
private
String
description
;
@ApiModelProperty
(
value
=
"分类图片"
,
notes
=
"一般情况下,只有根分类才有图片"
,
example
=
"http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg"
)
private
String
picUrl
;
@ApiModelProperty
(
value
=
"排序值"
,
required
=
true
,
example
=
"10"
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
notes
=
"1-开启;2-关闭"
,
example
=
"1"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
,
example
=
"时间戳"
)
private
Date
createTime
;
@ApiModelProperty
(
value
=
"子节点数组"
)
private
List
<
AdminsProductCategoryTreeNodeVO
>
children
;
}
product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductCategoryVO.java
deleted
100644 → 0
浏览文件 @
2b845968
package
cn
.
iocoder
.
mall
.
product
.
application
.
vo
.
admins
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
@ApiModel
(
"产品分类 VO"
)
@Data
@Accessors
(
chain
=
true
)
public
class
AdminsProductCategoryVO
{
@ApiModelProperty
(
value
=
"分类编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"父分类编号"
,
required
=
true
,
example
=
"0"
)
private
Integer
pid
;
@ApiModelProperty
(
value
=
"分类名"
,
required
=
true
,
example
=
"手机"
)
private
String
name
;
@ApiModelProperty
(
value
=
"描述"
,
required
=
true
,
example
=
"这个商品很吊"
)
private
String
description
;
@ApiModelProperty
(
value
=
"分类图片"
,
notes
=
"一般情况下,只有根分类才有图片"
,
example
=
"http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg"
)
private
String
picUrl
;
@ApiModelProperty
(
value
=
"排序值"
,
required
=
true
,
example
=
"10"
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
notes
=
"1-开启;2-关闭"
,
example
=
"1"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
,
example
=
"时间戳"
)
private
Date
createTime
;
}
product/product-start/src/main/resources/application-test.yaml
deleted
100644 → 0
浏览文件 @
2b845968
swagger
:
enable
:
true
title
:
商品子系统
description
:
商品子系统
version
:
1.0.0
base-package
:
cn.iocoder.mall.product.application.controller
product/product-start/src/main/resources/application.yaml
deleted
100644 → 0
浏览文件 @
2b845968
spring
:
application
:
name
:
product-application
# Spring Cloud 配置项
cloud
:
# Spring Cloud Sentinel 配置项
sentinel
:
transport
:
dashboard
:
s1.iocoder.cn:12088
# Sentinel Dashboard 服务地址
eager
:
true
# 项目启动时,直接连接到 Sentinel
# server
server
:
port
:
18081
servlet
:
context-path
:
/product-api/
management
:
endpoints
:
web
:
exposure
:
include
:
health,info,env,metrics,prometheus
metrics
:
enabled
:
true
swagger
:
enable
:
true
title
:
商品子系统
description
:
商品子系统
version
:
1.0.0
base-package
:
cn.iocoder.mall.product.application.controller
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论