商品规格 key 的迁移
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
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.manager.product.ProductAttrKeyManager;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 商品规格键 Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/product-attr/")
|
||||
@Api(tags = "商品规格键")
|
||||
@Validated
|
||||
public class ProductAttrController {
|
||||
|
||||
@Autowired
|
||||
private ProductAttrKeyManager productAttrKeyManager;
|
||||
|
||||
@PostMapping("/key/create")
|
||||
@ApiOperation("创建商品规格键")
|
||||
public CommonResult<Integer> createProductAttrKey(@Valid ProductAttrKeyCreateReqVO createVO) {
|
||||
return success(productAttrKeyManager.createProductAttrKey(createVO));
|
||||
}
|
||||
|
||||
@PostMapping("/key/update")
|
||||
@ApiOperation("更新商品规格键")
|
||||
public CommonResult<Boolean> updateProductAttrKey(@Valid ProductAttrKeyUpdateReqVO updateVO) {
|
||||
productAttrKeyManager.updateProductAttrKey(updateVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/key/get")
|
||||
@ApiOperation("获得商品规格键")
|
||||
@ApiImplicitParam(name = "productAttrKeyId", value = "商品规格键编号", required = true)
|
||||
public CommonResult<ProductAttrKeyRespVO> getProductAttrKey(@RequestParam("productAttrKeyId") Integer productAttrKeyId) {
|
||||
return success(productAttrKeyManager.getProductAttrKey(productAttrKeyId));
|
||||
}
|
||||
|
||||
@GetMapping("/key/list")
|
||||
@ApiOperation("获得商品规格键列表")
|
||||
@ApiImplicitParam(name = "productAttrKeyIds", value = "商品规格键编号列表", required = true)
|
||||
public CommonResult<List<ProductAttrKeyRespVO>> listProductAttrKeys(@RequestParam("productAttrKeyIds") List<Integer> productAttrKeyIds) {
|
||||
return success(productAttrKeyManager.listProductAttrKeys(productAttrKeyIds));
|
||||
}
|
||||
|
||||
@GetMapping("/key/page")
|
||||
@ApiOperation("获得商品规格键分页")
|
||||
public CommonResult<PageResult<ProductAttrKeyRespVO>> pageProductAttrKey(ProductAttrKeyPageReqVO pageVO) {
|
||||
return success(productAttrKeyManager.pageProductAttrKey(pageVO));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,10 +61,14 @@ public class ProductSpuController {
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得商品 SPU 分页")
|
||||
public CommonResult<PageResult<ProductSpuRespVO>> pageProductSpu(ProductSpuPageReqVO pageVO) {
|
||||
//
|
||||
//
|
||||
//
|
||||
// 全部:无搜索条件
|
||||
// 在售中:visible = true && hasQuantity = true
|
||||
// 已售罄:visible = true && hasQuantity = false
|
||||
// 仓库中:visible = false
|
||||
return success(productSpuManager.pageProductSpu(pageVO));
|
||||
}
|
||||
|
||||
// TODO 芋艿,删除功能暂时不做。主要原因是,关联的数据太多。删除带来的问题会比较大
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
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 ProductAttrKeyCreateReqVO {
|
||||
|
||||
@ApiModelProperty(value = "规格键名称", required = true, example = "尺寸")
|
||||
@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 cn.iocoder.common.framework.enums.CommonStatusEnum;
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.common.framework.vo.PageParam;
|
||||
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 ProductAttrKeyPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "规格键名称", required = true, example = "尺寸", notes = "模糊匹配")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "状态", example = "1", notes = "见 CommonStatusEnum 枚举")
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.mall.managementweb.controller.product.vo.attr;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.*;
|
||||
|
||||
@ApiModel("商品规格键 Response VO")
|
||||
@Data
|
||||
public class ProductAttrKeyRespVO {
|
||||
|
||||
@ApiModelProperty(value = "规格键编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "规格键名称", required = true, example = "尺寸")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
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 ProductAttrKeyUpdateReqVO {
|
||||
|
||||
@ApiModelProperty(value = "规格键编号", required = true, example = "1")
|
||||
@NotNull(message = "规格键编号不能为空")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "规格键名称", required = true, example = "尺寸")
|
||||
@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