商品规格 value 的迁移
This commit is contained in:
@@ -2,10 +2,7 @@ package cn.iocoder.mall.managementweb.controller.product;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.managementweb.controller.product.vo.attr.ProductAttrKeyCreateReqVO;
|
||||
import cn.iocoder.mall.managementweb.controller.product.vo.attr.ProductAttrKeyPageReqVO;
|
||||
import cn.iocoder.mall.managementweb.controller.product.vo.attr.ProductAttrKeyRespVO;
|
||||
import cn.iocoder.mall.managementweb.controller.product.vo.attr.ProductAttrKeyUpdateReqVO;
|
||||
import cn.iocoder.mall.managementweb.controller.product.vo.attr.*;
|
||||
import cn.iocoder.mall.managementweb.manager.product.ProductAttrKeyManager;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -24,7 +21,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/product-attr/")
|
||||
@Api(tags = "商品规格键")
|
||||
@Api(tags = "商品规格")
|
||||
@Validated
|
||||
public class ProductAttrController {
|
||||
|
||||
@@ -64,4 +61,31 @@ public class ProductAttrController {
|
||||
return success(productAttrKeyManager.pageProductAttrKey(pageVO));
|
||||
}
|
||||
|
||||
@PostMapping("/value/create")
|
||||
@ApiOperation("创建商品规格值")
|
||||
public CommonResult<Integer> createProductAttrValue(@Valid ProductAttrValueCreateReqVO createVO) {
|
||||
return success(productAttrKeyManager.createProductAttrValue(createVO));
|
||||
}
|
||||
|
||||
@PostMapping("/value/update")
|
||||
@ApiOperation("更新商品规格值")
|
||||
public CommonResult<Boolean> updateProductAttrValue(@Valid ProductAttrValueUpdateReqVO updateVO) {
|
||||
productAttrKeyManager.updateProductAttrValue(updateVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/value/get")
|
||||
@ApiOperation("获得商品规格值")
|
||||
@ApiImplicitParam(name = "productAttrValueId", value = "商品规格值编号", required = true)
|
||||
public CommonResult<ProductAttrValueRespVO> getProductAttrValue(@RequestParam("productAttrValueId") Integer productAttrValueId) {
|
||||
return success(productAttrKeyManager.getProductAttrValue(productAttrValueId));
|
||||
}
|
||||
|
||||
@GetMapping("/value/list")
|
||||
@ApiOperation("获得商品规格值列表")
|
||||
@ApiImplicitParam(name = "productAttrValueIds", value = "商品规格值编号列表", required = true)
|
||||
public CommonResult<List<ProductAttrValueRespVO>> listProductAttrValues(@RequestParam("productAttrValueIds") List<Integer> productAttrValueIds) {
|
||||
return success(productAttrKeyManager.listProductAttrValues(productAttrValueIds));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.mall.managementweb.controller.product.vo.attr;
|
||||
|
||||
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 javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("商品规格值创建 Request VO")
|
||||
@Data
|
||||
public class ProductAttrValueCreateReqVO {
|
||||
|
||||
@ApiModelProperty(value = "规格键编号", required = true, example = "2")
|
||||
@NotNull(message = "规格键编号不能为空")
|
||||
private Integer attrKeyId;
|
||||
@ApiModelProperty(value = "规格值名字", required = true, example = "XXL")
|
||||
@NotEmpty(message = "规格值名字不能为空")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.iocoder.mall.managementweb.controller.product.vo.attr;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.*;
|
||||
|
||||
@ApiModel("商品规格值 Response VO")
|
||||
@Data
|
||||
public class ProductAttrValueRespVO {
|
||||
|
||||
@ApiModelProperty(value = "规格值编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "规格键编号", required = true, example = "2")
|
||||
private Integer attrKeyId;
|
||||
@ApiModelProperty(value = "规格值名字", required = true, example = "XXL")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.mall.managementweb.controller.product.vo.attr;
|
||||
|
||||
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 javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("商品规格值更新 Request VO")
|
||||
@Data
|
||||
public class ProductAttrValueUpdateReqVO {
|
||||
|
||||
@ApiModelProperty(value = "规格值编号", required = true, example = "1")
|
||||
@NotNull(message = "规格值编号不能为空")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "规格值名字", required = true, example = "XXL")
|
||||
@NotEmpty(message = "规格值名字不能为空")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user