- 前端 + 后端:商品推荐列表,增加商品名。

This commit is contained in:
YunaiV
2019-05-07 01:58:07 +08:00
parent 9a3b708738
commit ab5d051f75
17 changed files with 135 additions and 81 deletions

View File

@@ -1,6 +1,7 @@
package cn.iocoder.mall.promotion.api;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.constant.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO;
import cn.iocoder.mall.promotion.api.bo.ProductRecommendPageBO;
import cn.iocoder.mall.promotion.api.dto.ProductRecommendAddDTO;
@@ -11,16 +12,17 @@ import java.util.List;
public interface ProductRecommendService {
CommonResult<List<ProductRecommendBO>> getProductRecommendList(Integer type, Integer status);
List<ProductRecommendBO> getProductRecommendList(Integer type, Integer status);
CommonResult<ProductRecommendPageBO> getProductRecommendPage(ProductRecommendPageDTO productRecommendPageDTO);
ProductRecommendPageBO getProductRecommendPage(ProductRecommendPageDTO productRecommendPageDTO);
CommonResult<ProductRecommendBO> addProductRecommend(Integer adminId, ProductRecommendAddDTO productRecommendAddDTO);
ProductRecommendBO addProductRecommend(Integer adminId, ProductRecommendAddDTO productRecommendAddDTO);
CommonResult<Boolean> updateProductRecommend(Integer adminId, ProductRecommendUpdateDTO productRecommendUpdateDTO);
Boolean updateProductRecommend(Integer adminId, ProductRecommendUpdateDTO productRecommendUpdateDTO);
CommonResult<Boolean> updateProductRecommendStatus(Integer adminId, Integer productRecommendId, Integer status);
Boolean updateProductRecommendStatus(Integer adminId, Integer productRecommendId,
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status);
CommonResult<Boolean> deleteProductRecommend(Integer adminId, Integer productRecommendId);
Boolean deleteProductRecommend(Integer adminId, Integer productRecommendId);
}
}

View File

@@ -1,15 +1,20 @@
package cn.iocoder.mall.promotion.api.constant;
import cn.iocoder.common.framework.core.IntArrayValuable;
import java.util.Arrays;
/**
* 商品推荐类型
*/
public enum ProductRecommendTypeEnum {
public enum ProductRecommendTypeEnum implements IntArrayValuable {
HOT(1, "热卖推荐"),
NEW(2, "新品推荐"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductRecommendTypeEnum::getValue).toArray();
/**
* 状态值
*/
@@ -40,4 +45,9 @@ public enum ProductRecommendTypeEnum {
|| NEW.value.equals(status);
}
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@@ -1,5 +1,7 @@
package cn.iocoder.mall.promotion.api.dto;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.promotion.api.constant.ProductRecommendTypeEnum;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
@@ -13,6 +15,7 @@ import javax.validation.constraints.NotNull;
@Accessors(chain = true)
public class ProductRecommendAddDTO {
@InEnum(value = ProductRecommendTypeEnum.class, message = "修改推荐类型必须是 {value}")
@NotNull(message = "推荐类型不能为空")
private Integer type;
@NotNull(message = "商品编号不能为空")

View File

@@ -1,5 +1,7 @@
package cn.iocoder.mall.promotion.api.dto;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.promotion.api.constant.ProductRecommendTypeEnum;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
@@ -16,6 +18,7 @@ public class ProductRecommendUpdateDTO {
@NotNull(message = "编号不能为空")
private Integer id;
@NotNull(message = "类型不能为空")
@InEnum(value = ProductRecommendTypeEnum.class, message = "修改推荐类型必须是 {value}")
private Integer type;
@NotNull(message = "商品编号不能为空")
private Integer productSpuId;