Banner 的迁移
商品推荐的迁移
This commit is contained in:
@@ -1,28 +1,52 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.banner;
|
||||
|
||||
import cn.iocoder.common.framework.enums.CommonStatusEnum;
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO;
|
||||
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 cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.promotion.api.rpc.banner.dto.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Banner Rpc 接口
|
||||
*/
|
||||
public interface BannerRpc {
|
||||
|
||||
List<BannerRespDTO> getBannerListByStatus(Integer status);
|
||||
/**
|
||||
* 创建 Banner
|
||||
*
|
||||
* @param createDTO 创建 Banner DTO
|
||||
* @return Banner 编号
|
||||
*/
|
||||
CommonResult<Integer> createBanner(BannerCreateReqDTO createDTO);
|
||||
|
||||
BannerPageRespDTO getBannerPage(BannerPageDTO bannerPageDTO);
|
||||
/**
|
||||
* 更新 Banner
|
||||
*
|
||||
* @param updateDTO 更新 Banner DTO
|
||||
*/
|
||||
CommonResult<Boolean> updateBanner(BannerUpdateReqDTO updateDTO);
|
||||
|
||||
BannerRespDTO addBanner(Integer adminId, BannerAddReqDTO bannerAddDTO);
|
||||
/**
|
||||
* 删除 Banner
|
||||
*
|
||||
* @param bannerId Banner 编号
|
||||
*/
|
||||
CommonResult<Boolean> deleteBanner(Integer bannerId);
|
||||
|
||||
Boolean updateBanner(Integer adminId, BannerUpdateReqDTO bannerUpdateDTO);
|
||||
/**
|
||||
* 获得 Banner 列表
|
||||
*
|
||||
* @param listDTO Banner 列表查询 DTO
|
||||
* @return Banner 列表
|
||||
*/
|
||||
CommonResult<List<BannerRespDTO>> listBanners(BannerListReqDTO listDTO);
|
||||
|
||||
Boolean updateBannerStatus(Integer adminId, Integer bannerId,
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status);
|
||||
|
||||
Boolean deleteBanner(Integer adminId, Integer bannerId);
|
||||
/**
|
||||
* 获得 Banner 分页
|
||||
*
|
||||
* @param pageDTO Banner 分页查询
|
||||
* @return Banner 分页结果
|
||||
*/
|
||||
CommonResult<PageResult<BannerRespDTO>> pageBanner(BannerPageReqDTO pageDTO);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
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.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
@@ -10,25 +12,46 @@ import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Banner 添加 DTO
|
||||
* Banner 创建 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BannerAddReqDTO implements Serializable {
|
||||
public class BannerCreateReqDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@NotEmpty(message = "标题不能为空")
|
||||
@Length(min = 2, max = 32, message = "标题长度为 2-32 位")
|
||||
private String title;
|
||||
/**
|
||||
* 跳转链接
|
||||
*/
|
||||
@NotEmpty(message = "跳转链接不能为空")
|
||||
@URL(message = "跳转链接格式不正确")
|
||||
@Length(max = 255, message = "跳转链接最大长度为 255 位")
|
||||
private String url;
|
||||
/**
|
||||
* 图片链接
|
||||
*/
|
||||
@NotEmpty(message = "图片链接不能为空")
|
||||
@URL(message = "图片链接格式不正确")
|
||||
@Length(max = 255, message = "图片链接最大长度为 255 位")
|
||||
private String picUrl;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Length(max = 255, message = "备注最大长度为 255 位")
|
||||
private String memo;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.banner.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Banner 分页 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BannerPageDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 标题,模糊匹配
|
||||
*/
|
||||
private String title;
|
||||
|
||||
@NotNull(message = "页码不能为空")
|
||||
private Integer pageNo;
|
||||
@NotNull(message = "每页条数不能为空")
|
||||
private Integer pageSize;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.banner.dto;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageParam;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* Banner 分页 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class BannerPageReqDTO extends PageParam {
|
||||
|
||||
/**
|
||||
* 标题,模糊匹配
|
||||
*/
|
||||
private String title;
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Banner BO
|
||||
* Banner Response DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
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.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
@@ -10,27 +12,51 @@ import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Banner 更新 DTO
|
||||
* Banner 更新 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BannerUpdateReqDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Integer id;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@NotEmpty(message = "标题不能为空")
|
||||
@Length(min = 2, max = 32, message = "标题长度为 2-32 位")
|
||||
private String title;
|
||||
/**
|
||||
* 跳转链接
|
||||
*/
|
||||
@NotEmpty(message = "跳转链接不能为空")
|
||||
@URL(message = "跳转链接格式不正确")
|
||||
@Length(max = 255, message = "跳转链接最大长度为 255 位")
|
||||
private String url;
|
||||
/**
|
||||
* 图片链接
|
||||
*/
|
||||
@NotEmpty(message = "图片链接不能为空")
|
||||
@URL(message = "图片链接格式不正确")
|
||||
@Length(max = 255, message = "图片链接最大长度为 255 位")
|
||||
private String picUrl;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Length(max = 255, message = "备注最大长度为 255 位")
|
||||
private String memo;
|
||||
|
||||
|
||||
@@ -1,24 +1,52 @@
|
||||
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.exception.ServiceException;
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.promotion.api.rpc.recommend.dto.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品推荐 Rpc 接口
|
||||
*/
|
||||
public interface ProductRecommendRpc {
|
||||
|
||||
List<ProductRecommendRespDTO> getProductRecommendList(Integer type, Integer status);
|
||||
/**
|
||||
* 创建商品推荐
|
||||
*
|
||||
* @param createDTO 创建商品推荐 DTO
|
||||
* @return 商品推荐编号
|
||||
*/
|
||||
CommonResult<Integer> createProductRecommend(ProductRecommendCreateReqDTO createDTO);
|
||||
|
||||
ProductRecommendPageRespDTO getProductRecommendPage(ProductRecommendPageReqDTO productRecommendPageDTO);
|
||||
/**
|
||||
* 更新商品推荐
|
||||
*
|
||||
* @param updateDTO 更新商品推荐 DTO
|
||||
*/
|
||||
CommonResult<Boolean> updateProductRecommend(ProductRecommendUpdateReqDTO updateDTO);
|
||||
|
||||
ProductRecommendRespDTO addProductRecommend(Integer adminId, ProductRecommendAddReqDTO productRecommendAddDTO) throws ServiceException;
|
||||
/**
|
||||
* 删除商品推荐
|
||||
*
|
||||
* @param productRecommendId 商品推荐编号
|
||||
*/
|
||||
CommonResult<Boolean> deleteProductRecommend(Integer productRecommendId);
|
||||
|
||||
Boolean updateProductRecommend(Integer adminId, ProductRecommendUpdateReqDTO productRecommendUpdateDTO) throws ServiceException;
|
||||
/**
|
||||
* 获得商品推荐列表
|
||||
*
|
||||
* @param listReqDTO 商品推荐列表查询 DTO
|
||||
* @return 商品推荐列表
|
||||
*/
|
||||
CommonResult<List<ProductRecommendRespDTO>> listProductRecommends(ProductRecommendListReqDTO listReqDTO);
|
||||
|
||||
Boolean updateProductRecommendStatus(Integer adminId, Integer productRecommendId,
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status) throws ServiceException;
|
||||
|
||||
Boolean deleteProductRecommend(Integer adminId, Integer productRecommendId);
|
||||
/**
|
||||
* 获得商品推荐分页
|
||||
*
|
||||
* @param pageDTO 商品推荐分页查询
|
||||
* @return 商品推荐分页结果
|
||||
*/
|
||||
CommonResult<PageResult<ProductRecommendRespDTO>> pageProductRecommend(ProductRecommendPageReqDTO pageDTO);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum;
|
||||
import lombok.Data;
|
||||
@@ -10,19 +11,37 @@ import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 商品推荐添加 DTO
|
||||
* 商品推荐创建 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductRecommendAddReqDTO implements Serializable {
|
||||
public class ProductRecommendCreateReqDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 推荐类型
|
||||
*/
|
||||
@InEnum(value = ProductRecommendTypeEnum.class, message = "修改推荐类型必须是 {value}")
|
||||
@NotNull(message = "推荐类型不能为空")
|
||||
private Integer type;
|
||||
/**
|
||||
* 商品编号
|
||||
*/
|
||||
@NotNull(message = "商品编号不能为空")
|
||||
private Integer productSpuId;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Length(max = 255, message = "备注最大长度为 255 位")
|
||||
private String memo;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
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.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 商品推荐列表 Req DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductRecommendListReqDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@InEnum(value = ProductRecommendTypeEnum.class, message = "推荐类型必须是 {value}")
|
||||
private Integer type;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -1,26 +1,24 @@
|
||||
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.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 商品推荐分页 DTO
|
||||
* 商品推荐分页 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class ProductRecommendPageReqDTO implements Serializable {
|
||||
public class ProductRecommendPageReqDTO extends PageParam {
|
||||
|
||||
/**
|
||||
* 推荐类型
|
||||
*/
|
||||
@InEnum(value = ProductRecommendTypeEnum.class, message = "推荐类型必须是 {value}")
|
||||
private Integer type;
|
||||
|
||||
@NotNull(message = "页码不能为空")
|
||||
private Integer pageNo;
|
||||
@NotNull(message = "每页条数不能为空")
|
||||
private Integer pageSize;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
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.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum;
|
||||
import lombok.Data;
|
||||
@@ -10,21 +11,42 @@ import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 商品推荐更新 DTO
|
||||
* 商品推荐更新 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductRecommendUpdateReqDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Integer id;
|
||||
@NotNull(message = "类型不能为空")
|
||||
/**
|
||||
* 推荐类型
|
||||
*/
|
||||
@InEnum(value = ProductRecommendTypeEnum.class, message = "修改推荐类型必须是 {value}")
|
||||
@NotNull(message = "推荐类型不能为空")
|
||||
private Integer type;
|
||||
/**
|
||||
* 商品编号
|
||||
*/
|
||||
@NotNull(message = "商品编号不能为空")
|
||||
private Integer productSpuId;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Length(max = 255, message = "备注最大长度为 255 位")
|
||||
private String memo;
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
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.service.banner.bo.BannerAddBO;
|
||||
import cn.iocoder.mall.promotionservice.service.banner.bo.BannerBO;
|
||||
import cn.iocoder.mall.promotionservice.service.banner.bo.BannerUpdateBO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
@@ -15,16 +17,13 @@ public interface BannerConvert {
|
||||
|
||||
BannerConvert INSTANCE = Mappers.getMapper(BannerConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
BannerBO convertToBO(BannerDO banner);
|
||||
BannerDO convert(BannerCreateReqDTO bean);
|
||||
|
||||
@Mappings({})
|
||||
List<BannerBO> convertToBO(List<BannerDO> bannerList);
|
||||
BannerDO convert(BannerUpdateReqDTO bean);
|
||||
|
||||
@Mappings({})
|
||||
BannerDO convert(BannerAddBO bannerAddDTO);
|
||||
@Mapping(source = "records", target = "list")
|
||||
PageResult<BannerRespDTO> convertPage(IPage<BannerDO> page);
|
||||
|
||||
@Mappings({})
|
||||
BannerDO convert(BannerUpdateBO bannerUpdateDTO);
|
||||
List<BannerRespDTO> convertList(List<BannerDO> list);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
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.ProductRecommendUpdateReqDTO;
|
||||
import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.recommend.ProductRecommendDO;
|
||||
import cn.iocoder.mall.promotionservice.service.recommend.bo.ProductRecommendAddBO;
|
||||
import cn.iocoder.mall.promotionservice.service.recommend.bo.ProductRecommendBO;
|
||||
import cn.iocoder.mall.promotionservice.service.recommend.bo.ProductRecommendUpdateBO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
@@ -16,19 +17,13 @@ public interface ProductRecommendConvert {
|
||||
|
||||
ProductRecommendConvert INSTANCE = Mappers.getMapper(ProductRecommendConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
ProductRecommendBO convertToBO(ProductRecommendDO recommend);
|
||||
List<ProductRecommendRespDTO> convertList(List<ProductRecommendDO> list);
|
||||
|
||||
@Mappings({})
|
||||
List<ProductRecommendBO> convertToBO(List<ProductRecommendDO> recommendList);
|
||||
@Mapping(source = "records", target = "list")
|
||||
PageResult<ProductRecommendRespDTO> convertPage(IPage<ProductRecommendDO> page);
|
||||
|
||||
@Mappings({})
|
||||
List<ProductRecommendRespDTO> convertToDTO(List<ProductRecommendDO> recommendList);
|
||||
ProductRecommendDO convert(ProductRecommendCreateReqDTO bean);
|
||||
|
||||
@Mappings({})
|
||||
ProductRecommendDO convert(ProductRecommendAddBO recommendAddDTO);
|
||||
|
||||
@Mappings({})
|
||||
ProductRecommendDO convert(ProductRecommendUpdateBO recommendUpdateDTO);
|
||||
ProductRecommendDO convert(ProductRecommendUpdateReqDTO bean);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package cn.iocoder.mall.promotionservice.dal.mysql.dataobject.banner;
|
||||
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* Banner 广告页
|
||||
*/
|
||||
@TableName("banner")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class BannerDO extends DeletableDO {
|
||||
|
||||
|
||||
@@ -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.promotion.api.enums.recommend.ProductRecommendTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 商品推荐 DO
|
||||
*/
|
||||
@TableName("product_recommend")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductRecommendDO extends DeletableDO {
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
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 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 java.util.List;
|
||||
|
||||
@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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,33 @@
|
||||
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 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 java.util.List;
|
||||
|
||||
@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,
|
||||
@Param("type") Integer type);
|
||||
default List<ProductRecommendDO> selectList(ProductRecommendListReqDTO listReqDTO) {
|
||||
return selectList(new QueryWrapperX<ProductRecommendDO>().eqIfPresent("type", listReqDTO.getType())
|
||||
.eqIfPresent("status", listReqDTO.getStatus()));
|
||||
}
|
||||
|
||||
List<ProductRecommendDO> selectListByTypeAndStatus(@Param("type") Integer type,
|
||||
@Param("status") Integer status);
|
||||
default IPage<ProductRecommendDO> selectPage(ProductRecommendPageReqDTO pageReqDTO) {
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +1,20 @@
|
||||
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.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeConstants;
|
||||
import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerPageDTO;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.promotion.api.rpc.banner.dto.*;
|
||||
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.mapper.banner.BannerMapper;
|
||||
import cn.iocoder.mall.promotionservice.service.banner.bo.BannerAddBO;
|
||||
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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeConstants.BANNER_NOT_EXISTS;
|
||||
|
||||
|
||||
@Service
|
||||
@@ -26,66 +24,69 @@ public class BannerService {
|
||||
@Autowired
|
||||
private BannerMapper bannerMapper;
|
||||
|
||||
public List<BannerBO> getBannerListByStatus(Integer status) {
|
||||
List<BannerDO> banners = bannerMapper.selectListByStatus(status);
|
||||
return BannerConvert.INSTANCE.convertToBO(banners);
|
||||
/**
|
||||
* 获得 Banner 列表
|
||||
*
|
||||
* @param listReqDTO Banner 列表查询
|
||||
* @return Banner 列表
|
||||
*/
|
||||
public List<BannerRespDTO> listBanners(BannerListReqDTO listReqDTO) {
|
||||
List<BannerDO> banners = bannerMapper.selectList(listReqDTO);
|
||||
return BannerConvert.INSTANCE.convertList(banners);
|
||||
}
|
||||
|
||||
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;
|
||||
/**
|
||||
* 获得 Banner 分页
|
||||
*
|
||||
* @param bannerPageDTO Banner 分页查询
|
||||
* @return Banner 分页结果
|
||||
*/
|
||||
public PageResult<BannerRespDTO> pageBanner(BannerPageReqDTO bannerPageDTO) {
|
||||
IPage<BannerDO> bannerPage = bannerMapper.selectPage(bannerPageDTO);
|
||||
return BannerConvert.INSTANCE.convertPage(bannerPage);
|
||||
}
|
||||
|
||||
public BannerBO addBanner(Integer adminId, BannerAddBO 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);
|
||||
/**
|
||||
* 创建 Banner
|
||||
*
|
||||
* @param createReqDTO 创建 Banner 信息
|
||||
* @return banner
|
||||
*/
|
||||
public Integer createBanner(@Valid BannerCreateReqDTO createReqDTO) {
|
||||
// 插入到数据库
|
||||
BannerDO bannerDO = BannerConvert.INSTANCE.convert(createReqDTO);
|
||||
bannerMapper.insert(bannerDO);
|
||||
// 返回
|
||||
return bannerDO.getId();
|
||||
}
|
||||
|
||||
public Boolean updateBanner(Integer adminId, BannerUpdateBO bannerUpdateDTO) {
|
||||
// 校验 Banner 存在
|
||||
if (bannerMapper.selectById(bannerUpdateDTO.getId()) == null) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.BANNER_NOT_EXISTS.getCode());
|
||||
/**
|
||||
* 更新 Banner
|
||||
*
|
||||
* @param updateReqDTO 更新 Banner 信息
|
||||
*/
|
||||
public void updateBanner(@Valid BannerUpdateReqDTO updateReqDTO) {
|
||||
// 校验更新的 Banner 是否存在
|
||||
if (bannerMapper.selectById(updateReqDTO.getId()) == null) {
|
||||
throw ServiceExceptionUtil.exception(BANNER_NOT_EXISTS);
|
||||
}
|
||||
// 更新到数据库
|
||||
BannerDO updateBanner = BannerConvert.INSTANCE.convert(bannerUpdateDTO);
|
||||
bannerMapper.update(updateBanner);
|
||||
// 返回成功
|
||||
return true;
|
||||
BannerDO updateObject = BannerConvert.INSTANCE.convert(updateReqDTO);
|
||||
bannerMapper.updateById(updateObject);
|
||||
}
|
||||
|
||||
public Boolean updateBannerStatus(Integer adminId, Integer bannerId, Integer status) {
|
||||
/**
|
||||
* 删除 Banner
|
||||
*
|
||||
* @param bannerId Banner 编号
|
||||
*/
|
||||
public void deleteBanner(Integer bannerId) {
|
||||
// 校验 Banner 存在
|
||||
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).setStatus(status);
|
||||
bannerMapper.update(updateBanner);
|
||||
// 返回成功
|
||||
return true;
|
||||
}
|
||||
|
||||
public Boolean deleteBanner(Integer adminId, Integer bannerId) {
|
||||
// 校验 Banner 存在
|
||||
if (bannerMapper.selectById(bannerId) == null) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.BANNER_NOT_EXISTS.getCode());
|
||||
}
|
||||
// 更新到数据库
|
||||
BannerDO updateBanner = new BannerDO().setId(bannerId);
|
||||
updateBanner.setDeleted(DeletedStatusEnum.DELETED_YES.getValue());
|
||||
bannerMapper.update(updateBanner);
|
||||
// 返回成功
|
||||
return true;
|
||||
bannerMapper.deleteById(bannerId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
package cn.iocoder.mall.promotionservice.service.banner.bo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.hibernate.validator.constraints.URL;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Banner 添加 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BannerAddBO implements Serializable {
|
||||
|
||||
@NotEmpty(message = "标题不能为空")
|
||||
@Length(min = 2, max = 32, message = "标题长度为 2-32 位")
|
||||
private String title;
|
||||
@NotEmpty(message = "跳转链接不能为空")
|
||||
@URL(message = "跳转链接格式不正确")
|
||||
@Length(max = 255, message = "跳转链接最大长度为 255 位")
|
||||
private String url;
|
||||
@NotEmpty(message = "图片链接不能为空")
|
||||
@URL(message = "图片链接格式不正确")
|
||||
@Length(max = 255, message = "图片链接最大长度为 255 位")
|
||||
private String picUrl;
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
@Length(max = 255, message = "备注最大长度为 255 位")
|
||||
private String memo;
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package cn.iocoder.mall.promotionservice.service.banner.bo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.hibernate.validator.constraints.URL;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Banner 更新 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BannerUpdateBO implements Serializable {
|
||||
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Integer id;
|
||||
@NotEmpty(message = "标题不能为空")
|
||||
@Length(min = 2, max = 32, message = "标题长度为 2-32 位")
|
||||
private String title;
|
||||
@NotEmpty(message = "跳转链接不能为空")
|
||||
@URL(message = "跳转链接格式不正确")
|
||||
@Length(max = 255, message = "跳转链接最大长度为 255 位")
|
||||
private String url;
|
||||
@NotEmpty(message = "图片链接不能为空")
|
||||
@URL(message = "图片链接格式不正确")
|
||||
@Length(max = 255, message = "图片链接最大长度为 255 位")
|
||||
private String picUrl;
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
@Length(max = 255, message = "备注最大长度为 255 位")
|
||||
private String memo;
|
||||
|
||||
}
|
||||
@@ -1,113 +1,93 @@
|
||||
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.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.productservice.rpc.spu.ProductSpuRpc;
|
||||
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.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.promotion.api.rpc.recommend.dto.*;
|
||||
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.mapper.recommend.ProductRecommendMapper;
|
||||
import cn.iocoder.mall.promotionservice.service.recommend.bo.ProductRecommendAddBO;
|
||||
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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.Date;
|
||||
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
|
||||
@Validated
|
||||
public class ProductRecommendService {
|
||||
|
||||
@DubboReference(validation = "true", version = "${dubbo.consumer.ProductSpuRpc.version}")
|
||||
private ProductSpuRpc productSpuRpc;
|
||||
|
||||
@Autowired
|
||||
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();
|
||||
productRecommendPageBO.setList(ProductRecommendConvert.INSTANCE.convertToDTO(productRecommendMapper.selectPageByType(productRecommendPageDTO.getType(),
|
||||
offset, productRecommendPageDTO.getPageSize())));
|
||||
// 查询分页总数
|
||||
productRecommendPageBO.setTotal(productRecommendMapper.selectCountByType(productRecommendPageDTO.getType()));
|
||||
return productRecommendPageBO;
|
||||
/**
|
||||
* 获得商品推荐分页
|
||||
*
|
||||
* @param pageReqDTO 分页查询 DTO
|
||||
* @return 商品推荐分页
|
||||
*/
|
||||
public PageResult<ProductRecommendRespDTO> pageProductRecommend(ProductRecommendPageReqDTO pageReqDTO) {
|
||||
IPage<ProductRecommendDO> productRecommendPage = productRecommendMapper.selectPage(pageReqDTO);
|
||||
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(), productRecommendAddDTO.getType()) != null) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.PRODUCT_RECOMMEND_EXISTS.getCode());
|
||||
if (productRecommendMapper.selectByProductSpuIdAndType(createReqDTO.getProductSpuId(), createReqDTO.getType()) != null) {
|
||||
throw ServiceExceptionUtil.exception(PRODUCT_RECOMMEND_EXISTS);
|
||||
}
|
||||
// 保存到数据库
|
||||
ProductRecommendDO productRecommend = ProductRecommendConvert.INSTANCE.convert(productRecommendAddDTO).setStatus(CommonStatusEnum.ENABLE.getValue());
|
||||
productRecommend.setDeleted(DeletedStatusEnum.DELETED_NO.getValue()).setCreateTime(new Date());
|
||||
ProductRecommendDO productRecommend = ProductRecommendConvert.INSTANCE.convert(createReqDTO);
|
||||
productRecommendMapper.insert(productRecommend);
|
||||
// 返回成功
|
||||
return ProductRecommendConvert.INSTANCE.convertToBO(productRecommend);
|
||||
return productRecommend.getId();
|
||||
}
|
||||
|
||||
public Boolean updateProductRecommend(Integer adminId, ProductRecommendUpdateBO productRecommendUpdateDTO) {
|
||||
public void updateProductRecommend(ProductRecommendUpdateReqDTO updateReqDTO) {
|
||||
// 校验更新的商品推荐存在
|
||||
if (productRecommendMapper.selectById(productRecommendUpdateDTO.getId()) == null) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.PRODUCT_RECOMMEND_NOT_EXISTS.getCode());
|
||||
}
|
||||
// 校验商品不存在
|
||||
if (productSpuRpc.getProductSpu(productRecommendUpdateDTO.getProductSpuId()) == null) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.PRODUCT_RECOMMEND_PRODUCT_NOT_EXISTS.getCode());
|
||||
if (productRecommendMapper.selectById(updateReqDTO.getId()) == null) {
|
||||
throw ServiceExceptionUtil.exception(PRODUCT_RECOMMEND_NOT_EXISTS);
|
||||
}
|
||||
// 校验商品是否已经推荐
|
||||
ProductRecommendDO existProductRecommend = productRecommendMapper.selectByProductSpuIdAndType(productRecommendUpdateDTO.getProductSpuId(), productRecommendUpdateDTO.getType());
|
||||
if (existProductRecommend != null && !existProductRecommend.getId().equals(productRecommendUpdateDTO.getId())) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.PRODUCT_RECOMMEND_EXISTS.getCode());
|
||||
ProductRecommendDO existProductRecommend = productRecommendMapper.selectByProductSpuIdAndType(updateReqDTO.getProductSpuId(), updateReqDTO.getType());
|
||||
if (existProductRecommend != null && !existProductRecommend.getId().equals(updateReqDTO.getId())) {
|
||||
throw ServiceExceptionUtil.exception(PRODUCT_RECOMMEND_EXISTS.getCode());
|
||||
}
|
||||
// 更新到数据库
|
||||
ProductRecommendDO updateProductRecommend = ProductRecommendConvert.INSTANCE.convert(productRecommendUpdateDTO);
|
||||
productRecommendMapper.update(updateProductRecommend);
|
||||
// 返回成功
|
||||
return true;
|
||||
ProductRecommendDO updateProductRecommend = ProductRecommendConvert.INSTANCE.convert(updateReqDTO);
|
||||
productRecommendMapper.updateById(updateProductRecommend);
|
||||
}
|
||||
|
||||
public Boolean updateProductRecommendStatus(Integer adminId, Integer productRecommendId, Integer status) {
|
||||
public void deleteProductRecommend(Integer productRecommendId) {
|
||||
// 校验更新的商品推荐存在
|
||||
if (productRecommendMapper.selectById(productRecommendId) == null) {
|
||||
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.PRODUCT_RECOMMEND_NOT_EXISTS.getCode());
|
||||
throw ServiceExceptionUtil.exception(PRODUCT_RECOMMEND_NOT_EXISTS);
|
||||
}
|
||||
// 更新到数据库
|
||||
ProductRecommendDO updateProductRecommend = new ProductRecommendDO().setId(productRecommendId).setStatus(status);
|
||||
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;
|
||||
productRecommendMapper.deleteById(productRecommendId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package cn.iocoder.mall.promotionservice.service.recommend.bo;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 商品推荐 BO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductRecommendBO implements Serializable {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 类型
|
||||
*
|
||||
* {@link ProductRecommendTypeEnum}
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 商品 Spu 编号
|
||||
*/
|
||||
private Integer productSpuId;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* {@link cn.iocoder.common.framework.enums.CommonStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String memo;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user