Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
f0999eac
提交
f0999eac
authored
8月 24, 2020
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Banner 的迁移
商品推荐的迁移
上级
c94fae17
隐藏空白字符变更
内嵌
并排
正在显示
62 个修改的文件
包含
1139 行增加
和
1400 行删除
+1139
-1400
BannerController.java
...ementweb/controller/promotion/brand/BannerController.java
+65
-0
BannerCreateReqVO.java
...tweb/controller/promotion/brand/vo/BannerCreateReqVO.java
+17
-9
BannerPageReqVO.java
...entweb/controller/promotion/brand/vo/BannerPageReqVO.java
+17
-0
BannerRespVO.java
...gementweb/controller/promotion/brand/vo/BannerRespVO.java
+3
-3
BannerUpdateReqVO.java
...tweb/controller/promotion/brand/vo/BannerUpdateReqVO.java
+15
-9
ProductRecommendController.java
...oller/promotion/recommend/ProductRecommendController.java
+60
-0
ProductRecommendCreateReqVO.java
...r/promotion/recommend/vo/ProductRecommendCreateReqVO.java
+33
-0
ProductRecommendDetailVO.java
...ller/promotion/recommend/vo/ProductRecommendDetailVO.java
+43
-0
ProductRecommendPageReqVO.java
...ler/promotion/recommend/vo/ProductRecommendPageReqVO.java
+20
-0
ProductRecommendUpdateReqVO.java
...r/promotion/recommend/vo/ProductRecommendUpdateReqVO.java
+36
-0
BannerConvert.java
...r/mall/managementweb/convert/promotion/BannerConvert.java
+28
-0
CouponTemplateConvert.java
...anagementweb/convert/promotion/CouponTemplateConvert.java
+1
-1
ProductRecommendConvert.java
...agementweb/convert/promotion/ProductRecommendConvert.java
+31
-0
PromotionActivityConvert.java
...gementweb/convert/promotion/PromotionActivityConvert.java
+1
-1
PromotionActivityManager.java
.../manager/promotion/activity/PromotionActivityManager.java
+1
-1
BannerManager.java
.../managementweb/manager/promotion/brand/BannerManager.java
+68
-0
CouponTemplateManager.java
...ntweb/manager/promotion/coupon/CouponTemplateManager.java
+1
-1
ProductRecommendManager.java
.../manager/promotion/recommend/ProductRecommendManager.java
+91
-0
application.yml
management-web-app/src/main/resources/application.yml
+4
-0
BannerRpc.java
...a/cn/iocoder/mall/promotion/api/rpc/banner/BannerRpc.java
+43
-19
BannerCreateReqDTO.java
...mall/promotion/api/rpc/banner/dto/BannerCreateReqDTO.java
+25
-2
BannerListReqDTO.java
...r/mall/promotion/api/rpc/banner/dto/BannerListReqDTO.java
+26
-0
BannerPageReqDTO.java
...r/mall/promotion/api/rpc/banner/dto/BannerPageReqDTO.java
+5
-10
BannerPageRespDTO.java
.../mall/promotion/api/rpc/banner/dto/BannerPageRespDTO.java
+0
-25
BannerRespDTO.java
...oder/mall/promotion/api/rpc/banner/dto/BannerRespDTO.java
+1
-1
BannerUpdateReqDTO.java
...mall/promotion/api/rpc/banner/dto/BannerUpdateReqDTO.java
+27
-1
ProductRecommendRpc.java
...mall/promotion/api/rpc/recommend/ProductRecommendRpc.java
+44
-16
ProductRecommendCreateReqDTO.java
...n/api/rpc/recommend/dto/ProductRecommendCreateReqDTO.java
+21
-2
ProductRecommendListReqDTO.java
...ion/api/rpc/recommend/dto/ProductRecommendListReqDTO.java
+7
-28
ProductRecommendPageReqDTO.java
...ion/api/rpc/recommend/dto/ProductRecommendPageReqDTO.java
+8
-10
ProductRecommendPageRespDTO.java
...on/api/rpc/recommend/dto/ProductRecommendPageRespDTO.java
+0
-25
ProductRecommendUpdateReqDTO.java
...n/api/rpc/recommend/dto/ProductRecommendUpdateReqDTO.java
+24
-2
BannerConvert.java
...r/mall/promotionservice/convert/banner/BannerConvert.java
+12
-14
ProductRecommendConvert.java
...ionservice/convert/recommend/ProductRecommendConvert.java
+10
-15
BannerDO.java
...romotionservice/dal/mysql/dataobject/banner/BannerDO.java
+4
-0
ProductRecommendDO.java
...ce/dal/mysql/dataobject/recommend/ProductRecommendDO.java
+2
-0
BannerMapper.java
...romotionservice/dal/mysql/mapper/banner/BannerMapper.java
+15
-16
ProductRecommendMapper.java
...ce/dal/mysql/mapper/recommend/ProductRecommendMapper.java
+21
-19
BannerManager.java
...r/mall/promotionservice/manager/banner/BannerManager.java
+42
-0
ProductRecommendManager.java
...ionservice/manager/recommend/ProductRecommendManager.java
+66
-0
BannerRpcImpl.java
...coder/mall/promotionservice/rpc/banner/BannerRpcImpl.java
+48
-0
ProductRecommendRpcImpl.java
...omotionservice/rpc/recommend/ProductRecommendRpcImpl.java
+48
-0
BannerService.java
...r/mall/promotionservice/service/banner/BannerService.java
+56
-55
BannerBO.java
...der/mall/promotionservice/service/banner/bo/BannerBO.java
+0
-49
BannerPageBO.java
...mall/promotionservice/service/banner/bo/BannerPageBO.java
+0
-26
ProductRecommendService.java
...ionservice/service/recommend/ProductRecommendService.java
+49
-69
ProductRecommendAddBO.java
...onservice/service/recommend/bo/ProductRecommendAddBO.java
+0
-29
ProductRecommendPageBO.java
...nservice/service/recommend/bo/ProductRecommendPageBO.java
+0
-26
ProductRecommendUpdateBO.java
...ervice/service/recommend/bo/ProductRecommendUpdateBO.java
+0
-31
BannerConvert.java
.../cn/iocoder/mall/promotion/biz/convert/BannerConvert.java
+0
-31
ProductRecommendConvert.java
...r/mall/promotion/biz/convert/ProductRecommendConvert.java
+0
-30
BannerMapper.java
.../java/cn/iocoder/mall/promotion/biz/dao/BannerMapper.java
+0
-27
ProductRecommendMapper.java
...ocoder/mall/promotion/biz/dao/ProductRecommendMapper.java
+0
-31
BannerServiceImpl.java
...iocoder/mall/promotion/biz/service/BannerServiceImpl.java
+0
-97
ProductRecommendServiceImpl.java
...ll/promotion/biz/service/ProductRecommendServiceImpl.java
+0
-119
BannerMapper.xml
...n-service-impl/src/main/resources/mapper/BannerMapper.xml
+0
-111
ProductRecommendMapper.xml
...impl/src/main/resources/mapper/ProductRecommendMapper.xml
+0
-126
pom.xml
promotion/promotion-start/pom.xml
+0
-132
AdminsBannerController.java
...application/controller/admins/AdminsBannerController.java
+0
-101
AdminsProductRecommendController.java
...n/controller/admins/AdminsProductRecommendController.java
+0
-11
BannerConvert.java
...der/mall/promotion/application/convert/BannerConvert.java
+0
-39
ProductRecommendConvert.java
...romotion/application/convert/ProductRecommendConvert.java
+0
-30
没有找到文件。
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/BannerController.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
promotion
.
brand
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerCreateReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerPageReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerRespVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerUpdateReqVO
;
import
cn.iocoder.mall.managementweb.manager.promotion.brand.BannerManager
;
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
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
/**
* Banner Controller
*/
@RestController
@RequestMapping
(
"/promotion/banner"
)
@Api
(
tags
=
"Banner API"
)
@Validated
public
class
BannerController
{
@Autowired
private
BannerManager
bannerManager
;
@PostMapping
(
"/create"
)
@ApiOperation
(
"创建 Banner"
)
@RequiresPermissions
(
"promotion:banner:create"
)
public
CommonResult
<
Integer
>
createBanner
(
@Valid
BannerCreateReqVO
createVO
)
{
return
success
(
bannerManager
.
createBanner
(
createVO
));
}
@PostMapping
(
"/update"
)
@ApiOperation
(
"更新 Banner"
)
@RequiresPermissions
(
"promotion:banner:update"
)
public
CommonResult
<
Boolean
>
updateBanner
(
@Valid
BannerUpdateReqVO
updateVO
)
{
bannerManager
.
updateBanner
(
updateVO
);
return
success
(
true
);
}
@PostMapping
(
"/delete"
)
@ApiOperation
(
"删除 Banner"
)
@ApiImplicitParam
(
name
=
"bannerId"
,
value
=
" Banner 编号"
,
required
=
true
)
@RequiresPermissions
(
"promotion:banner:delete"
)
public
CommonResult
<
Boolean
>
deleteBanner
(
@RequestParam
(
"bannerId"
)
Integer
bannerId
)
{
bannerManager
.
deleteBanner
(
bannerId
);
return
success
(
true
);
}
@GetMapping
(
"/page"
)
@ApiOperation
(
"获得 Banner 分页"
)
@RequiresPermissions
(
"promotion:banner:page"
)
public
CommonResult
<
PageResult
<
BannerRespVO
>>
pageBanner
(
BannerPageReqVO
pageVO
)
{
return
success
(
bannerManager
.
pageBanner
(
pageVO
));
}
}
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/banner/bo/BannerAddB
O.java
→
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerCreateReqV
O.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotionservice
.
service
.
banner
.
b
o
;
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
promotion
.
brand
.
v
o
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.URL
;
import
org.hibernate.validator.constraints.URL
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
@ApiModel
(
"Banner 创建 Request VO"
)
* Banner 添加 DTO
*/
@Data
@Data
@Accessors
(
chain
=
true
)
public
class
BannerCreateReqVO
{
public
class
BannerAddBO
implements
Serializable
{
@ApiModelProperty
(
value
=
"标题"
,
required
=
true
,
example
=
"活动 A"
)
@NotEmpty
(
message
=
"标题不能为空"
)
@NotEmpty
(
message
=
"标题不能为空"
)
@Length
(
min
=
2
,
max
=
32
,
message
=
"标题长度为 2-32 位"
)
@Length
(
min
=
2
,
max
=
32
,
message
=
"标题长度为 2-32 位"
)
private
String
title
;
private
String
title
;
@ApiModelProperty
(
value
=
"跳转链接"
,
required
=
true
,
example
=
"http://www.baidu.com"
)
@NotEmpty
(
message
=
"跳转链接不能为空"
)
@NotEmpty
(
message
=
"跳转链接不能为空"
)
@URL
(
message
=
"跳转链接格式不正确"
)
@URL
(
message
=
"跳转链接格式不正确"
)
@Length
(
max
=
255
,
message
=
"跳转链接最大长度为 255 位"
)
@Length
(
max
=
255
,
message
=
"跳转链接最大长度为 255 位"
)
private
String
url
;
private
String
url
;
@NotEmpty
(
message
=
"图片链接不能为空"
)
@ApiModelProperty
(
value
=
"跳转链接"
,
required
=
true
,
example
=
"http://www.iocoder.cn/01.jpg"
)
@NotEmpty
(
message
=
"跳转链接不能为空"
)
@URL
(
message
=
"图片链接格式不正确"
)
@URL
(
message
=
"图片链接格式不正确"
)
@Length
(
max
=
255
,
message
=
"图片链接最大长度为 255 位"
)
@Length
(
max
=
255
,
message
=
"图片链接最大长度为 255 位"
)
private
String
picUrl
;
private
String
picUrl
;
@ApiModelProperty
(
value
=
"排序"
,
required
=
true
,
example
=
"10"
)
@NotNull
(
message
=
"排序不能为空"
)
@NotNull
(
message
=
"排序不能为空"
)
private
Integer
sort
;
private
Integer
sort
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
example
=
"1"
)
@NotNull
(
message
=
"状态不能为空"
)
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"备注"
,
example
=
"这个活动很牛逼"
)
@Length
(
max
=
255
,
message
=
"备注最大长度为 255 位"
)
@Length
(
max
=
255
,
message
=
"备注最大长度为 255 位"
)
private
String
memo
;
private
String
memo
;
...
...
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerPageReqVO.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
promotion
.
brand
.
vo
;
import
cn.iocoder.common.framework.vo.PageParam
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@ApiModel
(
"Banner 分页 Request VO"
)
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
BannerPageReqVO
extends
PageParam
{
@ApiModelProperty
(
value
=
"标题"
,
required
=
true
,
example
=
"活动 A"
)
private
String
title
;
}
promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsBanner
VO.java
→
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerResp
VO.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
vo
.
admins
;
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
promotion
.
brand
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -10,7 +10,7 @@ import java.util.Date;
...
@@ -10,7 +10,7 @@ import java.util.Date;
@ApiModel
(
"Banner VO"
)
@ApiModel
(
"Banner VO"
)
@Data
@Data
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
AdminsBanner
VO
{
public
class
BannerResp
VO
{
@ApiModelProperty
(
value
=
"Banner 编号"
,
required
=
true
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"Banner 编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
id
;
private
Integer
id
;
...
@@ -24,7 +24,7 @@ public class AdminsBannerVO {
...
@@ -24,7 +24,7 @@ public class AdminsBannerVO {
private
Integer
sort
;
private
Integer
sort
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
example
=
"1"
)
private
Integer
status
;
private
Integer
status
;
@ApiModelProperty
(
value
=
"备注"
,
required
=
true
,
example
=
"这个活动很牛逼"
)
@ApiModelProperty
(
value
=
"备注"
,
example
=
"这个活动很牛逼"
)
private
String
memo
;
private
String
memo
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
,
example
=
"时间戳格式"
)
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
,
example
=
"时间戳格式"
)
private
Date
createTime
;
private
Date
createTime
;
...
...
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/banner/bo/BannerUpdateB
O.java
→
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerUpdateReqV
O.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotionservice
.
service
.
banner
.
b
o
;
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
promotion
.
brand
.
v
o
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.URL
;
import
org.hibernate.validator.constraints.URL
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
@ApiModel
(
"Banner 更新 Request VO"
)
* Banner 更新 DTO
*/
@Data
@Data
@Accessors
(
chain
=
true
)
public
class
BannerUpdateReqVO
{
public
class
BannerUpdateBO
implements
Serializable
{
@ApiModelProperty
(
value
=
"Banner 编号"
,
required
=
true
,
example
=
"1"
)
@NotNull
(
message
=
"编号不能为空"
)
@NotNull
(
message
=
"编号不能为空"
)
private
Integer
id
;
private
Integer
id
;
@ApiModelProperty
(
value
=
"标题"
,
required
=
true
,
example
=
"活动 A"
)
@NotEmpty
(
message
=
"标题不能为空"
)
@NotEmpty
(
message
=
"标题不能为空"
)
@Length
(
min
=
2
,
max
=
32
,
message
=
"标题长度为 2-32 位"
)
@Length
(
min
=
2
,
max
=
32
,
message
=
"标题长度为 2-32 位"
)
private
String
title
;
private
String
title
;
@ApiModelProperty
(
value
=
"跳转链接"
,
required
=
true
,
example
=
"http://www.baidu.com"
)
@NotEmpty
(
message
=
"跳转链接不能为空"
)
@NotEmpty
(
message
=
"跳转链接不能为空"
)
@URL
(
message
=
"跳转链接格式不正确"
)
@URL
(
message
=
"跳转链接格式不正确"
)
@Length
(
max
=
255
,
message
=
"跳转链接最大长度为 255 位"
)
@Length
(
max
=
255
,
message
=
"跳转链接最大长度为 255 位"
)
private
String
url
;
private
String
url
;
@NotEmpty
(
message
=
"图片链接不能为空"
)
@ApiModelProperty
(
value
=
"跳转链接"
,
required
=
true
,
example
=
"http://www.iocoder.cn/01.jpg"
)
@NotEmpty
(
message
=
"跳转链接不能为空"
)
@URL
(
message
=
"图片链接格式不正确"
)
@URL
(
message
=
"图片链接格式不正确"
)
@Length
(
max
=
255
,
message
=
"图片链接最大长度为 255 位"
)
@Length
(
max
=
255
,
message
=
"图片链接最大长度为 255 位"
)
private
String
picUrl
;
private
String
picUrl
;
@ApiModelProperty
(
value
=
"排序"
,
required
=
true
,
example
=
"10"
)
@NotNull
(
message
=
"排序不能为空"
)
@NotNull
(
message
=
"排序不能为空"
)
private
Integer
sort
;
private
Integer
sort
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
example
=
"1"
)
@NotNull
(
message
=
"状态不能为空"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"备注"
,
example
=
"这个活动很牛逼"
)
@Length
(
max
=
255
,
message
=
"备注最大长度为 255 位"
)
@Length
(
max
=
255
,
message
=
"备注最大长度为 255 位"
)
private
String
memo
;
private
String
memo
;
...
...
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/ProductRecommendController.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
promotion
.
recommend
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendCreateReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendDetailVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendPageReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendUpdateReqVO
;
import
cn.iocoder.mall.managementweb.manager.promotion.recommend.ProductRecommendManager
;
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
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
/**
* 商品推荐 Controller
*/
@RestController
@RequestMapping
(
"/promotion/product-recommend"
)
@Api
(
tags
=
"商品推荐"
)
@Validated
public
class
ProductRecommendController
{
@Autowired
private
ProductRecommendManager
productRecommendManager
;
@PostMapping
(
"/create"
)
@ApiOperation
(
"创建商品推荐"
)
public
CommonResult
<
Integer
>
createProductRecommend
(
@Valid
ProductRecommendCreateReqVO
createVO
)
{
return
success
(
productRecommendManager
.
createProductRecommend
(
createVO
));
}
@PostMapping
(
"/update"
)
@ApiOperation
(
"更新商品推荐"
)
public
CommonResult
<
Boolean
>
updateProductRecommend
(
@Valid
ProductRecommendUpdateReqVO
updateVO
)
{
productRecommendManager
.
updateProductRecommend
(
updateVO
);
return
success
(
true
);
}
@PostMapping
(
"/delete"
)
@ApiOperation
(
"删除商品推荐"
)
@ApiImplicitParam
(
name
=
"productRecommendId"
,
value
=
"商品推荐编号"
,
required
=
true
)
public
CommonResult
<
Boolean
>
deleteProductRecommend
(
@RequestParam
(
"productRecommendId"
)
Integer
productRecommendId
)
{
productRecommendManager
.
deleteProductRecommend
(
productRecommendId
);
return
success
(
true
);
}
@GetMapping
(
"/page"
)
@ApiOperation
(
"获得商品推荐分页"
)
public
CommonResult
<
PageResult
<
ProductRecommendDetailVO
>>
pageProductRecommend
(
ProductRecommendPageReqVO
pageVO
)
{
return
success
(
productRecommendManager
.
pageProductRecommend
(
pageVO
));
}
}
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendCreateReqVO.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
promotion
.
recommend
.
vo
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
@ApiModel
(
"商品推荐创建 Request VO"
)
@Data
public
class
ProductRecommendCreateReqVO
{
@ApiModelProperty
(
value
=
"类型"
,
example
=
"1"
,
required
=
true
,
notes
=
"参见 ProductRecommendTypeEnum 枚举"
)
@NotNull
(
message
=
"类型不能为空"
)
@InEnum
(
value
=
ProductRecommendTypeEnum
.
class
,
message
=
"推荐类型必须是 {value}"
)
private
Integer
type
;
@ApiModelProperty
(
value
=
"商品 Spu 编号"
,
required
=
true
,
example
=
"1"
)
@NotNull
(
message
=
"商品 Spu 编号不能为空"
)
private
Integer
productSpuId
;
@ApiModelProperty
(
value
=
"排序"
,
required
=
true
,
example
=
"1"
)
@NotNull
(
message
=
"排序不能为空"
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
example
=
"1"
,
notes
=
"参见 CommonStatusEnum 枚举"
)
@NotNull
(
message
=
"状态不能为空"
)
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"备注"
,
example
=
"我是备注"
)
private
String
memo
;
}
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendDetailVO.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
promotion
.
recommend
.
vo
;
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
ProductRecommendDetailVO
{
@ApiModelProperty
(
value
=
"编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"推荐类型"
,
required
=
true
,
example
=
"1"
,
notes
=
"参见 ProductRecommendTypeEnum 枚举"
)
private
Integer
type
;
@ApiModelProperty
(
value
=
"商品编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
productSpuId
;
@ApiModelProperty
(
value
=
"排序"
,
required
=
true
,
example
=
"10"
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
example
=
"1"
,
notes
=
"参见 CommonStatusEnum 枚举"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"备注"
,
required
=
true
,
example
=
"这个活动很牛逼"
)
private
String
memo
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
,
example
=
"时间戳格式"
)
private
Date
createTime
;
/**
* 商品信息
*/
private
Spu
spu
;
@ApiModel
(
"商品信息"
)
@Data
public
static
class
Spu
{
@ApiModelProperty
(
value
=
"SPU 名字"
,
required
=
true
,
example
=
"厮大牛逼"
)
private
String
name
;
}
}
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendPageReqVO.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
promotion
.
recommend
.
vo
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.common.framework.vo.PageParam
;
import
cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@ApiModel
(
"商品推荐分页 Request VO"
)
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
ProductRecommendPageReqVO
extends
PageParam
{
@ApiModelProperty
(
value
=
"类型"
,
example
=
"1"
,
notes
=
"参见 ProductRecommendTypeEnum 枚举"
)
@InEnum
(
value
=
ProductRecommendTypeEnum
.
class
,
message
=
"推荐类型必须是 {value}"
)
private
Integer
type
;
}
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendUpdateReqVO.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
managementweb
.
controller
.
promotion
.
recommend
.
vo
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
@ApiModel
(
"商品推荐更新 Request VO"
)
@Data
public
class
ProductRecommendUpdateReqVO
{
@ApiModelProperty
(
value
=
"编号"
,
required
=
true
,
example
=
"1"
)
@NotNull
(
message
=
"编号不能为空"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"类型"
,
example
=
"1"
,
required
=
true
,
notes
=
"参见 ProductRecommendTypeEnum 枚举"
)
@NotNull
(
message
=
"类型不能为空"
)
@InEnum
(
value
=
ProductRecommendTypeEnum
.
class
,
message
=
"推荐类型必须是 {value}"
)
private
Integer
type
;
@ApiModelProperty
(
value
=
"商品 Spu 编号"
,
required
=
true
,
example
=
"1"
)
@NotNull
(
message
=
"商品 Spu 编号不能为空"
)
private
Integer
productSpuId
;
@ApiModelProperty
(
value
=
"排序"
,
required
=
true
,
example
=
"1"
)
@NotNull
(
message
=
"排序不能为空"
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
example
=
"1"
,
notes
=
"参见 CommonStatusEnum 枚举"
)
@NotNull
(
message
=
"状态不能为空"
)
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"备注"
,
example
=
"我是备注"
)
private
String
memo
;
}
management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/BannerConvert.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
managementweb
.
convert
.
promotion
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerCreateReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerPageReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerRespVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerUpdateReqVO
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerCreateReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerPageReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerUpdateReqDTO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
@Mapper
public
interface
BannerConvert
{
BannerConvert
INSTANCE
=
Mappers
.
getMapper
(
BannerConvert
.
class
);
BannerCreateReqDTO
convert
(
BannerCreateReqVO
bean
);
BannerUpdateReqDTO
convert
(
BannerUpdateReqVO
bean
);
BannerPageReqDTO
convert
(
BannerPageReqVO
bean
);
PageResult
<
BannerRespVO
>
convertPage
(
PageResult
<
BannerRespDTO
>
page
);
}
management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/
coupon/
CouponTemplateConvert.java
→
management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/CouponTemplateConvert.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
managementweb
.
convert
.
promotion
.
coupon
;
package
cn
.
iocoder
.
mall
.
managementweb
.
convert
.
promotion
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardCreateReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardCreateReqVO
;
...
...
management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/ProductRecommendConvert.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
managementweb
.
convert
.
promotion
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendCreateReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendDetailVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendPageReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendUpdateReqVO
;
import
cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendCreateReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendPageReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendRespDTO
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendUpdateReqDTO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
@Mapper
public
interface
ProductRecommendConvert
{
ProductRecommendConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductRecommendConvert
.
class
);
ProductRecommendCreateReqDTO
convert
(
ProductRecommendCreateReqVO
bean
);
ProductRecommendUpdateReqDTO
convert
(
ProductRecommendUpdateReqVO
bean
);
ProductRecommendPageReqDTO
convert
(
ProductRecommendPageReqVO
bean
);
PageResult
<
ProductRecommendDetailVO
>
convertPage
(
PageResult
<
ProductRecommendRespDTO
>
page
);
ProductRecommendDetailVO
.
Spu
convert
(
ProductSpuRespDTO
bean
);
}
management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/
activity/
PromotionActivityConvert.java
→
management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/PromotionActivityConvert.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
managementweb
.
convert
.
promotion
.
activity
;
package
cn
.
iocoder
.
mall
.
managementweb
.
convert
.
promotion
;
import
cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO
;
import
cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityPageReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityPageReqDTO
;
...
...
management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/activity/PromotionActivityManager.java
浏览文件 @
f0999eac
...
@@ -3,7 +3,7 @@ package cn.iocoder.mall.managementweb.manager.promotion.activity;
...
@@ -3,7 +3,7 @@ package cn.iocoder.mall.managementweb.manager.promotion.activity;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO
;
import
cn.iocoder.mall.managementweb.convert.promotion.
activity.
PromotionActivityConvert
;
import
cn.iocoder.mall.managementweb.convert.promotion.PromotionActivityConvert
;
import
cn.iocoder.mall.promotion.api.rpc.activity.PromotionActivityRpc
;
import
cn.iocoder.mall.promotion.api.rpc.activity.PromotionActivityRpc
;
import
cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO
;
import
cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.apache.dubbo.config.annotation.DubboReference
;
...
...
management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/brand/BannerManager.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
managementweb
.
manager
.
promotion
.
brand
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerCreateReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerPageReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerRespVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerUpdateReqVO
;
import
cn.iocoder.mall.managementweb.convert.promotion.BannerConvert
;
import
cn.iocoder.mall.promotion.api.rpc.banner.BannerRpc
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.springframework.stereotype.Service
;
/**
* Banner Manager
*/
@Service
public
class
BannerManager
{
@DubboReference
(
version
=
"${dubbo.consumer.BannerRpc.version}"
)
private
BannerRpc
bannerRpc
;
/**
* 创建 Banner
*
* @param createVO 创建 Banner VO
* @return Banner
*/
public
Integer
createBanner
(
BannerCreateReqVO
createVO
)
{
CommonResult
<
Integer
>
createBannerResult
=
bannerRpc
.
createBanner
(
BannerConvert
.
INSTANCE
.
convert
(
createVO
));
createBannerResult
.
checkError
();
return
createBannerResult
.
getData
();
}
/**
* 更新 Banner
*
* @param updateVO 更新 Banner VO
*/
public
void
updateBanner
(
BannerUpdateReqVO
updateVO
)
{
CommonResult
<
Boolean
>
updateBannerResult
=
bannerRpc
.
updateBanner
(
BannerConvert
.
INSTANCE
.
convert
(
updateVO
));
updateBannerResult
.
checkError
();
}
/**
* 删除 Banner
*
* @param bannerId Banner 编号
*/
public
void
deleteBanner
(
Integer
bannerId
)
{
CommonResult
<
Boolean
>
deleteBannerResult
=
bannerRpc
.
deleteBanner
(
bannerId
);
deleteBannerResult
.
checkError
();
}
/**
* 获得 Banner 分页
*
* @param pageVO Banner 分页查询
* @return Banner 分页结果
*/
public
PageResult
<
BannerRespVO
>
pageBanner
(
BannerPageReqVO
pageVO
)
{
CommonResult
<
PageResult
<
BannerRespDTO
>>
pageBannerResult
=
bannerRpc
.
pageBanner
(
BannerConvert
.
INSTANCE
.
convert
(
pageVO
));
pageBannerResult
.
checkError
();
return
BannerConvert
.
INSTANCE
.
convertPage
(
pageBannerResult
.
getData
());
}
}
management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/coupon/CouponTemplateManager.java
浏览文件 @
f0999eac
...
@@ -6,7 +6,7 @@ import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.Cou
...
@@ -6,7 +6,7 @@ import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.Cou
import
cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardUpdateReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardUpdateReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplatePageReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplatePageReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateRespVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateRespVO
;
import
cn.iocoder.mall.managementweb.convert.promotion.
coupon.
CouponTemplateConvert
;
import
cn.iocoder.mall.managementweb.convert.promotion.CouponTemplateConvert
;
import
cn.iocoder.mall.promotion.api.rpc.coupon.CouponTemplateRpc
;
import
cn.iocoder.mall.promotion.api.rpc.coupon.CouponTemplateRpc
;
import
cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateUpdateStatusReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateUpdateStatusReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplateRespDTO
;
import
cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplateRespDTO
;
...
...
management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/recommend/ProductRecommendManager.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
managementweb
.
manager
.
promotion
.
recommend
;
import
cn.iocoder.common.framework.util.CollectionUtils
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendCreateReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendDetailVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendPageReqVO
;
import
cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendUpdateReqVO
;
import
cn.iocoder.mall.managementweb.convert.promotion.ProductRecommendConvert
;
import
cn.iocoder.mall.productservice.rpc.spu.ProductSpuRpc
;
import
cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.ProductRecommendRpc
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendRespDTO
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
java.util.List
;
import
java.util.Map
;
/**
* 商品推荐 Manager
*/
@Service
@Validated
public
class
ProductRecommendManager
{
@DubboReference
(
version
=
"${dubbo.consumer.ProductRecommendRpc.version}"
)
private
ProductRecommendRpc
productRecommendRpc
;
@DubboReference
(
version
=
"${dubbo.consumer.ProductSpuRpc.version}"
)
private
ProductSpuRpc
productSpuRpc
;
/**
* 创建商品推荐
*
* @param createVO 创建商品推荐 VO
* @return 商品推荐
*/
public
Integer
createProductRecommend
(
ProductRecommendCreateReqVO
createVO
)
{
CommonResult
<
Integer
>
createProductRecommendResult
=
productRecommendRpc
.
createProductRecommend
(
ProductRecommendConvert
.
INSTANCE
.
convert
(
createVO
));
createProductRecommendResult
.
checkError
();
return
createProductRecommendResult
.
getData
();
}
/**
* 更新商品推荐
*
* @param updateVO 更新商品推荐 VO
*/
public
void
updateProductRecommend
(
ProductRecommendUpdateReqVO
updateVO
)
{
CommonResult
<
Boolean
>
updateProductRecommendResult
=
productRecommendRpc
.
updateProductRecommend
(
ProductRecommendConvert
.
INSTANCE
.
convert
(
updateVO
));
updateProductRecommendResult
.
checkError
();
}
/**
* 删除商品推荐
*
* @param productRecommendId 商品推荐编号
*/
public
void
deleteProductRecommend
(
Integer
productRecommendId
)
{
CommonResult
<
Boolean
>
deleteProductRecommendResult
=
productRecommendRpc
.
deleteProductRecommend
(
productRecommendId
);
deleteProductRecommendResult
.
checkError
();
}
/**
* 获得商品推荐分页
*
* @param pageVO 商品推荐分页查询
* @return 商品推荐分页结果
*/
public
PageResult
<
ProductRecommendDetailVO
>
pageProductRecommend
(
ProductRecommendPageReqVO
pageVO
)
{
CommonResult
<
PageResult
<
ProductRecommendRespDTO
>>
pageProductRecommendResult
=
productRecommendRpc
.
pageProductRecommend
(
ProductRecommendConvert
.
INSTANCE
.
convert
(
pageVO
));
pageProductRecommendResult
.
checkError
();
// 拼接结果
PageResult
<
ProductRecommendDetailVO
>
pageResult
=
ProductRecommendConvert
.
INSTANCE
.
convertPage
(
pageProductRecommendResult
.
getData
());
if
(!
CollectionUtils
.
isEmpty
(
pageResult
.
getList
()))
{
// 获取商品信息,并进行拼接
CommonResult
<
List
<
ProductSpuRespDTO
>>
listProductSpusResult
=
productSpuRpc
.
listProductSpus
(
CollectionUtils
.
convertSet
(
pageResult
.
getList
(),
ProductRecommendDetailVO:
:
getProductSpuId
));
listProductSpusResult
.
checkError
();
Map
<
Integer
,
ProductSpuRespDTO
>
productSpuMap
=
CollectionUtils
.
convertMap
(
listProductSpusResult
.
getData
(),
ProductSpuRespDTO:
:
getId
);
pageResult
.
getList
().
forEach
(
detailVO
->
detailVO
.
setSpu
(
ProductRecommendConvert
.
INSTANCE
.
convert
(
productSpuMap
.
get
(
detailVO
.
getProductSpuId
()))));
}
return
pageResult
;
}
}
management-web-app/src/main/resources/application.yml
浏览文件 @
f0999eac
...
@@ -61,6 +61,10 @@ dubbo:
...
@@ -61,6 +61,10 @@ dubbo:
version
:
1.0.0
version
:
1.0.0
PromotionActivityRpc
:
PromotionActivityRpc
:
version
:
1.0.0
version
:
1.0.0
BannerRpc
:
version
:
1.0.0
ProductRecommendRpc
:
version
:
1.0.0
# Swagger 配置项
# Swagger 配置项
swagger
:
swagger
:
...
...
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/BannerRpc.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
banner
;
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
banner
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.*
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerPageRespDTO
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerAddReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerPageDTO
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerUpdateReqDTO
;
import
java.util.List
;
import
java.util.List
;
/**
* Banner Rpc 接口
*/
public
interface
BannerRpc
{
public
interface
BannerRpc
{
List
<
BannerRespDTO
>
getBannerListByStatus
(
Integer
status
);
/**
* 创建 Banner
BannerPageRespDTO
getBannerPage
(
BannerPageDTO
bannerPageDTO
);
*
* @param createDTO 创建 Banner DTO
BannerRespDTO
addBanner
(
Integer
adminId
,
BannerAddReqDTO
bannerAddDTO
);
* @return Banner 编号
*/
Boolean
updateBanner
(
Integer
adminId
,
BannerUpdateReqDTO
bannerUpdateDTO
);
CommonResult
<
Integer
>
createBanner
(
BannerCreateReqDTO
createDTO
);
Boolean
updateBannerStatus
(
Integer
adminId
,
Integer
bannerId
,
/**
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
Integer
status
);
* 更新 Banner
*
Boolean
deleteBanner
(
Integer
adminId
,
Integer
bannerId
);
* @param updateDTO 更新 Banner DTO
*/
CommonResult
<
Boolean
>
updateBanner
(
BannerUpdateReqDTO
updateDTO
);
/**
* 删除 Banner
*
* @param bannerId Banner 编号
*/
CommonResult
<
Boolean
>
deleteBanner
(
Integer
bannerId
);
/**
* 获得 Banner 列表
*
* @param listDTO Banner 列表查询 DTO
* @return Banner 列表
*/
CommonResult
<
List
<
BannerRespDTO
>>
listBanners
(
BannerListReqDTO
listDTO
);
/**
* 获得 Banner 分页
*
* @param pageDTO Banner 分页查询
* @return Banner 分页结果
*/
CommonResult
<
PageResult
<
BannerRespDTO
>>
pageBanner
(
BannerPageReqDTO
pageDTO
);
}
}
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/Banner
Add
ReqDTO.java
→
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/Banner
Create
ReqDTO.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
banner
.
dto
;
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
banner
.
dto
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.Length
;
...
@@ -10,25 +12,46 @@ import javax.validation.constraints.NotNull;
...
@@ -10,25 +12,46 @@ import javax.validation.constraints.NotNull;
import
java.io.Serializable
;
import
java.io.Serializable
;
/**
/**
* Banner
添加
DTO
* Banner
创建 Request
DTO
*/
*/
@Data
@Data
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
Banner
Add
ReqDTO
implements
Serializable
{
public
class
Banner
Create
ReqDTO
implements
Serializable
{
/**
* 标题
*/
@NotEmpty
(
message
=
"标题不能为空"
)
@NotEmpty
(
message
=
"标题不能为空"
)
@Length
(
min
=
2
,
max
=
32
,
message
=
"标题长度为 2-32 位"
)
@Length
(
min
=
2
,
max
=
32
,
message
=
"标题长度为 2-32 位"
)
private
String
title
;
private
String
title
;
/**
* 跳转链接
*/
@NotEmpty
(
message
=
"跳转链接不能为空"
)
@NotEmpty
(
message
=
"跳转链接不能为空"
)
@URL
(
message
=
"跳转链接格式不正确"
)
@URL
(
message
=
"跳转链接格式不正确"
)
@Length
(
max
=
255
,
message
=
"跳转链接最大长度为 255 位"
)
@Length
(
max
=
255
,
message
=
"跳转链接最大长度为 255 位"
)
private
String
url
;
private
String
url
;
/**
* 图片链接
*/
@NotEmpty
(
message
=
"图片链接不能为空"
)
@NotEmpty
(
message
=
"图片链接不能为空"
)
@URL
(
message
=
"图片链接格式不正确"
)
@URL
(
message
=
"图片链接格式不正确"
)
@Length
(
max
=
255
,
message
=
"图片链接最大长度为 255 位"
)
@Length
(
max
=
255
,
message
=
"图片链接最大长度为 255 位"
)
private
String
picUrl
;
private
String
picUrl
;
/**
* 排序
*/
@NotNull
(
message
=
"排序不能为空"
)
@NotNull
(
message
=
"排序不能为空"
)
private
Integer
sort
;
private
Integer
sort
;
/**
* 状态
*/
@NotNull
(
message
=
"状态不能为空"
)
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
private
Integer
status
;
/**
* 备注
*/
@Length
(
max
=
255
,
message
=
"备注最大长度为 255 位"
)
@Length
(
max
=
255
,
message
=
"备注最大长度为 255 位"
)
private
String
memo
;
private
String
memo
;
...
...
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerListReqDTO.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
banner
.
dto
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.common.framework.vo.PageParam
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotNull
;
/**
* Banner 列表 Request DTO
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
public
class
BannerListReqDTO
extends
PageParam
{
/**
* 状态
*/
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
private
Integer
status
;
}
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerPageDTO.java
→
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerPage
Req
DTO.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
banner
.
dto
;
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
banner
.
dto
;
import
cn.iocoder.common.framework.vo.PageParam
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
/**
* Banner 分页 DTO
* Banner 分页
Request
DTO
*/
*/
@Data
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
BannerPage
DTO
implements
Serializable
{
public
class
BannerPage
ReqDTO
extends
PageParam
{
/**
/**
* 标题,模糊匹配
* 标题,模糊匹配
*/
*/
private
String
title
;
private
String
title
;
@NotNull
(
message
=
"页码不能为空"
)
private
Integer
pageNo
;
@NotNull
(
message
=
"每页条数不能为空"
)
private
Integer
pageSize
;
}
}
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerPageRespDTO.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
banner
.
dto
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* Banner 分页 BO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
BannerPageRespDTO
implements
Serializable
{
/**
* Banner 数组
*/
private
List
<
BannerRespDTO
>
list
;
/**
* 总量
*/
private
Integer
total
;
}
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerRespDTO.java
浏览文件 @
f0999eac
...
@@ -7,7 +7,7 @@ import java.io.Serializable;
...
@@ -7,7 +7,7 @@ import java.io.Serializable;
import
java.util.Date
;
import
java.util.Date
;
/**
/**
* Banner
B
O
* Banner
Response DT
O
*/
*/
@Data
@Data
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
...
...
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerUpdateReqDTO.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
banner
.
dto
;
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
banner
.
dto
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.Length
;
...
@@ -10,27 +12,51 @@ import javax.validation.constraints.NotNull;
...
@@ -10,27 +12,51 @@ import javax.validation.constraints.NotNull;
import
java.io.Serializable
;
import
java.io.Serializable
;
/**
/**
* Banner 更新 DTO
* Banner 更新
Request
DTO
*/
*/
@Data
@Data
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
BannerUpdateReqDTO
implements
Serializable
{
public
class
BannerUpdateReqDTO
implements
Serializable
{
/**
* 编号
*/
@NotNull
(
message
=
"编号不能为空"
)
@NotNull
(
message
=
"编号不能为空"
)
private
Integer
id
;
private
Integer
id
;
/**
* 标题
*/
@NotEmpty
(
message
=
"标题不能为空"
)
@NotEmpty
(
message
=
"标题不能为空"
)
@Length
(
min
=
2
,
max
=
32
,
message
=
"标题长度为 2-32 位"
)
@Length
(
min
=
2
,
max
=
32
,
message
=
"标题长度为 2-32 位"
)
private
String
title
;
private
String
title
;
/**
* 跳转链接
*/
@NotEmpty
(
message
=
"跳转链接不能为空"
)
@NotEmpty
(
message
=
"跳转链接不能为空"
)
@URL
(
message
=
"跳转链接格式不正确"
)
@URL
(
message
=
"跳转链接格式不正确"
)
@Length
(
max
=
255
,
message
=
"跳转链接最大长度为 255 位"
)
@Length
(
max
=
255
,
message
=
"跳转链接最大长度为 255 位"
)
private
String
url
;
private
String
url
;
/**
* 图片链接
*/
@NotEmpty
(
message
=
"图片链接不能为空"
)
@NotEmpty
(
message
=
"图片链接不能为空"
)
@URL
(
message
=
"图片链接格式不正确"
)
@URL
(
message
=
"图片链接格式不正确"
)
@Length
(
max
=
255
,
message
=
"图片链接最大长度为 255 位"
)
@Length
(
max
=
255
,
message
=
"图片链接最大长度为 255 位"
)
private
String
picUrl
;
private
String
picUrl
;
/**
* 排序
*/
@NotNull
(
message
=
"排序不能为空"
)
@NotNull
(
message
=
"排序不能为空"
)
private
Integer
sort
;
private
Integer
sort
;
/**
* 状态
*/
@NotNull
(
message
=
"状态不能为空"
)
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
private
Integer
status
;
/**
* 备注
*/
@Length
(
max
=
255
,
message
=
"备注最大长度为 255 位"
)
@Length
(
max
=
255
,
message
=
"备注最大长度为 255 位"
)
private
String
memo
;
private
String
memo
;
...
...
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/ProductRecommendRpc.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
recommend
.
dto
;
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
recommend
;
import
cn.iocoder.common.framework.
enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.
vo.CommonResult
;
import
cn.iocoder.common.framework.
exception.ServiceException
;
import
cn.iocoder.common.framework.
vo.PageResult
;
import
cn.iocoder.
common.framework.validator.InEnum
;
import
cn.iocoder.
mall.promotion.api.rpc.recommend.dto.*
;
import
java.util.List
;
import
java.util.List
;
/**
* 商品推荐 Rpc 接口
*/
public
interface
ProductRecommendRpc
{
public
interface
ProductRecommendRpc
{
List
<
ProductRecommendRespDTO
>
getProductRecommendList
(
Integer
type
,
Integer
status
);
/**
* 创建商品推荐
ProductRecommendPageRespDTO
getProductRecommendPage
(
ProductRecommendPageReqDTO
productRecommendPageDTO
);
*
* @param createDTO 创建商品推荐 DTO
ProductRecommendRespDTO
addProductRecommend
(
Integer
adminId
,
ProductRecommendAddReqDTO
productRecommendAddDTO
)
throws
ServiceException
;
* @return 商品推荐编号
*/
Boolean
updateProductRecommend
(
Integer
adminId
,
ProductRecommendUpdateReqDTO
productRecommendUpdateDTO
)
throws
ServiceException
;
CommonResult
<
Integer
>
createProductRecommend
(
ProductRecommendCreateReqDTO
createDTO
);
Boolean
updateProductRecommendStatus
(
Integer
adminId
,
Integer
productRecommendId
,
/**
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
Integer
status
)
throws
ServiceException
;
* 更新商品推荐
*
Boolean
deleteProductRecommend
(
Integer
adminId
,
Integer
productRecommendId
);
* @param updateDTO 更新商品推荐 DTO
*/
CommonResult
<
Boolean
>
updateProductRecommend
(
ProductRecommendUpdateReqDTO
updateDTO
);
/**
* 删除商品推荐
*
* @param productRecommendId 商品推荐编号
*/
CommonResult
<
Boolean
>
deleteProductRecommend
(
Integer
productRecommendId
);
/**
* 获得商品推荐列表
*
* @param listReqDTO 商品推荐列表查询 DTO
* @return 商品推荐列表
*/
CommonResult
<
List
<
ProductRecommendRespDTO
>>
listProductRecommends
(
ProductRecommendListReqDTO
listReqDTO
);
/**
* 获得商品推荐分页
*
* @param pageDTO 商品推荐分页查询
* @return 商品推荐分页结果
*/
CommonResult
<
PageResult
<
ProductRecommendRespDTO
>>
pageProductRecommend
(
ProductRecommendPageReqDTO
pageDTO
);
}
}
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommend
Add
ReqDTO.java
→
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommend
Create
ReqDTO.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
recommend
.
dto
;
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
recommend
.
dto
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum
;
import
cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -10,19 +11,37 @@ import javax.validation.constraints.NotNull;
...
@@ -10,19 +11,37 @@ import javax.validation.constraints.NotNull;
import
java.io.Serializable
;
import
java.io.Serializable
;
/**
/**
* 商品推荐
添加
DTO
* 商品推荐
创建 Request
DTO
*/
*/
@Data
@Data
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
ProductRecommend
Add
ReqDTO
implements
Serializable
{
public
class
ProductRecommend
Create
ReqDTO
implements
Serializable
{
/**
* 推荐类型
*/
@InEnum
(
value
=
ProductRecommendTypeEnum
.
class
,
message
=
"修改推荐类型必须是 {value}"
)
@InEnum
(
value
=
ProductRecommendTypeEnum
.
class
,
message
=
"修改推荐类型必须是 {value}"
)
@NotNull
(
message
=
"推荐类型不能为空"
)
@NotNull
(
message
=
"推荐类型不能为空"
)
private
Integer
type
;
private
Integer
type
;
/**
* 商品编号
*/
@NotNull
(
message
=
"商品编号不能为空"
)
@NotNull
(
message
=
"商品编号不能为空"
)
private
Integer
productSpuId
;
private
Integer
productSpuId
;
/**
* 排序
*/
@NotNull
(
message
=
"排序不能为空"
)
@NotNull
(
message
=
"排序不能为空"
)
private
Integer
sort
;
private
Integer
sort
;
/**
* 状态
*/
@NotNull
(
message
=
"状态不能为空"
)
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
private
Integer
status
;
/**
* 备注
*/
@Length
(
max
=
255
,
message
=
"备注最大长度为 255 位"
)
@Length
(
max
=
255
,
message
=
"备注最大长度为 255 位"
)
private
String
memo
;
private
String
memo
;
...
...
promotion-service-project/promotion-service-ap
p/src/main/java/cn/iocoder/mall/promotionservice/service/recommend/bo/ProductRecommendB
O.java
→
promotion-service-project/promotion-service-ap
i/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendListReqDT
O.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
service
.
service
.
recommend
.
b
o
;
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
recommend
.
dt
o
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum
;
import
cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
/**
* 商品推荐
B
O
* 商品推荐
列表 Req DT
O
*/
*/
@Data
@Data
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
ProductRecommend
B
O
implements
Serializable
{
public
class
ProductRecommend
ListReqDT
O
implements
Serializable
{
/**
* 编号
*/
private
Integer
id
;
/**
/**
* 类型
* 类型
*
* {@link ProductRecommendTypeEnum}
*/
*/
@InEnum
(
value
=
ProductRecommendTypeEnum
.
class
,
message
=
"推荐类型必须是 {value}"
)
private
Integer
type
;
private
Integer
type
;
/**
* 商品 Spu 编号
*/
private
Integer
productSpuId
;
/**
* 排序
*/
private
Integer
sort
;
/**
/**
* 状态
* 状态
*
* {@link cn.iocoder.common.framework.enums.CommonStatusEnum}
*/
*/
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
private
Integer
status
;
private
Integer
status
;
/**
* 备注
*/
private
String
memo
;
/**
* 创建时间
*/
private
Date
createTime
;
}
}
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendPageReqDTO.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
recommend
.
dto
;
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
recommend
.
dto
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.common.framework.vo.PageParam
;
import
cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
/**
* 商品推荐分页 DTO
* 商品推荐分页
Request
DTO
*/
*/
@Data
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
ProductRecommendPageReqDTO
implements
Serializable
{
public
class
ProductRecommendPageReqDTO
extends
PageParam
{
/**
/**
* 推荐类型
* 推荐类型
*/
*/
@InEnum
(
value
=
ProductRecommendTypeEnum
.
class
,
message
=
"推荐类型必须是 {value}"
)
private
Integer
type
;
private
Integer
type
;
@NotNull
(
message
=
"页码不能为空"
)
private
Integer
pageNo
;
@NotNull
(
message
=
"每页条数不能为空"
)
private
Integer
pageSize
;
}
}
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendPageRespDTO.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
recommend
.
dto
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* 商品推荐分页 BO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductRecommendPageRespDTO
implements
Serializable
{
/**
* ProductRecommend 数组
*/
private
List
<
ProductRecommendRespDTO
>
list
;
/**
* 总量
*/
private
Integer
total
;
}
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendUpdateReqDTO.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
recommend
.
dto
;
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
rpc
.
recommend
.
dto
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum
;
import
cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -10,21 +11,42 @@ import javax.validation.constraints.NotNull;
...
@@ -10,21 +11,42 @@ import javax.validation.constraints.NotNull;
import
java.io.Serializable
;
import
java.io.Serializable
;
/**
/**
* 商品推荐更新 DTO
* 商品推荐更新
Request
DTO
*/
*/
@Data
@Data
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
ProductRecommendUpdateReqDTO
implements
Serializable
{
public
class
ProductRecommendUpdateReqDTO
implements
Serializable
{
/**
* 编号
*/
@NotNull
(
message
=
"编号不能为空"
)
@NotNull
(
message
=
"编号不能为空"
)
private
Integer
id
;
private
Integer
id
;
@NotNull
(
message
=
"类型不能为空"
)
/**
* 推荐类型
*/
@InEnum
(
value
=
ProductRecommendTypeEnum
.
class
,
message
=
"修改推荐类型必须是 {value}"
)
@InEnum
(
value
=
ProductRecommendTypeEnum
.
class
,
message
=
"修改推荐类型必须是 {value}"
)
@NotNull
(
message
=
"推荐类型不能为空"
)
private
Integer
type
;
private
Integer
type
;
/**
* 商品编号
*/
@NotNull
(
message
=
"商品编号不能为空"
)
@NotNull
(
message
=
"商品编号不能为空"
)
private
Integer
productSpuId
;
private
Integer
productSpuId
;
/**
* 排序
*/
@NotNull
(
message
=
"排序不能为空"
)
@NotNull
(
message
=
"排序不能为空"
)
private
Integer
sort
;
private
Integer
sort
;
/**
* 状态
*/
@NotNull
(
message
=
"状态不能为空"
)
@InEnum
(
value
=
CommonStatusEnum
.
class
,
message
=
"修改状态必须是 {value}"
)
private
Integer
status
;
/**
* 备注
*/
@Length
(
max
=
255
,
message
=
"备注最大长度为 255 位"
)
@Length
(
max
=
255
,
message
=
"备注最大长度为 255 位"
)
private
String
memo
;
private
String
memo
;
...
...
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/banner/BannerConvert.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotionservice
.
convert
.
banner
;
package
cn
.
iocoder
.
mall
.
promotionservice
.
convert
.
banner
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerCreateReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerUpdateReqDTO
;
import
cn.iocoder.mall.promotionservice.dal.mysql.dataobject.banner.BannerDO
;
import
cn.iocoder.mall.promotionservice.dal.mysql.dataobject.banner.BannerDO
;
import
cn.iocoder.mall.promotionservice.service.banner.bo.BannerAddBO
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
cn.iocoder.mall.promotionservice.service.banner.bo.BannerBO
;
import
cn.iocoder.mall.promotionservice.service.banner.bo.BannerUpdateBO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapping
s
;
import
org.mapstruct.Mapping
;
import
org.mapstruct.factory.Mappers
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
import
java.util.List
;
...
@@ -15,16 +17,13 @@ public interface BannerConvert {
...
@@ -15,16 +17,13 @@ public interface BannerConvert {
BannerConvert
INSTANCE
=
Mappers
.
getMapper
(
BannerConvert
.
class
);
BannerConvert
INSTANCE
=
Mappers
.
getMapper
(
BannerConvert
.
class
);
@Mappings
({})
BannerDO
convert
(
BannerCreateReqDTO
bean
);
BannerBO
convertToBO
(
BannerDO
banner
);
@Mappings
({})
BannerDO
convert
(
BannerUpdateReqDTO
bean
);
List
<
BannerBO
>
convertToBO
(
List
<
BannerDO
>
bannerList
);
@Mapping
s
({}
)
@Mapping
(
source
=
"records"
,
target
=
"list"
)
BannerDO
convert
(
BannerAddBO
bannerAddDTO
);
PageResult
<
BannerRespDTO
>
convertPage
(
IPage
<
BannerDO
>
page
);
@Mappings
({})
List
<
BannerRespDTO
>
convertList
(
List
<
BannerDO
>
list
);
BannerDO
convert
(
BannerUpdateBO
bannerUpdateDTO
);
}
}
\ No newline at end of file
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/recommend/ProductRecommendConvert.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotionservice
.
convert
.
recommend
;
package
cn
.
iocoder
.
mall
.
promotionservice
.
convert
.
recommend
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendCreateReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendRespDTO
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendRespDTO
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendUpdateReqDTO
;
import
cn.iocoder.mall.promotionservice.dal.mysql.dataobject.recommend.ProductRecommendDO
;
import
cn.iocoder.mall.promotionservice.dal.mysql.dataobject.recommend.ProductRecommendDO
;
import
cn.iocoder.mall.promotionservice.service.recommend.bo.ProductRecommendAddBO
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
cn.iocoder.mall.promotionservice.service.recommend.bo.ProductRecommendBO
;
import
cn.iocoder.mall.promotionservice.service.recommend.bo.ProductRecommendUpdateBO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapping
s
;
import
org.mapstruct.Mapping
;
import
org.mapstruct.factory.Mappers
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
import
java.util.List
;
...
@@ -16,19 +17,13 @@ public interface ProductRecommendConvert {
...
@@ -16,19 +17,13 @@ public interface ProductRecommendConvert {
ProductRecommendConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductRecommendConvert
.
class
);
ProductRecommendConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductRecommendConvert
.
class
);
@Mappings
({})
List
<
ProductRecommendRespDTO
>
convertList
(
List
<
ProductRecommendDO
>
list
);
ProductRecommendBO
convertToBO
(
ProductRecommendDO
recommend
);
@Mapping
s
({}
)
@Mapping
(
source
=
"records"
,
target
=
"list"
)
List
<
ProductRecommendBO
>
convertToBO
(
List
<
ProductRecommendDO
>
recommendList
);
PageResult
<
ProductRecommendRespDTO
>
convertPage
(
IPage
<
ProductRecommendDO
>
page
);
@Mappings
({})
ProductRecommendDO
convert
(
ProductRecommendCreateReqDTO
bean
);
List
<
ProductRecommendRespDTO
>
convertToDTO
(
List
<
ProductRecommendDO
>
recommendList
);
@Mappings
({})
ProductRecommendDO
convert
(
ProductRecommendUpdateReqDTO
bean
);
ProductRecommendDO
convert
(
ProductRecommendAddBO
recommendAddDTO
);
@Mappings
({})
ProductRecommendDO
convert
(
ProductRecommendUpdateBO
recommendUpdateDTO
);
}
}
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/banner/BannerDO.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotionservice
.
dal
.
mysql
.
dataobject
.
banner
;
package
cn
.
iocoder
.
mall
.
promotionservice
.
dal
.
mysql
.
dataobject
.
banner
;
import
cn.iocoder.mall.mybatis.core.dataobject.DeletableDO
;
import
cn.iocoder.mall.mybatis.core.dataobject.DeletableDO
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
/**
/**
* Banner 广告页
* Banner 广告页
*/
*/
@TableName
(
"banner"
)
@Data
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
BannerDO
extends
DeletableDO
{
public
class
BannerDO
extends
DeletableDO
{
...
...
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/recommend/ProductRecommendDO.java
浏览文件 @
f0999eac
...
@@ -3,12 +3,14 @@ package cn.iocoder.mall.promotionservice.dal.mysql.dataobject.recommend;
...
@@ -3,12 +3,14 @@ package cn.iocoder.mall.promotionservice.dal.mysql.dataobject.recommend;
import
cn.iocoder.mall.mybatis.core.dataobject.DeletableDO
;
import
cn.iocoder.mall.mybatis.core.dataobject.DeletableDO
;
import
cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum
;
import
cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
/**
/**
* 商品推荐 DO
* 商品推荐 DO
*/
*/
@TableName
(
"product_recommend"
)
@Data
@Data
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
ProductRecommendDO
extends
DeletableDO
{
public
class
ProductRecommendDO
extends
DeletableDO
{
...
...
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/banner/BannerMapper.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotionservice
.
dal
.
mysql
.
mapper
.
banner
;
package
cn
.
iocoder
.
mall
.
promotionservice
.
dal
.
mysql
.
mapper
.
banner
;
import
cn.iocoder.mall.mybatis.core.query.QueryWrapperX
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerListReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerPageReqDTO
;
import
cn.iocoder.mall.promotionservice.dal.mysql.dataobject.banner.BannerDO
;
import
cn.iocoder.mall.promotionservice.dal.mysql.dataobject.banner.BannerDO
;
import
org.apache.ibatis.annotations.Param
;
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
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.List
;
@Repository
@Repository
public
interface
BannerMapper
{
public
interface
BannerMapper
extends
BaseMapper
<
BannerDO
>
{
BannerDO
selectById
(
@Param
(
"id"
)
Integer
id
);
default
List
<
BannerDO
>
selectList
(
BannerListReqDTO
listReqDTO
)
{
return
selectList
(
new
QueryWrapperX
<
BannerDO
>().
eqIfPresent
(
"status"
,
listReqDTO
.
getStatus
()));
}
List
<
BannerDO
>
selectListByStatus
(
@Param
(
"status"
)
Integer
status
);
default
IPage
<
BannerDO
>
selectPage
(
BannerPageReqDTO
pageReqDTO
)
{
return
selectPage
(
new
Page
<>(
pageReqDTO
.
getPageNo
(),
pageReqDTO
.
getPageSize
()),
new
QueryWrapperX
<
BannerDO
>().
likeIfPresent
(
"title"
,
pageReqDTO
.
getTitle
()));
}
List
<
BannerDO
>
selectListByTitleLike
(
@Param
(
"title"
)
String
title
,
}
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"limit"
)
Integer
limit
);
Integer
selectCountByTitleLike
(
@Param
(
"title"
)
String
title
);
void
insert
(
BannerDO
bannerDO
);
int
update
(
BannerDO
bannerDO
);
}
\ No newline at end of file
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/recommend/ProductRecommendMapper.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotionservice
.
dal
.
mysql
.
mapper
.
recommend
;
package
cn
.
iocoder
.
mall
.
promotionservice
.
dal
.
mysql
.
mapper
.
recommend
;
import
cn.iocoder.mall.mybatis.core.query.QueryWrapperX
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendListReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendPageReqDTO
;
import
cn.iocoder.mall.promotionservice.dal.mysql.dataobject.recommend.ProductRecommendDO
;
import
cn.iocoder.mall.promotionservice.dal.mysql.dataobject.recommend.ProductRecommendDO
;
import
org.apache.ibatis.annotations.Param
;
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
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.List
;
@Repository
@Repository
public
interface
ProductRecommendMapper
{
public
interface
ProductRecommendMapper
extends
BaseMapper
<
ProductRecommendDO
>
{
ProductRecommendDO
selectById
(
@Param
(
"id"
)
Integer
id
);
default
ProductRecommendDO
selectByProductSpuIdAndType
(
Integer
productSpuId
,
Integer
type
)
{
return
selectOne
(
new
QueryWrapper
<
ProductRecommendDO
>().
eq
(
"product_spu_id"
,
productSpuId
)
.
eq
(
"type"
,
type
));
}
ProductRecommendDO
selectByProductSpuIdAndType
(
@Param
(
"productSpuId"
)
Integer
productSpuId
,
default
List
<
ProductRecommendDO
>
selectList
(
ProductRecommendListReqDTO
listReqDTO
)
{
@Param
(
"type"
)
Integer
type
);
return
selectList
(
new
QueryWrapperX
<
ProductRecommendDO
>().
eqIfPresent
(
"type"
,
listReqDTO
.
getType
())
.
eqIfPresent
(
"status"
,
listReqDTO
.
getStatus
()));
}
List
<
ProductRecommendDO
>
selectListByTypeAndStatus
(
@Param
(
"type"
)
Integer
type
,
default
IPage
<
ProductRecommendDO
>
selectPage
(
ProductRecommendPageReqDTO
pageReqDTO
)
{
@Param
(
"status"
)
Integer
status
);
return
selectPage
(
new
Page
<>(
pageReqDTO
.
getPageNo
(),
pageReqDTO
.
getPageSize
()),
new
QueryWrapperX
<
ProductRecommendDO
>().
eqIfPresent
(
"type"
,
pageReqDTO
.
getType
()));
}
List
<
ProductRecommendDO
>
selectPageByType
(
@Param
(
"type"
)
Integer
type
,
}
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"limit"
)
Integer
limit
);
Integer
selectCountByType
(
@Param
(
"type"
)
Integer
type
);
void
insert
(
ProductRecommendDO
bannerDO
);
int
update
(
ProductRecommendDO
bannerDO
);
}
\ No newline at end of file
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/banner/BannerManager.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotionservice
.
manager
.
banner
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.*
;
import
cn.iocoder.mall.promotionservice.service.banner.BannerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.validation.Valid
;
import
java.util.List
;
/**
* Banner Manager
*/
@Service
@Valid
public
class
BannerManager
{
@Autowired
private
BannerService
bannerService
;
public
Integer
createBanner
(
BannerCreateReqDTO
createDTO
)
{
return
bannerService
.
createBanner
(
createDTO
);
}
public
void
updateBanner
(
BannerUpdateReqDTO
updateDTO
)
{
bannerService
.
updateBanner
(
updateDTO
);
}
public
void
deleteBanner
(
Integer
bannerId
)
{
bannerService
.
deleteBanner
(
bannerId
);
}
public
List
<
BannerRespDTO
>
listBanners
(
BannerListReqDTO
listDTO
)
{
return
bannerService
.
listBanners
(
listDTO
);
}
public
PageResult
<
BannerRespDTO
>
pageBanner
(
BannerPageReqDTO
pageDTO
)
{
return
bannerService
.
pageBanner
(
pageDTO
);
}
}
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/recommend/ProductRecommendManager.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotionservice
.
manager
.
recommend
;
import
cn.iocoder.common.framework.exception.util.ServiceExceptionUtil
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.productservice.rpc.spu.ProductSpuRpc
;
import
cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.*
;
import
cn.iocoder.mall.promotionservice.service.recommend.ProductRecommendService
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
java.util.List
;
import
static
cn
.
iocoder
.
mall
.
promotion
.
api
.
enums
.
PromotionErrorCodeConstants
.
PRODUCT_RECOMMEND_PRODUCT_NOT_EXISTS
;
/**
* 商品推荐 Manager
*/
@Service
@Validated
public
class
ProductRecommendManager
{
@DubboReference
(
validation
=
"true"
,
version
=
"${dubbo.consumer.ProductSpuRpc.version}"
)
private
ProductSpuRpc
productSpuRpc
;
@Autowired
private
ProductRecommendService
productRecommendService
;
public
List
<
ProductRecommendRespDTO
>
listProductRecommends
(
ProductRecommendListReqDTO
listReqDTO
)
{
return
productRecommendService
.
listProductRecommends
(
listReqDTO
);
}
public
PageResult
<
ProductRecommendRespDTO
>
pageProductRecommend
(
ProductRecommendPageReqDTO
pageReqDTO
)
{
return
productRecommendService
.
pageProductRecommend
(
pageReqDTO
);
}
public
Integer
createProductRecommend
(
ProductRecommendCreateReqDTO
createReqDTO
)
{
// 校验商品不存在
checkProductSpu
(
createReqDTO
.
getProductSpuId
());
// 创建商品推荐
return
productRecommendService
.
createProductRecommend
(
createReqDTO
);
}
public
void
updateProductRecommend
(
ProductRecommendUpdateReqDTO
updateReqDTO
)
{
// 校验商品不存在
checkProductSpu
(
updateReqDTO
.
getProductSpuId
());
// 更新商品推荐
productRecommendService
.
updateProductRecommend
(
updateReqDTO
);
}
public
void
deleteProductRecommend
(
Integer
productRecommendId
)
{
productRecommendService
.
deleteProductRecommend
(
productRecommendId
);
}
private
void
checkProductSpu
(
Integer
productSpuId
)
{
CommonResult
<
ProductSpuRespDTO
>
getProductSpuResult
=
productSpuRpc
.
getProductSpu
(
productSpuId
);
getProductSpuResult
.
checkError
();
if
(
getProductSpuResult
.
getData
()
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PRODUCT_RECOMMEND_PRODUCT_NOT_EXISTS
);
}
}
}
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/rpc/banner/BannerRpcImpl.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotionservice
.
rpc
.
banner
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.promotion.api.rpc.banner.BannerRpc
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.*
;
import
cn.iocoder.mall.promotionservice.manager.banner.BannerManager
;
import
org.apache.dubbo.config.annotation.DubboService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.List
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
@DubboService
public
class
BannerRpcImpl
implements
BannerRpc
{
@Autowired
private
BannerManager
bannerManager
;
@Override
public
CommonResult
<
Integer
>
createBanner
(
BannerCreateReqDTO
createDTO
)
{
return
success
(
bannerManager
.
createBanner
(
createDTO
));
}
@Override
public
CommonResult
<
Boolean
>
updateBanner
(
BannerUpdateReqDTO
updateDTO
)
{
bannerManager
.
updateBanner
(
updateDTO
);
return
success
(
true
);
}
@Override
public
CommonResult
<
Boolean
>
deleteBanner
(
Integer
bannerId
)
{
bannerManager
.
deleteBanner
(
bannerId
);
return
success
(
true
);
}
@Override
public
CommonResult
<
List
<
BannerRespDTO
>>
listBanners
(
BannerListReqDTO
listDTO
)
{
return
success
(
bannerManager
.
listBanners
(
listDTO
));
}
@Override
public
CommonResult
<
PageResult
<
BannerRespDTO
>>
pageBanner
(
BannerPageReqDTO
pageDTO
)
{
return
success
(
bannerManager
.
pageBanner
(
pageDTO
));
}
}
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/rpc/recommend/ProductRecommendRpcImpl.java
0 → 100644
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotionservice
.
rpc
.
recommend
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.ProductRecommendRpc
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.*
;
import
cn.iocoder.mall.promotionservice.manager.recommend.ProductRecommendManager
;
import
org.apache.dubbo.config.annotation.DubboService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.List
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
@DubboService
public
class
ProductRecommendRpcImpl
implements
ProductRecommendRpc
{
@Autowired
private
ProductRecommendManager
productRecommendManager
;
@Override
public
CommonResult
<
Integer
>
createProductRecommend
(
ProductRecommendCreateReqDTO
createDTO
)
{
return
success
(
productRecommendManager
.
createProductRecommend
(
createDTO
));
}
@Override
public
CommonResult
<
Boolean
>
updateProductRecommend
(
ProductRecommendUpdateReqDTO
updateDTO
)
{
productRecommendManager
.
updateProductRecommend
(
updateDTO
);
return
success
(
true
);
}
@Override
public
CommonResult
<
Boolean
>
deleteProductRecommend
(
Integer
productRecommendId
)
{
productRecommendManager
.
deleteProductRecommend
(
productRecommendId
);
return
success
(
true
);
}
@Override
public
CommonResult
<
List
<
ProductRecommendRespDTO
>>
listProductRecommends
(
ProductRecommendListReqDTO
listReqDTO
)
{
return
success
(
productRecommendManager
.
listProductRecommends
(
listReqDTO
));
}
@Override
public
CommonResult
<
PageResult
<
ProductRecommendRespDTO
>>
pageProductRecommend
(
ProductRecommendPageReqDTO
pageDTO
)
{
return
success
(
productRecommendManager
.
pageProductRecommend
(
pageDTO
));
}
}
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/banner/BannerService.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotionservice
.
service
.
banner
;
package
cn
.
iocoder
.
mall
.
promotionservice
.
service
.
banner
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.exception.util.ServiceExceptionUtil
;
import
cn.iocoder.common.framework.exception.util.ServiceExceptionUtil
;
import
cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeConstants
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.*
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerPageDTO
;
import
cn.iocoder.mall.promotionservice.convert.banner.BannerConvert
;
import
cn.iocoder.mall.promotionservice.convert.banner.BannerConvert
;
import
cn.iocoder.mall.promotionservice.dal.mysql.dataobject.banner.BannerDO
;
import
cn.iocoder.mall.promotionservice.dal.mysql.dataobject.banner.BannerDO
;
import
cn.iocoder.mall.promotionservice.dal.mysql.mapper.banner.BannerMapper
;
import
cn.iocoder.mall.promotionservice.dal.mysql.mapper.banner.BannerMapper
;
import
cn.iocoder.mall.promotionservice.service.banner.bo.BannerAddBO
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
cn.iocoder.mall.promotionservice.service.banner.bo.BannerBO
;
import
cn.iocoder.mall.promotionservice.service.banner.bo.BannerPageBO
;
import
cn.iocoder.mall.promotionservice.service.banner.bo.BannerUpdateBO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
java.util.*
;
import
javax.validation.Valid
;
import
java.util.List
;
import
static
cn
.
iocoder
.
mall
.
promotion
.
api
.
enums
.
PromotionErrorCodeConstants
.
BANNER_NOT_EXISTS
;
@Service
@Service
...
@@ -26,66 +24,69 @@ public class BannerService {
...
@@ -26,66 +24,69 @@ public class BannerService {
@Autowired
@Autowired
private
BannerMapper
bannerMapper
;
private
BannerMapper
bannerMapper
;
public
List
<
BannerBO
>
getBannerListByStatus
(
Integer
status
)
{
/**
List
<
BannerDO
>
banners
=
bannerMapper
.
selectListByStatus
(
status
);
* 获得 Banner 列表
return
BannerConvert
.
INSTANCE
.
convertToBO
(
banners
);
*
}
* @param listReqDTO Banner 列表查询
* @return Banner 列表
public
BannerPageBO
getBannerPage
(
BannerPageDTO
bannerPageDTO
)
{
*/
BannerPageBO
bannerPageBO
=
new
BannerPageBO
();
public
List
<
BannerRespDTO
>
listBanners
(
BannerListReqDTO
listReqDTO
)
{
// 查询分页数据
List
<
BannerDO
>
banners
=
bannerMapper
.
selectList
(
listReqDTO
);
int
offset
=
(
bannerPageDTO
.
getPageNo
()
-
1
)
*
bannerPageDTO
.
getPageSize
();
return
BannerConvert
.
INSTANCE
.
convertList
(
banners
);
bannerPageBO
.
setList
(
BannerConvert
.
INSTANCE
.
convertToBO
(
bannerMapper
.
selectListByTitleLike
(
bannerPageDTO
.
getTitle
(),
offset
,
bannerPageDTO
.
getPageSize
())));
// 查询分页总数
bannerPageBO
.
setTotal
(
bannerMapper
.
selectCountByTitleLike
(
bannerPageDTO
.
getTitle
()));
return
bannerPageBO
;
}
}
public
BannerBO
addBanner
(
Integer
adminId
,
BannerAddBO
bannerAddDTO
)
{
/**
// 保存到数据库
* 获得 Banner 分页
BannerDO
banner
=
BannerConvert
.
INSTANCE
.
convert
(
bannerAddDTO
).
setStatus
(
CommonStatusEnum
.
ENABLE
.
getValue
());
*
banner
.
setDeleted
(
DeletedStatusEnum
.
DELETED_NO
.
getValue
()).
setCreateTime
(
new
Date
());
* @param bannerPageDTO Banner 分页查询
bannerMapper
.
insert
(
banner
);
* @return Banner 分页结果
// 返回成功
*/
return
BannerConvert
.
INSTANCE
.
convertToBO
(
banner
);
public
PageResult
<
BannerRespDTO
>
pageBanner
(
BannerPageReqDTO
bannerPageDTO
)
{
IPage
<
BannerDO
>
bannerPage
=
bannerMapper
.
selectPage
(
bannerPageDTO
);
return
BannerConvert
.
INSTANCE
.
convertPage
(
bannerPage
);
}
}
public
Boolean
updateBanner
(
Integer
adminId
,
BannerUpdateBO
bannerUpdateDTO
)
{
/**
// 校验 Banner 存在
* 创建 Banner
if
(
bannerMapper
.
selectById
(
bannerUpdateDTO
.
getId
())
==
null
)
{
*
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeConstants
.
BANNER_NOT_EXISTS
.
getCode
());
* @param createReqDTO 创建 Banner 信息
}
* @return banner
// 更新到数据库
*/
BannerDO
updateBanner
=
BannerConvert
.
INSTANCE
.
convert
(
bannerUpdateDTO
);
public
Integer
createBanner
(
@Valid
BannerCreateReqDTO
createReqDTO
)
{
bannerMapper
.
update
(
updateBanner
);
// 插入到数据库
// 返回成功
BannerDO
bannerDO
=
BannerConvert
.
INSTANCE
.
convert
(
createReqDTO
);
return
true
;
bannerMapper
.
insert
(
bannerDO
);
// 返回
return
bannerDO
.
getId
();
}
}
public
Boolean
updateBannerStatus
(
Integer
adminId
,
Integer
bannerId
,
Integer
status
)
{
/**
// 校验 Banner 存在
* 更新 Banner
if
(
bannerMapper
.
selectById
(
bannerId
)
==
null
)
{
*
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeConstants
.
BANNER_NOT_EXISTS
.
getCode
());
* @param updateReqDTO 更新 Banner 信息
*/
public
void
updateBanner
(
@Valid
BannerUpdateReqDTO
updateReqDTO
)
{
// 校验更新的 Banner 是否存在
if
(
bannerMapper
.
selectById
(
updateReqDTO
.
getId
())
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
BANNER_NOT_EXISTS
);
}
}
// 更新到数据库
// 更新到数据库
BannerDO
updateBanner
=
new
BannerDO
().
setId
(
bannerId
).
setStatus
(
status
);
BannerDO
updateObject
=
BannerConvert
.
INSTANCE
.
convert
(
updateReqDTO
);
bannerMapper
.
update
(
updateBanner
);
bannerMapper
.
updateById
(
updateObject
);
// 返回成功
return
true
;
}
}
public
Boolean
deleteBanner
(
Integer
adminId
,
Integer
bannerId
)
{
/**
* 删除 Banner
*
* @param bannerId Banner 编号
*/
public
void
deleteBanner
(
Integer
bannerId
)
{
// 校验 Banner 存在
// 校验 Banner 存在
if
(
bannerMapper
.
selectById
(
bannerId
)
==
null
)
{
if
(
bannerMapper
.
selectById
(
bannerId
)
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeConstants
.
BANNER_NOT_EXISTS
.
getCode
()
);
throw
ServiceExceptionUtil
.
exception
(
BANNER_NOT_EXISTS
);
}
}
// 更新到数据库
// 更新到数据库
BannerDO
updateBanner
=
new
BannerDO
().
setId
(
bannerId
);
bannerMapper
.
deleteById
(
bannerId
);
updateBanner
.
setDeleted
(
DeletedStatusEnum
.
DELETED_YES
.
getValue
());
bannerMapper
.
update
(
updateBanner
);
// 返回成功
return
true
;
}
}
}
}
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/banner/bo/BannerBO.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotionservice
.
service
.
banner
.
bo
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* Banner BO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
BannerBO
implements
Serializable
{
/**
* 编号
*/
private
Integer
id
;
/**
* 标题
*/
private
String
title
;
/**
* 跳转链接
*/
private
String
url
;
/**
* 图片链接
*/
private
String
picUrl
;
/**
* 排序
*/
private
Integer
sort
;
/**
* 状态
*/
private
Integer
status
;
/**
* 备注
*/
private
String
memo
;
/**
* 创建时间
*/
private
Date
createTime
;
}
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/banner/bo/BannerPageBO.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotionservice
.
service
.
banner
.
bo
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* Banner 分页 DTO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
BannerPageBO
implements
Serializable
{
/**
* Banner 数组
*/
private
List
<
BannerBO
>
list
;
/**
* 总量
*/
private
Integer
total
;
}
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/recommend/ProductRecommendService.java
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotionservice
.
service
.
recommend
;
package
cn
.
iocoder
.
mall
.
promotionservice
.
service
.
recommend
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.exception.util.ServiceExceptionUtil
;
import
cn.iocoder.common.framework.exception.util.ServiceExceptionUtil
;
import
cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.productservice.rpc.spu.ProductSpuRpc
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.*
;
import
cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeConstants
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendPageReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendPageRespDTO
;
import
cn.iocoder.mall.promotionservice.convert.recommend.ProductRecommendConvert
;
import
cn.iocoder.mall.promotionservice.convert.recommend.ProductRecommendConvert
;
import
cn.iocoder.mall.promotionservice.dal.mysql.dataobject.recommend.ProductRecommendDO
;
import
cn.iocoder.mall.promotionservice.dal.mysql.dataobject.recommend.ProductRecommendDO
;
import
cn.iocoder.mall.promotionservice.dal.mysql.mapper.recommend.ProductRecommendMapper
;
import
cn.iocoder.mall.promotionservice.dal.mysql.mapper.recommend.ProductRecommendMapper
;
import
cn.iocoder.mall.promotionservice.service.recommend.bo.ProductRecommendAddBO
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
cn.iocoder.mall.promotionservice.service.recommend.bo.ProductRecommendBO
;
import
cn.iocoder.mall.promotionservice.service.recommend.bo.ProductRecommendUpdateBO
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
static
cn
.
iocoder
.
mall
.
promotion
.
api
.
enums
.
PromotionErrorCodeConstants
.
PRODUCT_RECOMMEND_EXISTS
;
import
static
cn
.
iocoder
.
mall
.
promotion
.
api
.
enums
.
PromotionErrorCodeConstants
.
PRODUCT_RECOMMEND_NOT_EXISTS
;
/**
* 商品推荐 Service
*/
@Service
@Service
@Validated
@Validated
public
class
ProductRecommendService
{
public
class
ProductRecommendService
{
@DubboReference
(
validation
=
"true"
,
version
=
"${dubbo.consumer.ProductSpuRpc.version}"
)
private
ProductSpuRpc
productSpuRpc
;
@Autowired
@Autowired
private
ProductRecommendMapper
productRecommendMapper
;
private
ProductRecommendMapper
productRecommendMapper
;
public
List
<
ProductRecommendBO
>
getProductRecommendList
(
Integer
type
,
Integer
status
)
{
/**
List
<
ProductRecommendDO
>
productRecommends
=
productRecommendMapper
.
selectListByTypeAndStatus
(
type
,
status
);
* 获得商品推荐列表
return
ProductRecommendConvert
.
INSTANCE
.
convertToBO
(
productRecommends
);
*
* @param listReqDTO 列表查询 DTO
* @return 商品推荐列表
*/
public
List
<
ProductRecommendRespDTO
>
listProductRecommends
(
ProductRecommendListReqDTO
listReqDTO
)
{
List
<
ProductRecommendDO
>
productRecommends
=
productRecommendMapper
.
selectList
(
listReqDTO
);
return
ProductRecommendConvert
.
INSTANCE
.
convertList
(
productRecommends
);
}
}
public
ProductRecommendPageRespDTO
getProductRecommendPage
(
ProductRecommendPageReqDTO
productRecommendPageDTO
)
{
/**
ProductRecommendPageRespDTO
productRecommendPageBO
=
new
ProductRecommendPageRespDTO
();
* 获得商品推荐分页
// 查询分页数据
*
int
offset
=
(
productRecommendPageDTO
.
getPageNo
()
-
1
)
*
productRecommendPageDTO
.
getPageSize
();
* @param pageReqDTO 分页查询 DTO
productRecommendPageBO
.
setList
(
ProductRecommendConvert
.
INSTANCE
.
convertToDTO
(
productRecommendMapper
.
selectPageByType
(
productRecommendPageDTO
.
getType
(),
* @return 商品推荐分页
offset
,
productRecommendPageDTO
.
getPageSize
())));
*/
// 查询分页总数
public
PageResult
<
ProductRecommendRespDTO
>
pageProductRecommend
(
ProductRecommendPageReqDTO
pageReqDTO
)
{
productRecommendPageBO
.
setTotal
(
productRecommendMapper
.
selectCountByType
(
productRecommendPageDTO
.
getType
())
);
IPage
<
ProductRecommendDO
>
productRecommendPage
=
productRecommendMapper
.
selectPage
(
pageReqDTO
);
return
productRecommendPageBO
;
return
ProductRecommendConvert
.
INSTANCE
.
convertPage
(
productRecommendPage
)
;
}
}
public
ProductRecommendBO
addProductRecommend
(
Integer
adminId
,
ProductRecommendAddBO
productRecommendAddDTO
)
{
/**
// 校验商品不存在
* 创建商品推荐
if
(
productSpuRpc
.
getProductSpu
(
productRecommendAddDTO
.
getProductSpuId
())
==
null
)
{
*
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeConstants
.
PRODUCT_RECOMMEND_PRODUCT_NOT_EXISTS
.
getCode
());
* @param createReqDTO 商品推荐信息
}
* @return 商品推荐编号
*/
public
Integer
createProductRecommend
(
ProductRecommendCreateReqDTO
createReqDTO
)
{
// 校验商品是否已经推荐
// 校验商品是否已经推荐
if
(
productRecommendMapper
.
selectByProductSpuIdAndType
(
productRecommendAddDTO
.
getProductSpuId
(),
productRecommendAdd
DTO
.
getType
())
!=
null
)
{
if
(
productRecommendMapper
.
selectByProductSpuIdAndType
(
createReqDTO
.
getProductSpuId
(),
createReq
DTO
.
getType
())
!=
null
)
{
throw
ServiceExceptionUtil
.
exception
(
P
romotionErrorCodeConstants
.
PRODUCT_RECOMMEND_EXISTS
.
getCode
()
);
throw
ServiceExceptionUtil
.
exception
(
P
RODUCT_RECOMMEND_EXISTS
);
}
}
// 保存到数据库
// 保存到数据库
ProductRecommendDO
productRecommend
=
ProductRecommendConvert
.
INSTANCE
.
convert
(
productRecommendAddDTO
).
setStatus
(
CommonStatusEnum
.
ENABLE
.
getValue
());
ProductRecommendDO
productRecommend
=
ProductRecommendConvert
.
INSTANCE
.
convert
(
createReqDTO
);
productRecommend
.
setDeleted
(
DeletedStatusEnum
.
DELETED_NO
.
getValue
()).
setCreateTime
(
new
Date
());
productRecommendMapper
.
insert
(
productRecommend
);
productRecommendMapper
.
insert
(
productRecommend
);
// 返回成功
// 返回成功
return
ProductRecommendConvert
.
INSTANCE
.
convertToBO
(
productRecommend
);
return
productRecommend
.
getId
(
);
}
}
public
Boolean
updateProductRecommend
(
Integer
adminId
,
ProductRecommendUpdateBO
productRecommendUpdate
DTO
)
{
public
void
updateProductRecommend
(
ProductRecommendUpdateReqDTO
updateReq
DTO
)
{
// 校验更新的商品推荐存在
// 校验更新的商品推荐存在
if
(
productRecommendMapper
.
selectById
(
productRecommendUpdateDTO
.
getId
())
==
null
)
{
if
(
productRecommendMapper
.
selectById
(
updateReqDTO
.
getId
())
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeConstants
.
PRODUCT_RECOMMEND_NOT_EXISTS
.
getCode
());
throw
ServiceExceptionUtil
.
exception
(
PRODUCT_RECOMMEND_NOT_EXISTS
);
}
// 校验商品不存在
if
(
productSpuRpc
.
getProductSpu
(
productRecommendUpdateDTO
.
getProductSpuId
())
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeConstants
.
PRODUCT_RECOMMEND_PRODUCT_NOT_EXISTS
.
getCode
());
}
}
// 校验商品是否已经推荐
// 校验商品是否已经推荐
ProductRecommendDO
existProductRecommend
=
productRecommendMapper
.
selectByProductSpuIdAndType
(
productRecommendUpdateDTO
.
getProductSpuId
(),
productRecommendUpdate
DTO
.
getType
());
ProductRecommendDO
existProductRecommend
=
productRecommendMapper
.
selectByProductSpuIdAndType
(
updateReqDTO
.
getProductSpuId
(),
updateReq
DTO
.
getType
());
if
(
existProductRecommend
!=
null
&&
!
existProductRecommend
.
getId
().
equals
(
productRecommendUpdate
DTO
.
getId
()))
{
if
(
existProductRecommend
!=
null
&&
!
existProductRecommend
.
getId
().
equals
(
updateReq
DTO
.
getId
()))
{
throw
ServiceExceptionUtil
.
exception
(
P
romotionErrorCodeConstants
.
P
RODUCT_RECOMMEND_EXISTS
.
getCode
());
throw
ServiceExceptionUtil
.
exception
(
PRODUCT_RECOMMEND_EXISTS
.
getCode
());
}
}
// 更新到数据库
// 更新到数据库
ProductRecommendDO
updateProductRecommend
=
ProductRecommendConvert
.
INSTANCE
.
convert
(
productRecommendUpdateDTO
);
ProductRecommendDO
updateProductRecommend
=
ProductRecommendConvert
.
INSTANCE
.
convert
(
updateReqDTO
);
productRecommendMapper
.
update
(
updateProductRecommend
);
productRecommendMapper
.
updateById
(
updateProductRecommend
);
// 返回成功
return
true
;
}
}
public
Boolean
updateProductRecommendStatus
(
Integer
adminId
,
Integer
productRecommendId
,
Integer
status
)
{
public
void
deleteProductRecommend
(
Integer
productRecommendId
)
{
// 校验更新的商品推荐存在
// 校验更新的商品推荐存在
if
(
productRecommendMapper
.
selectById
(
productRecommendId
)
==
null
)
{
if
(
productRecommendMapper
.
selectById
(
productRecommendId
)
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
P
romotionErrorCodeConstants
.
PRODUCT_RECOMMEND_NOT_EXISTS
.
getCode
()
);
throw
ServiceExceptionUtil
.
exception
(
P
RODUCT_RECOMMEND_NOT_EXISTS
);
}
}
// 更新到数据库
// 更新到数据库
ProductRecommendDO
updateProductRecommend
=
new
ProductRecommendDO
().
setId
(
productRecommendId
).
setStatus
(
status
);
productRecommendMapper
.
deleteById
(
productRecommendId
);
productRecommendMapper
.
update
(
updateProductRecommend
);
// 返回成功
return
true
;
}
public
Boolean
deleteProductRecommend
(
Integer
adminId
,
Integer
productRecommendId
)
{
// 校验更新的商品推荐存在
if
(
productRecommendMapper
.
selectById
(
productRecommendId
)
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeConstants
.
PRODUCT_RECOMMEND_NOT_EXISTS
.
getCode
());
}
// 更新到数据库
ProductRecommendDO
updateProductRecommend
=
new
ProductRecommendDO
().
setId
(
productRecommendId
);
updateProductRecommend
.
setDeleted
(
DeletedStatusEnum
.
DELETED_YES
.
getValue
());
productRecommendMapper
.
update
(
updateProductRecommend
);
// 返回成功
return
true
;
}
}
}
}
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/recommend/bo/ProductRecommendAddBO.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotionservice
.
service
.
recommend
.
bo
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* 商品推荐添加 DTO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductRecommendAddBO
implements
Serializable
{
@InEnum
(
value
=
ProductRecommendTypeEnum
.
class
,
message
=
"修改推荐类型必须是 {value}"
)
@NotNull
(
message
=
"推荐类型不能为空"
)
private
Integer
type
;
@NotNull
(
message
=
"商品编号不能为空"
)
private
Integer
productSpuId
;
@NotNull
(
message
=
"排序不能为空"
)
private
Integer
sort
;
@Length
(
max
=
255
,
message
=
"备注最大长度为 255 位"
)
private
String
memo
;
}
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/recommend/bo/ProductRecommendPageBO.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotionservice
.
service
.
recommend
.
bo
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* 商品推荐分页 DTO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductRecommendPageBO
implements
Serializable
{
/**
* 推荐类型
*/
private
Integer
type
;
@NotNull
(
message
=
"页码不能为空"
)
private
Integer
pageNo
;
@NotNull
(
message
=
"每页条数不能为空"
)
private
Integer
pageSize
;
}
promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/recommend/bo/ProductRecommendUpdateBO.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotionservice
.
service
.
recommend
.
bo
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* 商品推荐更新 DTO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductRecommendUpdateBO
implements
Serializable
{
@NotNull
(
message
=
"编号不能为空"
)
private
Integer
id
;
@NotNull
(
message
=
"类型不能为空"
)
@InEnum
(
value
=
ProductRecommendTypeEnum
.
class
,
message
=
"修改推荐类型必须是 {value}"
)
private
Integer
type
;
@NotNull
(
message
=
"商品编号不能为空"
)
private
Integer
productSpuId
;
@NotNull
(
message
=
"排序不能为空"
)
private
Integer
sort
;
@Length
(
max
=
255
,
message
=
"备注最大长度为 255 位"
)
private
String
memo
;
}
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/convert/BannerConvert.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotion
.
biz
.
convert
;
import
cn.iocoder.mall.promotion.api.bo.BannerBO
;
import
cn.iocoder.mall.promotion.api.dto.BannerAddDTO
;
import
cn.iocoder.mall.promotion.api.dto.BannerUpdateDTO
;
import
cn.iocoder.mall.promotion.biz.dataobject.BannerDO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
@Mapper
public
interface
BannerConvert
{
BannerConvert
INSTANCE
=
Mappers
.
getMapper
(
BannerConvert
.
class
);
@Mappings
({})
BannerBO
convertToBO
(
BannerDO
banner
);
@Mappings
({})
List
<
BannerBO
>
convertToBO
(
List
<
BannerDO
>
bannerList
);
@Mappings
({})
BannerDO
convert
(
BannerAddDTO
bannerAddDTO
);
@Mappings
({})
BannerDO
convert
(
BannerUpdateDTO
bannerUpdateDTO
);
}
\ No newline at end of file
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/convert/ProductRecommendConvert.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotion
.
biz
.
convert
;
import
cn.iocoder.mall.promotion.api.bo.ProductRecommendBO
;
import
cn.iocoder.mall.promotion.api.dto.ProductRecommendAddDTO
;
import
cn.iocoder.mall.promotion.api.dto.ProductRecommendUpdateDTO
;
import
cn.iocoder.mall.promotion.biz.dataobject.ProductRecommendDO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
@Mapper
public
interface
ProductRecommendConvert
{
ProductRecommendConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductRecommendConvert
.
class
);
@Mappings
({})
ProductRecommendBO
convertToBO
(
ProductRecommendDO
recommend
);
@Mappings
({})
List
<
ProductRecommendBO
>
convertToBO
(
List
<
ProductRecommendDO
>
recommendList
);
@Mappings
({})
ProductRecommendDO
convert
(
ProductRecommendAddDTO
recommendAddDTO
);
@Mappings
({})
ProductRecommendDO
convert
(
ProductRecommendUpdateDTO
recommendUpdateDTO
);
}
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dao/BannerMapper.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotion
.
biz
.
dao
;
import
cn.iocoder.mall.promotion.biz.dataobject.BannerDO
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
interface
BannerMapper
{
BannerDO
selectById
(
@Param
(
"id"
)
Integer
id
);
List
<
BannerDO
>
selectListByStatus
(
@Param
(
"status"
)
Integer
status
);
List
<
BannerDO
>
selectListByTitleLike
(
@Param
(
"title"
)
String
title
,
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"limit"
)
Integer
limit
);
Integer
selectCountByTitleLike
(
@Param
(
"title"
)
String
title
);
void
insert
(
BannerDO
bannerDO
);
int
update
(
BannerDO
bannerDO
);
}
\ No newline at end of file
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dao/ProductRecommendMapper.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotion
.
biz
.
dao
;
import
cn.iocoder.mall.promotion.biz.dataobject.ProductRecommendDO
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
interface
ProductRecommendMapper
{
ProductRecommendDO
selectById
(
@Param
(
"id"
)
Integer
id
);
ProductRecommendDO
selectByProductSpuIdAndType
(
@Param
(
"productSpuId"
)
Integer
productSpuId
,
@Param
(
"type"
)
Integer
type
);
List
<
ProductRecommendDO
>
selectListByTypeAndStatus
(
@Param
(
"type"
)
Integer
type
,
@Param
(
"status"
)
Integer
status
);
List
<
ProductRecommendDO
>
selectPageByType
(
@Param
(
"type"
)
Integer
type
,
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"limit"
)
Integer
limit
);
Integer
selectCountByType
(
@Param
(
"type"
)
Integer
type
);
void
insert
(
ProductRecommendDO
bannerDO
);
int
update
(
ProductRecommendDO
bannerDO
);
}
\ No newline at end of file
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/BannerServiceImpl.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotion
.
biz
.
service
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.util.ServiceExceptionUtil
;
import
cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum
;
import
cn.iocoder.mall.promotion.api.BannerService
;
import
cn.iocoder.mall.promotion.api.bo.BannerBO
;
import
cn.iocoder.mall.promotion.api.bo.BannerPageBO
;
import
cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeEnum
;
import
cn.iocoder.mall.promotion.api.dto.BannerAddDTO
;
import
cn.iocoder.mall.promotion.api.dto.BannerPageDTO
;
import
cn.iocoder.mall.promotion.api.dto.BannerUpdateDTO
;
import
cn.iocoder.mall.promotion.biz.convert.BannerConvert
;
import
cn.iocoder.mall.promotion.biz.dao.BannerMapper
;
import
cn.iocoder.mall.promotion.biz.dataobject.BannerDO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
@Service
// 实际上不用添加。添加的原因是,必须 Spring 报错提示
@org
.
apache
.
dubbo
.
config
.
annotation
.
Service
(
validation
=
"true"
,
version
=
"${dubbo.provider.BannerService.version}"
)
public
class
BannerServiceImpl
implements
BannerService
{
@Autowired
private
BannerMapper
bannerMapper
;
@Override
public
List
<
BannerBO
>
getBannerListByStatus
(
Integer
status
)
{
List
<
BannerDO
>
banners
=
bannerMapper
.
selectListByStatus
(
status
);
return
BannerConvert
.
INSTANCE
.
convertToBO
(
banners
);
}
@Override
public
BannerPageBO
getBannerPage
(
BannerPageDTO
bannerPageDTO
)
{
BannerPageBO
bannerPageBO
=
new
BannerPageBO
();
// 查询分页数据
int
offset
=
(
bannerPageDTO
.
getPageNo
()
-
1
)
*
bannerPageDTO
.
getPageSize
();
bannerPageBO
.
setList
(
BannerConvert
.
INSTANCE
.
convertToBO
(
bannerMapper
.
selectListByTitleLike
(
bannerPageDTO
.
getTitle
(),
offset
,
bannerPageDTO
.
getPageSize
())));
// 查询分页总数
bannerPageBO
.
setTotal
(
bannerMapper
.
selectCountByTitleLike
(
bannerPageDTO
.
getTitle
()));
return
bannerPageBO
;
}
@Override
public
BannerBO
addBanner
(
Integer
adminId
,
BannerAddDTO
bannerAddDTO
)
{
// 保存到数据库
BannerDO
banner
=
BannerConvert
.
INSTANCE
.
convert
(
bannerAddDTO
).
setStatus
(
CommonStatusEnum
.
ENABLE
.
getValue
());
banner
.
setDeleted
(
DeletedStatusEnum
.
DELETED_NO
.
getValue
()).
setCreateTime
(
new
Date
());
bannerMapper
.
insert
(
banner
);
// 返回成功
return
BannerConvert
.
INSTANCE
.
convertToBO
(
banner
);
}
@Override
public
Boolean
updateBanner
(
Integer
adminId
,
BannerUpdateDTO
bannerUpdateDTO
)
{
// 校验 Banner 存在
if
(
bannerMapper
.
selectById
(
bannerUpdateDTO
.
getId
())
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeEnum
.
BANNER_NOT_EXISTS
.
getCode
());
}
// 更新到数据库
BannerDO
updateBanner
=
BannerConvert
.
INSTANCE
.
convert
(
bannerUpdateDTO
);
bannerMapper
.
update
(
updateBanner
);
// 返回成功
return
true
;
}
@Override
public
Boolean
updateBannerStatus
(
Integer
adminId
,
Integer
bannerId
,
Integer
status
)
{
// 校验 Banner 存在
if
(
bannerMapper
.
selectById
(
bannerId
)
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeEnum
.
BANNER_NOT_EXISTS
.
getCode
());
}
// 更新到数据库
BannerDO
updateBanner
=
new
BannerDO
().
setId
(
bannerId
).
setStatus
(
status
);
bannerMapper
.
update
(
updateBanner
);
// 返回成功
return
true
;
}
@Override
public
Boolean
deleteBanner
(
Integer
adminId
,
Integer
bannerId
)
{
// 校验 Banner 存在
if
(
bannerMapper
.
selectById
(
bannerId
)
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeEnum
.
BANNER_NOT_EXISTS
.
getCode
());
}
// 更新到数据库
BannerDO
updateBanner
=
new
BannerDO
().
setId
(
bannerId
);
updateBanner
.
setDeleted
(
DeletedStatusEnum
.
DELETED_YES
.
getValue
());
bannerMapper
.
update
(
updateBanner
);
// 返回成功
return
true
;
}
}
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/ProductRecommendServiceImpl.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotion
.
biz
.
service
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.util.ServiceExceptionUtil
;
import
cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum
;
import
cn.iocoder.mall.product.rpc.api.ProductSpuRpc
;
import
cn.iocoder.mall.promotion.api.ProductRecommendService
;
import
cn.iocoder.mall.promotion.api.bo.ProductRecommendBO
;
import
cn.iocoder.mall.promotion.api.bo.ProductRecommendPageBO
;
import
cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeEnum
;
import
cn.iocoder.mall.promotion.api.dto.ProductRecommendAddDTO
;
import
cn.iocoder.mall.promotion.api.dto.ProductRecommendPageDTO
;
import
cn.iocoder.mall.promotion.api.dto.ProductRecommendUpdateDTO
;
import
cn.iocoder.mall.promotion.biz.convert.ProductRecommendConvert
;
import
cn.iocoder.mall.promotion.biz.dao.ProductRecommendMapper
;
import
cn.iocoder.mall.promotion.biz.dataobject.ProductRecommendDO
;
import
org.apache.dubbo.config.annotation.Reference
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
@Service
// 实际上不用添加。添加的原因是,必须 Spring 报错提示
@org
.
apache
.
dubbo
.
config
.
annotation
.
Service
(
validation
=
"true"
,
version
=
"${dubbo.provider.ProductRecommendService.version}"
)
public
class
ProductRecommendServiceImpl
implements
ProductRecommendService
{
@Reference
(
validation
=
"true"
,
version
=
"${dubbo.consumer.ProductSpuService.version}"
)
private
ProductSpuRpc
productSpuRpc
;
@Autowired
private
ProductRecommendMapper
productRecommendMapper
;
@Override
public
List
<
ProductRecommendBO
>
getProductRecommendList
(
Integer
type
,
Integer
status
)
{
List
<
ProductRecommendDO
>
productRecommends
=
productRecommendMapper
.
selectListByTypeAndStatus
(
type
,
status
);
return
ProductRecommendConvert
.
INSTANCE
.
convertToBO
(
productRecommends
);
}
@Override
public
ProductRecommendPageBO
getProductRecommendPage
(
ProductRecommendPageDTO
productRecommendPageDTO
)
{
ProductRecommendPageBO
productRecommendPageBO
=
new
ProductRecommendPageBO
();
// 查询分页数据
int
offset
=
(
productRecommendPageDTO
.
getPageNo
()
-
1
)
*
productRecommendPageDTO
.
getPageSize
();
productRecommendPageBO
.
setList
(
ProductRecommendConvert
.
INSTANCE
.
convertToBO
(
productRecommendMapper
.
selectPageByType
(
productRecommendPageDTO
.
getType
(),
offset
,
productRecommendPageDTO
.
getPageSize
())));
// 查询分页总数
productRecommendPageBO
.
setTotal
(
productRecommendMapper
.
selectCountByType
(
productRecommendPageDTO
.
getType
()));
return
productRecommendPageBO
;
}
@Override
public
ProductRecommendBO
addProductRecommend
(
Integer
adminId
,
ProductRecommendAddDTO
productRecommendAddDTO
)
{
// 校验商品不存在
if
(
productSpuRpc
.
getProductSpuDetail
(
productRecommendAddDTO
.
getProductSpuId
())
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeEnum
.
PRODUCT_RECOMMEND_PRODUCT_NOT_EXISTS
.
getCode
());
}
// 校验商品是否已经推荐
if
(
productRecommendMapper
.
selectByProductSpuIdAndType
(
productRecommendAddDTO
.
getProductSpuId
(),
productRecommendAddDTO
.
getType
())
!=
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeEnum
.
PRODUCT_RECOMMEND_EXISTS
.
getCode
());
}
// 保存到数据库
ProductRecommendDO
productRecommend
=
ProductRecommendConvert
.
INSTANCE
.
convert
(
productRecommendAddDTO
).
setStatus
(
CommonStatusEnum
.
ENABLE
.
getValue
());
productRecommend
.
setDeleted
(
DeletedStatusEnum
.
DELETED_NO
.
getValue
()).
setCreateTime
(
new
Date
());
productRecommendMapper
.
insert
(
productRecommend
);
// 返回成功
return
ProductRecommendConvert
.
INSTANCE
.
convertToBO
(
productRecommend
);
}
@Override
public
Boolean
updateProductRecommend
(
Integer
adminId
,
ProductRecommendUpdateDTO
productRecommendUpdateDTO
)
{
// 校验更新的商品推荐存在
if
(
productRecommendMapper
.
selectById
(
productRecommendUpdateDTO
.
getId
())
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeEnum
.
PRODUCT_RECOMMEND_NOT_EXISTS
.
getCode
());
}
// 校验商品不存在
if
(
productSpuRpc
.
getProductSpuDetail
(
productRecommendUpdateDTO
.
getProductSpuId
())
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeEnum
.
PRODUCT_RECOMMEND_PRODUCT_NOT_EXISTS
.
getCode
());
}
// 校验商品是否已经推荐
ProductRecommendDO
existProductRecommend
=
productRecommendMapper
.
selectByProductSpuIdAndType
(
productRecommendUpdateDTO
.
getProductSpuId
(),
productRecommendUpdateDTO
.
getType
());
if
(
existProductRecommend
!=
null
&&
!
existProductRecommend
.
getId
().
equals
(
productRecommendUpdateDTO
.
getId
()))
{
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeEnum
.
PRODUCT_RECOMMEND_EXISTS
.
getCode
());
}
// 更新到数据库
ProductRecommendDO
updateProductRecommend
=
ProductRecommendConvert
.
INSTANCE
.
convert
(
productRecommendUpdateDTO
);
productRecommendMapper
.
update
(
updateProductRecommend
);
// 返回成功
return
true
;
}
@Override
public
Boolean
updateProductRecommendStatus
(
Integer
adminId
,
Integer
productRecommendId
,
Integer
status
)
{
// 校验更新的商品推荐存在
if
(
productRecommendMapper
.
selectById
(
productRecommendId
)
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeEnum
.
PRODUCT_RECOMMEND_NOT_EXISTS
.
getCode
());
}
// 更新到数据库
ProductRecommendDO
updateProductRecommend
=
new
ProductRecommendDO
().
setId
(
productRecommendId
).
setStatus
(
status
);
productRecommendMapper
.
update
(
updateProductRecommend
);
// 返回成功
return
true
;
}
@Override
public
Boolean
deleteProductRecommend
(
Integer
adminId
,
Integer
productRecommendId
)
{
// 校验更新的商品推荐存在
if
(
productRecommendMapper
.
selectById
(
productRecommendId
)
==
null
)
{
throw
ServiceExceptionUtil
.
exception
(
PromotionErrorCodeEnum
.
PRODUCT_RECOMMEND_NOT_EXISTS
.
getCode
());
}
// 更新到数据库
ProductRecommendDO
updateProductRecommend
=
new
ProductRecommendDO
().
setId
(
productRecommendId
);
updateProductRecommend
.
setDeleted
(
DeletedStatusEnum
.
DELETED_YES
.
getValue
());
productRecommendMapper
.
update
(
updateProductRecommend
);
// 返回成功
return
true
;
}
}
promotion/promotion-service-impl/src/main/resources/mapper/BannerMapper.xml
deleted
100644 → 0
浏览文件 @
c94fae17
<?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.promotion.biz.dao.BannerMapper"
>
<sql
id=
"FIELDS"
>
id, title, url, pic_url, sort,
status, memo, create_time
</sql>
<!-- <select id="selectListByPidAndStatusOrderBySort" resultType="BannerDO">-->
<!-- SELECT-->
<!-- <include refid="FIELDS" />-->
<!-- FROM banner-->
<!-- WHERE pid = #{pid}-->
<!-- AND status = #{status}-->
<!-- AND deleted = 0-->
<!-- ORDER BY sort ASC-->
<!-- </select>-->
<!-- <select id="selectList" resultType="BannerDO">-->
<!-- SELECT-->
<!-- <include refid="FIELDS" />-->
<!-- FROM banner-->
<!-- WHERE deleted = 0-->
<!-- </select>-->
<select
id=
"selectById"
parameterType=
"Integer"
resultType=
"BannerDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM banner
WHERE id = #{id}
AND deleted = 0
</select>
<select
id=
"selectListByStatus"
parameterType=
"Integer"
resultType=
"BannerDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM banner
<where>
<if
test=
"status != null"
>
status = #{status}
</if>
AND deleted = 0
</where>
</select>
<select
id=
"selectListByTitleLike"
resultType=
"BannerDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM banner
<where>
<if
test=
"title != null"
>
title LIKE "%"#{title}"%"
</if>
AND deleted = 0
</where>
LIMIT #{offset}, #{limit}
</select>
<select
id=
"selectCountByTitleLike"
resultType=
"Integer"
>
SELECT
COUNT(1)
FROM banner
<where>
<if
test=
"title != null"
>
title LIKE "%"#{title}"%"
</if>
AND deleted = 0
</where>
</select>
<insert
id=
"insert"
parameterType=
"BannerDO"
useGeneratedKeys=
"true"
keyColumn=
"id"
keyProperty=
"id"
>
INSERT INTO banner (
title, url, pic_url, sort, status,
memo, create_time, deleted
) VALUES (
#{title}, #{url}, #{picUrl}, #{sort}, #{status},
#{memo}, #{createTime}, #{deleted}
)
</insert>
<update
id=
"update"
parameterType=
"BannerDO"
>
UPDATE banner
<set>
<if
test=
"title != null"
>
title = #{title},
</if>
<if
test=
"url != null"
>
url = #{url},
</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=
"memo != null"
>
memo = #{memo},
</if>
<if
test=
"deleted != null"
>
deleted = #{deleted}
</if>
</set>
WHERE id = #{id}
</update>
</mapper>
\ No newline at end of file
promotion/promotion-service-impl/src/main/resources/mapper/ProductRecommendMapper.xml
deleted
100644 → 0
浏览文件 @
c94fae17
<?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.promotion.biz.dao.ProductRecommendMapper"
>
<sql
id=
"FIELDS"
>
id, type, product_spu_id, sort,
status, memo, create_time
</sql>
<!-- <select id="selectListByPidAndStatusOrderBySort" resultType="ProductRecommendDO">-->
<!-- SELECT-->
<!-- <include refid="FIELDS" />-->
<!-- FROM product_recommend-->
<!-- WHERE pid = #{pid}-->
<!-- AND status = #{status}-->
<!-- AND deleted = 0-->
<!-- ORDER BY sort ASC-->
<!-- </select>-->
<!-- <select id="selectList" resultType="ProductRecommendDO">-->
<!-- SELECT-->
<!-- <include refid="FIELDS" />-->
<!-- FROM product_recommend-->
<!-- WHERE deleted = 0-->
<!-- </select>-->
<select
id=
"selectById"
parameterType=
"Integer"
resultType=
"ProductRecommendDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_recommend
WHERE id = #{id}
AND deleted = 0
</select>
<select
id=
"selectByProductSpuIdAndType"
resultType=
"ProductRecommendDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_recommend
<where>
<if
test=
"productSpuId != null"
>
product_spu_id = #{productSpuId}
</if>
<if
test=
"type != null"
>
AND type = #{type}
</if>
AND deleted = 0
</where>
</select>
<select
id=
"selectListByTypeAndStatus"
parameterType=
"Integer"
resultType=
"ProductRecommendDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_recommend
<where>
<if
test=
"type != null"
>
type = #{type}
</if>
<if
test=
"status != null"
>
AND status = #{status}
</if>
AND deleted = 0
</where>
</select>
<select
id=
"selectPageByType"
resultType=
"ProductRecommendDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_recommend
<where>
<if
test=
"type != null"
>
type = #{type}
</if>
AND deleted = 0
</where>
LIMIT #{offset}, #{limit}
</select>
<select
id=
"selectCountByType"
resultType=
"Integer"
>
SELECT
COUNT(1)
FROM product_recommend
<where>
<if
test=
"type != null"
>
type = #{type}
</if>
AND deleted = 0
</where>
</select>
<insert
id=
"insert"
parameterType=
"ProductRecommendDO"
useGeneratedKeys=
"true"
keyColumn=
"id"
keyProperty=
"id"
>
INSERT INTO product_recommend (
type, product_spu_id, sort, status, memo,
create_time, deleted
) VALUES (
#{type}, #{productSpuId}, #{sort}, #{status}, #{memo},
#{createTime}, #{deleted}
)
</insert>
<update
id=
"update"
parameterType=
"ProductRecommendDO"
>
UPDATE product_recommend
<set>
<if
test=
"type != null"
>
type = #{type},
</if>
<if
test=
"productSpuId != null"
>
product_spu_id = #{productSpuId},
</if>
<if
test=
"sort != null"
>
sort = #{sort},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"memo != null"
>
memo = #{memo},
</if>
<if
test=
"deleted != null"
>
deleted = #{deleted}
</if>
</set>
WHERE id = #{id}
</update>
</mapper>
\ No newline at end of file
promotion/promotion-start/pom.xml
deleted
100644 → 0
浏览文件 @
c94fae17
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
promotion
</artifactId>
<groupId>
cn.iocoder.mall
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
promotion-start
</artifactId>
<dependencies>
<!-- Mall 相关 -->
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
common-framework
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
mall-spring-boot
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
product-service-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
promotion-service-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
promotion-service-impl
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
user-service-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
user-sdk
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
system-sdk
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
mall-spring-boot-starter-mybatis
</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
</dependency>
<dependency>
<groupId>
com.github.xiaoymin
</groupId>
<artifactId>
swagger-bootstrap-ui
</artifactId>
</dependency>
<!-- 服务保障相关 -->
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-sentinel
</artifactId>
</dependency>
<!-- 监控 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
io.micrometer
</groupId>
<artifactId>
micrometer-registry-prometheus
</artifactId>
</dependency>
<!-- 测试相关 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
mall-spring-boot-starter-security
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
mall-spring-boot-starter-security
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- 提供给 mapstruct 使用 -->
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
</plugin>
<!-- 打包 -->
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsBannerController.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
controller
.
admins
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.promotion.api.BannerService
;
import
cn.iocoder.mall.promotion.api.bo.BannerPageBO
;
import
cn.iocoder.mall.promotion.api.dto.BannerAddDTO
;
import
cn.iocoder.mall.promotion.api.dto.BannerPageDTO
;
import
cn.iocoder.mall.promotion.api.dto.BannerUpdateDTO
;
import
cn.iocoder.mall.promotion.application.convert.BannerConvert
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerPageVO
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerVO
;
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/banner"
)
@Api
(
"Banner 模块"
)
public
class
AdminsBannerController
{
@Reference
(
validation
=
"true"
,
version
=
"${dubbo.provider.BannerService.version}"
)
private
BannerService
bannerService
;
@GetMapping
(
"/page"
)
@ApiOperation
(
value
=
"Banner 分页"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"title"
,
value
=
"标题,模糊匹配"
,
example
=
"活动 A"
),
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"页码,从 1 开始"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页条数"
,
required
=
true
,
example
=
"10"
),
})
public
CommonResult
<
AdminsBannerPageVO
>
page
(
@RequestParam
(
value
=
"title"
,
required
=
false
)
String
title
,
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
Integer
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
)
{
BannerPageBO
result
=
bannerService
.
getBannerPage
(
new
BannerPageDTO
().
setTitle
(
title
).
setPageNo
(
pageNo
).
setPageSize
(
pageSize
));
return
success
(
BannerConvert
.
ADMINS
.
convert3
(
result
));
}
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"创建 Banner"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"title"
,
value
=
"标题"
,
required
=
true
,
example
=
"活动A"
),
@ApiImplicitParam
(
name
=
"url"
,
value
=
"跳转链接"
,
required
=
true
,
example
=
"http://www.iocoder.cn"
),
@ApiImplicitParam
(
name
=
"picUrl"
,
value
=
"图片链接"
,
required
=
true
,
example
=
"http://www.iocoder.cn/01.jpg"
),
@ApiImplicitParam
(
name
=
"sort"
,
value
=
"排序"
,
required
=
true
,
example
=
"10"
),
@ApiImplicitParam
(
name
=
"memo"
,
value
=
"备注"
,
required
=
true
,
example
=
"活动很牛逼"
),
})
public
CommonResult
<
AdminsBannerVO
>
add
(
@RequestParam
(
"title"
)
String
title
,
@RequestParam
(
"url"
)
String
url
,
@RequestParam
(
"picUrl"
)
String
picUrl
,
@RequestParam
(
"sort"
)
Integer
sort
,
@RequestParam
(
value
=
"memo"
,
required
=
false
)
String
memo
)
{
BannerAddDTO
bannerAddDTO
=
new
BannerAddDTO
().
setTitle
(
title
).
setUrl
(
url
).
setPicUrl
(
picUrl
)
.
setSort
(
sort
).
setMemo
(
memo
);
return
success
(
BannerConvert
.
ADMINS
.
convert
(
bannerService
.
addBanner
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
bannerAddDTO
)));
}
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"更新 Banner"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"Banner 编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"url"
,
value
=
"跳转链接"
,
required
=
true
,
example
=
"http://www.iocoder.cn"
),
@ApiImplicitParam
(
name
=
"picUrl"
,
value
=
"图片链接"
,
required
=
true
,
example
=
"http://www.iocoder.cn/01.jpg"
),
@ApiImplicitParam
(
name
=
"sort"
,
value
=
"排序"
,
required
=
true
,
example
=
"10"
),
@ApiImplicitParam
(
name
=
"memo"
,
value
=
"备注"
,
required
=
true
,
example
=
"活动很牛逼"
),
})
public
CommonResult
<
Boolean
>
update
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"title"
)
String
title
,
@RequestParam
(
"url"
)
String
url
,
@RequestParam
(
"picUrl"
)
String
picUrl
,
@RequestParam
(
"sort"
)
Integer
sort
,
@RequestParam
(
value
=
"memo"
,
required
=
false
)
String
memo
)
{
BannerUpdateDTO
bannerUpdateDTO
=
new
BannerUpdateDTO
().
setId
(
id
).
setTitle
(
title
).
setUrl
(
url
).
setPicUrl
(
picUrl
)
.
setSort
(
sort
).
setMemo
(
memo
);
return
success
(
bannerService
.
updateBanner
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
bannerUpdateDTO
));
}
@PostMapping
(
"/update_status"
)
@ApiOperation
(
value
=
"更新 Banner 状态"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"Banner 编号"
,
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
(
bannerService
.
updateBannerStatus
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
id
,
status
));
}
@PostMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除 Banner"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"Banner 编号"
,
required
=
true
,
example
=
"1"
)
public
CommonResult
<
Boolean
>
delete
(
@RequestParam
(
"id"
)
Integer
id
)
{
return
success
(
bannerService
.
deleteBanner
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
id
));
}
}
promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsProductRecommendController.java
浏览文件 @
f0999eac
...
@@ -93,17 +93,6 @@ public class AdminsProductRecommendController {
...
@@ -93,17 +93,6 @@ public class AdminsProductRecommendController {
return
success
(
productRecommendService
.
updateProductRecommend
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
bannerUpdateDTO
));
return
success
(
productRecommendService
.
updateProductRecommend
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
bannerUpdateDTO
));
}
}
@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
(
productRecommendService
.
updateProductRecommendStatus
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
id
,
status
));
}
@PostMapping
(
"/delete"
)
@PostMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除商品推荐"
)
@ApiOperation
(
value
=
"删除商品推荐"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"商品推荐编号"
,
required
=
true
,
example
=
"1"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"商品推荐编号"
,
required
=
true
,
example
=
"1"
)
...
...
promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/convert/BannerConvert.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
convert
;
import
cn.iocoder.mall.promotion.api.bo.BannerBO
;
import
cn.iocoder.mall.promotion.api.bo.BannerPageBO
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerPageVO
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerVO
;
import
cn.iocoder.mall.promotion.application.vo.users.UsersBannerVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
public
interface
BannerConvert
{
Users
USERS
=
Mappers
.
getMapper
(
Users
.
class
);
Admins
ADMINS
=
Mappers
.
getMapper
(
Admins
.
class
);
@Mapper
interface
Admins
{
@Mappings
({})
AdminsBannerVO
convert
(
BannerBO
bannerBO
);
@Mappings
({})
AdminsBannerPageVO
convert3
(
BannerPageBO
bannerPageBO
);
}
@Mapper
interface
Users
{
@Mappings
({})
List
<
UsersBannerVO
>
convertList
(
List
<
BannerBO
>
banners
);
}
}
promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/convert/ProductRecommendConvert.java
deleted
100644 → 0
浏览文件 @
c94fae17
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
convert
;
import
cn.iocoder.mall.product.api.bo.ProductSpuBO
;
import
cn.iocoder.mall.promotion.api.bo.ProductRecommendBO
;
import
cn.iocoder.mall.promotion.api.bo.ProductRecommendPageBO
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendPageVO
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendVO
;
import
cn.iocoder.mall.promotion.application.vo.users.UsersProductRecommendVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
@Mapper
public
interface
ProductRecommendConvert
{
ProductRecommendConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductRecommendConvert
.
class
);
@Mappings
({})
AdminsProductRecommendVO
convert
(
ProductRecommendBO
bannerBO
);
@Mappings
({})
AdminsProductRecommendPageVO
convert
(
ProductRecommendPageBO
result
);
@Mappings
({})
UsersProductRecommendVO
convert
(
ProductSpuBO
productSpu
);
// @Mappings({})
// List<UsersProductRecommendVO> convertList(List<ProductRecommendBO> banners);
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论