清理已迁移的 product 代码

This commit is contained in:
YunaiV
2022-09-05 21:08:45 +08:00
parent 98ad02744b
commit a347d2a1d3
105 changed files with 0 additions and 5347 deletions

View File

@@ -1,21 +0,0 @@
### /product-attr/page 成功(全部)
GET http://127.0.0.1:18083/management-api/product-attr/key/page?pageNo=1&pageSize=10
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
###
POST http://127.0.0.1:18083/management-api/product-attr/key/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
name=桶&status=1
###
POST http://127.0.0.1:18083/management-api/product-attr/value/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
attrKeyId=12&name=大桶&status=1
###

View File

@@ -1,100 +0,0 @@
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.*;
import cn.iocoder.mall.managementweb.manager.product.ProductAttrKeyManager;
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 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("创建商品规格键")
@RequiresPermissions("product:attr-key:create")
public CommonResult<Integer> createProductAttrKey(@Valid ProductAttrKeyCreateReqVO createVO) {
return success(productAttrKeyManager.createProductAttrKey(createVO));
}
@PostMapping("/key/update")
@ApiOperation("更新商品规格键")
@RequiresPermissions("product:attr-key:update")
public CommonResult<Boolean> updateProductAttrKey(@Valid ProductAttrKeyUpdateReqVO updateVO) {
productAttrKeyManager.updateProductAttrKey(updateVO);
return success(true);
}
@GetMapping("/key/get")
@ApiOperation("获得商品规格键")
@ApiImplicitParam(name = "productAttrKeyId", value = "商品规格键编号", required = true, example = "1")
@RequiresPermissions("product:attr-key:page")
public CommonResult<ProductAttrKeyRespVO> getProductAttrKey(@RequestParam("productAttrKeyId") Integer productAttrKeyId) {
return success(productAttrKeyManager.getProductAttrKey(productAttrKeyId));
}
@GetMapping("/key/list")
@ApiOperation("获得商品规格键列表")
@ApiImplicitParam(name = "productAttrKeyIds", value = "商品规格键编号列表", required = true, example = "1,3")
@RequiresPermissions("product:attr-key:page")
public CommonResult<List<ProductAttrKeyRespVO>> listProductAttrKeys(@RequestParam("productAttrKeyIds") List<Integer> productAttrKeyIds) {
return success(productAttrKeyManager.listProductAttrKeys(productAttrKeyIds));
}
@GetMapping("/key/page")
@ApiOperation("获得商品规格键分页")
@RequiresPermissions("product:attr-key:page")
public CommonResult<PageResult<ProductAttrKeyRespVO>> pageProductAttrKey(ProductAttrKeyPageReqVO pageVO) {
return success(productAttrKeyManager.pageProductAttrKey(pageVO));
}
@PostMapping("/value/create")
@ApiOperation("创建商品规格值")
@RequiresPermissions("product:attr-value:create")
public CommonResult<Integer> createProductAttrValue(@Valid ProductAttrValueCreateReqVO createVO) {
return success(productAttrKeyManager.createProductAttrValue(createVO));
}
@PostMapping("/value/update")
@ApiOperation("更新商品规格值")
@RequiresPermissions("product:attr-value:update")
public CommonResult<Boolean> updateProductAttrValue(@Valid ProductAttrValueUpdateReqVO updateVO) {
productAttrKeyManager.updateProductAttrValue(updateVO);
return success(true);
}
@GetMapping("/value/get")
@ApiOperation("获得商品规格值")
@ApiImplicitParam(name = "productAttrValueId", value = "商品规格值编号", required = true)
@RequiresPermissions("product:attr-value:list")
public CommonResult<ProductAttrValueRespVO> getProductAttrValue(@RequestParam("productAttrValueId") Integer productAttrValueId) {
return success(productAttrKeyManager.getProductAttrValue(productAttrValueId));
}
@GetMapping("/value/list")
@ApiOperation("获得商品规格值列表")
@RequiresPermissions("product:attr-value:list")
public CommonResult<List<ProductAttrValueRespVO>> listProductAttrValues(@Valid ProductAttrValueListQueryReqVO queryReqVO) {
return success(productAttrKeyManager.listProductAttrValues(queryReqVO));
}
}

View File

@@ -1,20 +0,0 @@
### /product-attr/page 成功(全部)
GET http://127.0.0.1:18083/management-api/product-attr/key/page?pageNo=1&pageSize=10
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
###
POST http://127.0.0.1:18083/management-api/product-brand/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
name=光明牌&description=光明牌电灯泡&status=1
###
GET http://127.0.0.1:18083/management-api/product-brand/get?productBrandId=3
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
###

View File

@@ -1,82 +0,0 @@
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.brand.ProductBrandCreateReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandPageReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandRespVO;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandUpdateReqVO;
import cn.iocoder.mall.managementweb.manager.product.ProductBrandManager;
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 java.util.List;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 商品品牌 Controller
*/
@RestController
@RequestMapping("/product-brand")
@Api(tags = "商品品牌")
@Validated
public class ProductBrandController {
@Autowired
private ProductBrandManager productBrandManager;
@PostMapping("/create")
@ApiOperation("创建商品品牌")
@RequiresPermissions("product:brand:create")
public CommonResult<Integer> createProductBrand(@Valid ProductBrandCreateReqVO createVO) {
return success(productBrandManager.createProductBrand(createVO));
}
@PostMapping("/update")
@ApiOperation("更新商品品牌")
@RequiresPermissions("product:brand:update")
public CommonResult<Boolean> updateProductBrand(@Valid ProductBrandUpdateReqVO updateVO) {
productBrandManager.updateProductBrand(updateVO);
return success(true);
}
@PostMapping("/delete")
@ApiOperation("删除商品品牌")
@ApiImplicitParam(name = "productBrandId", value = "商品品牌编号", required = true)
@RequiresPermissions("product:brand:delete")
public CommonResult<Boolean> deleteProductBrand(@RequestParam("productBrandId") Integer productBrandId) {
productBrandManager.deleteProductBrand(productBrandId);
return success(true);
}
@GetMapping("/get")
@ApiOperation("获得商品品牌")
@ApiImplicitParam(name = "productBrandId", value = "商品品牌编号", required = true)
@RequiresPermissions("product:brand:page")
public CommonResult<ProductBrandRespVO> getProductBrand(@RequestParam("productBrandId") Integer productBrandId) {
return success(productBrandManager.getProductBrand(productBrandId));
}
@GetMapping("/list")
@ApiOperation("获得商品品牌列表")
@ApiImplicitParam(name = "productBrandIds", value = "商品品牌编号列表", required = true)
@RequiresPermissions("product:brand:page")
public CommonResult<List<ProductBrandRespVO>> listProductBrands(@RequestParam("productBrandIds") List<Integer> productBrandIds) {
return success(productBrandManager.listProductBrands(productBrandIds));
}
@GetMapping("/page")
@ApiOperation("获得商品品牌分页")
@RequiresPermissions("product:brand:page")
public CommonResult<PageResult<ProductBrandRespVO>> pageProductBrand(ProductBrandPageReqVO pageVO) {
return success(productBrandManager.pageProductBrand(pageVO));
}
}

View File

@@ -1,15 +0,0 @@
### /product-category/tree 成功
GET http://127.0.0.1:18083/management-api/product-category/tree
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
###
POST http://127.0.0.1:18083/management-api/product-category/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
pid=0&name=美食&description=吃喝拉撒&sort=7&status=1
###

View File

@@ -1,64 +0,0 @@
package cn.iocoder.mall.managementweb.controller.product;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryCreateReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryTreeNodeRespVO;
import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryUpdateReqVO;
import cn.iocoder.mall.managementweb.manager.product.ProductCategoryManager;
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 java.util.List;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 商品分类 Controller
*/
@RestController
@RequestMapping("/product-category")
@Api(tags = "商品分类")
@Validated
public class ProductCategoryController {
@Autowired
private ProductCategoryManager productCategoryManager;
@PostMapping("/create")
@ApiOperation("创建商品分类")
@RequiresPermissions("product:category:create")
public CommonResult<Integer> createProductCategory(@Valid ProductCategoryCreateReqVO createVO) {
return success(productCategoryManager.createProductCategory(createVO));
}
@PostMapping("/update")
@ApiOperation("更新商品分类")
@RequiresPermissions("product:category:update")
public CommonResult<Boolean> updateProductCategory(@Valid ProductCategoryUpdateReqVO updateVO) {
productCategoryManager.updateProductCategory(updateVO);
return success(true);
}
@PostMapping("/delete")
@ApiOperation("删除商品分类")
@RequiresPermissions("product:category:delete")
@ApiImplicitParam(name = "productCategoryId", value = "商品分类编号", required = true)
public CommonResult<Boolean> deleteProductCategory(@RequestParam("productCategoryId") Integer productCategoryId) {
productCategoryManager.deleteProductCategory(productCategoryId);
return success(true);
}
@GetMapping("/tree")
@ApiOperation("获得资源树")
@RequiresPermissions("product:category:tree")
public CommonResult<List<ProductCategoryTreeNodeRespVO>> treeProductCategory() {
return success(productCategoryManager.treeProductCategory());
}
}

View File

@@ -1,65 +0,0 @@
### /product-spu/page 成功(全部)
GET http://127.0.0.1:18083/management-api/product-spu/page?pageNo=1&pageSize=100
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /product-spu/page 成功(有库存 + 上架)
GET http://127.0.0.1:18083/management-api/product-spu/page?pageNo=1&pageSize=10&hasQuantity=true&visible=true
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /product-spu/page 成功(无库存 + 下架)
GET http://127.0.0.1:18083/management-api/product-spu/page?pageNo=1&pageSize=10&hasQuantity=false&visible=false
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /product-spu/create 成功
POST http://127.0.0.1:18083/management-api/product-spu/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
name=新商品&description=新商品描述&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true
&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,3
&skus[1].price=2&skus[1].quantity=50&skus[1].attrValueIds=2,4
### /product-spu/create 失败(规格不存在)
POST http://127.0.0.1:18083/management-api/product-spu/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
name=测试商品标题&description=测试商品描述&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true
&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,0
### /product-spu/create 失败(规格数量不匹配)
POST http://127.0.0.1:18083/management-api/product-spu/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
name=测试商品标题&description=测试商品描述&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true
&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,3
&skus[1].price=2&skus[1].quantity=50&skus[1].attrValueIds=1,2,4
### /product-spu/update 成功
POST http://127.0.0.1:18083/management-api/product-spu/update
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
id=64&name=新商品测试&description=新商品测试&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true
&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,3
&skus[1].price=2&skus[1].quantity=50&skus[1].attrValueIds=2,4
###
### /product-spu/get
GET http://127.0.0.1:18083/management-api/product-spu/get?productSpuId=32
Content-Type: application/x-www-form-urlencoded
Authorization:Bearer yudaoyuanma
###
### /product-spu/get
GET http://127.0.0.1:18083/management-api/product-spu/list?productSpuIds=32,33,34
Content-Type: application/x-www-form-urlencoded
Authorization:Bearer yudaoyuanma
###

View File

@@ -31,33 +31,6 @@ public class ProductSpuController {
@Autowired
private ProductSpuManager productSpuManager;
@PostMapping("/create")
@ApiOperation("创建商品 SPU")
public CommonResult<Integer> createProductSpu(@Valid ProductSpuCreateReqVO createVO) {
return success(productSpuManager.createProductSpu(createVO));
}
@PostMapping("/update")
@ApiOperation("更新商品 SPU")
public CommonResult<Boolean> updateProductSpu(@Valid ProductSpuUpdateReqVO updateVO) {
productSpuManager.updateProductSpu(updateVO);
return success(true);
}
@GetMapping("/get")
@ApiOperation("获得商品 SPU")
@ApiImplicitParam(name = "productSpuId", value = "商品 SPU 编号", required = true)
public CommonResult<ProductSpuRespVO> getProductSpu(@RequestParam("productSpuId") Integer productSpuId) {
return success(productSpuManager.getProductSpu(productSpuId));
}
@GetMapping("/list")
@ApiOperation("获得商品 SPU 列表")
@ApiImplicitParam(name = "productSpuIds", value = "商品 SPU 编号列表", required = true)
public CommonResult<List<ProductSpuRespVO>> listProductSpus(@RequestParam("productSpuIds") List<Integer> productSpuIds) {
return success(productSpuManager.listProductSpus(productSpuIds));
}
@GetMapping("/page")
@ApiOperation("获得商品 SPU 分页")
public CommonResult<PageResult<ProductSpuRespVO>> pageProductSpu(ProductSpuPageReqVO pageVO) {

View File

@@ -1,24 +0,0 @@
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;
}

View File

@@ -1,22 +0,0 @@
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;
}

View File

@@ -1,20 +0,0 @@
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;
}

View File

@@ -1,27 +0,0 @@
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;
}

View File

@@ -1,28 +0,0 @@
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;
}

View File

@@ -1,21 +0,0 @@
package cn.iocoder.mall.managementweb.controller.product.vo.attr;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@ApiModel("商品规格值的列表查询条件 Request VO")
@Data
@Accessors(chain = true)
public class ProductAttrValueListQueryReqVO {
@ApiModelProperty(value = "商品规格值编号列表", example = "1, 3")
private List<Integer> productAttrValueIds;
@ApiModelProperty(value = "规格键编号", required = true, example = "2")
private Integer productAttrKeyId;
}

View File

@@ -1,22 +0,0 @@
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;
}

View File

@@ -1,28 +0,0 @@
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;
}

View File

@@ -1,20 +0,0 @@
package cn.iocoder.mall.managementweb.controller.product.vo.brand;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("商品品牌创建 Request VO")
@Data
public class ProductBrandCreateReqVO {
@ApiModelProperty(value = "品牌名称", required = true, example = "这个商品品牌很吊")
private String name;
@ApiModelProperty(value = "品牌描述", example = "这个商品描述很吊")
private String description;
@ApiModelProperty(value = "品牌名图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
private Integer status;
}

View File

@@ -1,19 +0,0 @@
package cn.iocoder.mall.managementweb.controller.product.vo.brand;
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 ProductBrandPageReqVO extends PageParam {
@ApiModelProperty(value = "品牌名称", required = true, notes = "模糊匹配", example = "这个商品品牌很吊")
private String name;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
private Integer status;
}

View File

@@ -1,24 +0,0 @@
package cn.iocoder.mall.managementweb.controller.product.vo.brand;
import lombok.*;
import io.swagger.annotations.*;
import java.util.*;
@ApiModel("商品品牌 Response VO")
@Data
public class ProductBrandRespVO {
@ApiModelProperty(value = "品牌编号", required = true, example = "1024")
private Integer id;
@ApiModelProperty(value = "品牌名称", required = true, example = "这个商品品牌很吊")
private String name;
@ApiModelProperty(value = "品牌描述", example = "这个商品描述很吊")
private String description;
@ApiModelProperty(value = "品牌名图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@@ -1,22 +0,0 @@
package cn.iocoder.mall.managementweb.controller.product.vo.brand;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("商品品牌更新 Request VO")
@Data
public class ProductBrandUpdateReqVO {
@ApiModelProperty(value = "品牌编号", required = true, example = "1024")
private Integer id;
@ApiModelProperty(value = "品牌名称", required = true, example = "这个商品品牌很吊")
private String name;
@ApiModelProperty(value = "品牌描述", example = "这个商品描述很吊")
private String description;
@ApiModelProperty(value = "品牌名图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
private Integer status;
}

View File

@@ -1,34 +0,0 @@
package cn.iocoder.mall.managementweb.controller.product.vo.category;
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 ProductCategoryCreateReqVO {
@ApiModelProperty(value = "父分类编号", required = true, example = "0")
@NotNull(message = "父分类编号不能为空")
private Integer pid;
@ApiModelProperty(value = "分类名称", required = true, example = "手机")
@NotEmpty(message = "分类名称不能为空")
private String name;
@ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊")
private String description;
@ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
@ApiModelProperty(value = "分类排序", required = true, example = "10")
@NotNull(message = "分类排序不能为空")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
}

View File

@@ -1,30 +0,0 @@
package cn.iocoder.mall.managementweb.controller.product.vo.category;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ApiModel("商品分类 Response VO")
@Data
public class ProductCategoryRespVO {
@ApiModelProperty(value = "分类编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "父分类编号", required = true, example = "0")
private Integer pid;
@ApiModelProperty(value = "分类名称", required = true, example = "手机")
private String name;
@ApiModelProperty(value = "分类描述", required = true, example = "这个商品分类很吊")
private String description;
@ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
@ApiModelProperty(value = "分类排序", required = true, example = "10")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@@ -1,36 +0,0 @@
package cn.iocoder.mall.managementweb.controller.product.vo.category;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@ApiModel("商品分类 Response VO")
@Data
public class ProductCategoryTreeNodeRespVO {
@ApiModelProperty(value = "分类编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "父分类编号", required = true, example = "0")
private Integer pid;
@ApiModelProperty(value = "分类名称", required = true, example = "手机")
private String name;
@ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊")
private String description;
@ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
@ApiModelProperty(value = "分类排序", required = true, example = "10")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
/**
* 子节点
*/
private List<ProductCategoryTreeNodeRespVO> children;
}

View File

@@ -1,37 +0,0 @@
package cn.iocoder.mall.managementweb.controller.product.vo.category;
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 ProductCategoryUpdateReqVO {
@ApiModelProperty(value = "分类编号", required = true, example = "1")
@NotNull(message = "分类编号不能为空")
private Integer id;
@ApiModelProperty(value = "父分类编号", required = true, example = "0")
@NotNull(message = "父分类编号不能为空")
private Integer pid;
@ApiModelProperty(value = "分类名称", required = true, example = "手机")
@NotEmpty(message = "分类名称不能为空")
private String name;
@ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊")
private String description;
@ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
@ApiModelProperty(value = "分类排序", required = true, example = "10")
@NotNull(message = "分类排序不能为空")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
}

View File

@@ -1,73 +0,0 @@
package cn.iocoder.mall.managementweb.controller.product.vo.spu;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@ApiModel("商品 SPU 创建 Request VO")
@Data
public class ProductSpuCreateReqVO {
/**
* SKU 信息
*/
@Data
@Accessors(chain = true)
public static class Sku {
/**
* 规格值数组
*/
@NotNull(message = "规格值数组不能为空")
private List<Integer> attrValueIds;
/**
* 价格,单位:分
*/
@NotNull(message = "价格不能为空")
@Min(value = 1L, message = "最小价格为 1")
private Integer price;
/**
* 库存数量
*/
@NotNull(message = "库存数量不能为空")
@Min(value = 1L, message = "最小库存为 1")
private Integer quantity;
}
@ApiModelProperty(value = "SPU 名字", required = true, example = "芋艿")
@NotEmpty(message = "SPU 名字不能为空")
private String name;
@ApiModelProperty(value = "卖点", required = true, example = "好吃好玩")
@NotEmpty(message = "卖点不能为空")
private String sellPoint;
@ApiModelProperty(value = "描述", required = true, example = "我是哈哈哈")
@NotEmpty(message = "描述不能为空")
private String description;
@ApiModelProperty(value = "分类编号", required = true, example = "1")
@NotNull(message = "分类编号不能为空")
private Integer cid;
@ApiModelProperty(value = "商品主图地址", required = true, example = "http://www.iocoder.cn/xxx.jpg", notes = "多个之间,使用逗号分隔")
@NotEmpty(message = "商品主图地址不能为空")
private List<String> picUrls;
@ApiModelProperty(value = "是否上架商品", required = true, example = "true")
@NotNull(message = "是否上架商品不能为空")
private Boolean visible;
// ========== SKU =========
/**
* SKU 数组
*/
@NotNull(message = "SKU 不能为空")
@Valid
private List<Sku> skus;
}

View File

@@ -1,34 +0,0 @@
package cn.iocoder.mall.managementweb.controller.product.vo.spu;
import lombok.*;
import io.swagger.annotations.*;
import java.util.*;
@ApiModel("商品 SPU Response VO")
@Data
public class ProductSpuRespVO {
@ApiModelProperty(value = "SPU 编号", required = true)
private Integer id;
@ApiModelProperty(value = "SPU 名字", required = true, example = "芋艿")
private String name;
@ApiModelProperty(value = "卖点", required = true, example = "好吃好玩")
private String sellPoint;
@ApiModelProperty(value = "描述", required = true, example = "我是哈哈哈")
private String description;
@ApiModelProperty(value = "分类编号", required = true, example = "1")
private Integer cid;
@ApiModelProperty(value = "商品主图地址", required = true, example = "http://www.iocoder.cn/xxx.jpg", notes = "多个之间,使用逗号分隔")
private List<String> picUrls;
@ApiModelProperty(value = "是否上架商品", required = true, example = "true")
private Boolean visible;
@ApiModelProperty(value = "排序字段", required = true, example = "1024")
private Integer sort;
@ApiModelProperty(value = "价格", required = true, example = "233", notes = "单位:分")
private Integer price;
@ApiModelProperty(value = "库存数量", required = true, example = "1024")
private Integer quantity;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@@ -1,77 +0,0 @@
package cn.iocoder.mall.managementweb.controller.product.vo.spu;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@ApiModel("商品 SPU 更新 Request VO")
@Data
public class ProductSpuUpdateReqVO {
/**
* SKU 信息
*/
@Data
@Accessors(chain = true)
public static class Sku {
/**
* 规格值数组
*/
@NotNull(message = "规格值数组不能为空")
private List<Integer> attrValueIds;
/**
* 价格,单位:分
*/
@NotNull(message = "价格不能为空")
@Min(value = 1L, message = "最小价格为 1")
private Integer price;
/**
* 库存数量
*/
@NotNull(message = "库存数量不能为空")
@Min(value = 1L, message = "最小库存为 1")
private Integer quantity;
}
@ApiModelProperty(value = "SPU 编号", required = true)
@NotNull(message = "SPU 编号不能为空")
private Integer id;
@ApiModelProperty(value = "SPU 名字", required = true, example = "芋艿")
@NotEmpty(message = "SPU 名字不能为空")
private String name;
@ApiModelProperty(value = "卖点", required = true, example = "好吃好玩")
@NotEmpty(message = "卖点不能为空")
private String sellPoint;
@ApiModelProperty(value = "描述", required = true, example = "我是哈哈哈")
@NotEmpty(message = "描述不能为空")
private String description;
@ApiModelProperty(value = "分类编号", required = true, example = "1")
@NotNull(message = "分类编号不能为空")
private Integer cid;
@ApiModelProperty(value = "商品主图地址", required = true, example = "http://www.iocoder.cn/xxx.jpg", notes = "多个之间,使用逗号分隔")
@NotEmpty(message = "商品主图地址不能为空")
private List<String> picUrls;
@ApiModelProperty(value = "是否上架商品", required = true, example = "true")
@NotNull(message = "是否上架商品不能为空")
private Boolean visible;
// ========== SKU =========
/**
* SKU 数组
*/
@NotNull(message = "SKU 不能为空")
@Valid
private List<ProductSpuCreateReqVO.Sku> skus;
}

View File

@@ -1,39 +0,0 @@
package cn.iocoder.mall.managementweb.convert.product;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.product.vo.attr.*;
import cn.iocoder.mall.productservice.rpc.attr.dto.*;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface ProductAttrConvert {
ProductAttrConvert INSTANCE = Mappers.getMapper(ProductAttrConvert.class);
ProductAttrKeyCreateReqDTO convert(ProductAttrKeyCreateReqVO bean);
ProductAttrKeyUpdateReqDTO convert(ProductAttrKeyUpdateReqVO bean);
ProductAttrKeyRespVO convert(ProductAttrKeyRespDTO bean);
List<ProductAttrKeyRespVO> convertList(List<ProductAttrKeyRespDTO> list);
PageResult<ProductAttrKeyRespVO> convertPage(PageResult<ProductAttrKeyRespDTO> page);
ProductAttrKeyPageReqDTO convert(ProductAttrKeyPageReqVO bean);
ProductAttrValueCreateReqDTO convert(ProductAttrValueCreateReqVO bean);
ProductAttrValueUpdateReqDTO convert(ProductAttrValueUpdateReqVO bean);
ProductAttrValueRespVO convert(ProductAttrValueRespDTO bean);
List<ProductAttrValueRespVO> convertList02(List<ProductAttrValueRespDTO> list);
ProductAttrValueListQueryReqDTO convert(ProductAttrValueListQueryReqVO bean);
}

View File

@@ -1,34 +0,0 @@
package cn.iocoder.mall.managementweb.convert.product;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandCreateReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandPageReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandRespVO;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandUpdateReqVO;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface ProductBrandConvert {
ProductBrandConvert INSTANCE = Mappers.getMapper(ProductBrandConvert.class);
ProductBrandCreateReqDTO convert(ProductBrandCreateReqVO bean);
ProductBrandUpdateReqDTO convert(ProductBrandUpdateReqVO bean);
ProductBrandRespVO convert(ProductBrandRespDTO bean);
List<ProductBrandRespVO> convertList(List<ProductBrandRespDTO> list);
PageResult<ProductBrandRespVO> convertPage(PageResult<ProductBrandRespDTO> page);
ProductBrandPageReqDTO convert(ProductBrandPageReqVO bean);
}

View File

@@ -1,26 +0,0 @@
package cn.iocoder.mall.managementweb.convert.product;
import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryCreateReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryRespVO;
import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryTreeNodeRespVO;
import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryUpdateReqVO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface ProductCategoryConvert {
ProductCategoryConvert INSTANCE = Mappers.getMapper(ProductCategoryConvert.class);
ProductCategoryCreateReqDTO convert(ProductCategoryCreateReqVO bean);
ProductCategoryUpdateReqDTO convert(ProductCategoryUpdateReqVO bean);
ProductCategoryRespVO convert(ProductCategoryRespDTO bean);
ProductCategoryTreeNodeRespVO convertTreeNode(ProductCategoryRespDTO bean);
}

View File

@@ -1,34 +0,0 @@
package cn.iocoder.mall.managementweb.convert.product;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuCreateReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuPageReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuRespVO;
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuUpdateReqVO;
import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuAndSkuCreateReqDTO;
import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuAndSkuUpdateReqDTO;
import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuPageReqDTO;
import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface ProductSpuConvert {
ProductSpuConvert INSTANCE = Mappers.getMapper(ProductSpuConvert.class);
ProductSpuAndSkuCreateReqDTO convert(ProductSpuCreateReqVO bean);
ProductSpuAndSkuUpdateReqDTO convert(ProductSpuUpdateReqVO bean);
ProductSpuRespVO convert(ProductSpuRespDTO bean);
List<ProductSpuRespVO> convertList(List<ProductSpuRespDTO> list);
PageResult<ProductSpuRespVO> convertPage(PageResult<ProductSpuRespDTO> page);
ProductSpuPageReqDTO convert(ProductSpuPageReqVO bean);
}

View File

@@ -1,35 +0,0 @@
package cn.iocoder.mall.managementweb.convert.user;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.user.vo.UserPageReqVO;
import cn.iocoder.mall.managementweb.controller.user.vo.UserRespVO;
import cn.iocoder.mall.managementweb.controller.user.vo.UserUpdateInfoReqVO;
import cn.iocoder.mall.managementweb.controller.user.vo.UserUpdateStatusReqVO;
import cn.iocoder.mall.userservice.rpc.user.dto.UserPageReqDTO;
import cn.iocoder.mall.userservice.rpc.user.dto.UserRespDTO;
import cn.iocoder.mall.userservice.rpc.user.dto.UserUpdateReqDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface UserConvert {
UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);
UserUpdateReqDTO convert(UserUpdateInfoReqVO bean);
UserRespVO convert(UserRespDTO bean);
List<UserRespVO> convertList(List<UserRespDTO> list);
UserPageReqDTO convert(UserPageReqVO bean);
PageResult<UserRespVO> convertPage(PageResult<UserRespDTO> bean);
@Mapping(source = "userId", target = "id")
UserUpdateReqDTO convert(UserUpdateStatusReqVO bean);
}

View File

@@ -1,93 +0,0 @@
package cn.iocoder.mall.managementweb.manager.product;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandCreateReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandPageReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandRespVO;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandUpdateReqVO;
import cn.iocoder.mall.managementweb.convert.product.ProductBrandConvert;
import cn.iocoder.mall.productservice.rpc.brand.ProductBrandFeign;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 商品品牌 Manager
*/
@Service
public class ProductBrandManager {
@Autowired
ProductBrandFeign productBrandFeign;
/**
* 创建商品品牌
*
* @param createVO 创建商品品牌 VO
* @return 商品品牌
*/
public Integer createProductBrand(ProductBrandCreateReqVO createVO) {
CommonResult<Integer> createProductBrandResult = productBrandFeign.createProductBrand(ProductBrandConvert.INSTANCE.convert(createVO));
createProductBrandResult.checkError();
return createProductBrandResult.getData();
}
/**
* 更新商品品牌
*
* @param updateVO 更新商品品牌 VO
*/
public void updateProductBrand(ProductBrandUpdateReqVO updateVO) {
CommonResult<Boolean> updateProductBrandResult = productBrandFeign.updateProductBrand(ProductBrandConvert.INSTANCE.convert(updateVO));
updateProductBrandResult.checkError();
}
/**
* 删除商品品牌
*
* @param productBrandId 商品品牌编号
*/
public void deleteProductBrand(Integer productBrandId) {
CommonResult<Boolean> deleteProductBrandResult = productBrandFeign.deleteProductBrand(productBrandId);
deleteProductBrandResult.checkError();
}
/**
* 获得商品品牌
*
* @param productBrandId 商品品牌编号
* @return 商品品牌
*/
public ProductBrandRespVO getProductBrand(Integer productBrandId) {
CommonResult<ProductBrandRespDTO> getProductBrandResult = productBrandFeign.getProductBrand(productBrandId);
getProductBrandResult.checkError();
return ProductBrandConvert.INSTANCE.convert(getProductBrandResult.getData());
}
/**
* 获得商品品牌列表
*
* @param productBrandIds 商品品牌编号列表
* @return 商品品牌列表
*/
public List<ProductBrandRespVO> listProductBrands(List<Integer> productBrandIds) {
CommonResult<List<ProductBrandRespDTO>> listProductBrandResult = productBrandFeign.listProductBrands(productBrandIds);
listProductBrandResult.checkError();
return ProductBrandConvert.INSTANCE.convertList(listProductBrandResult.getData());
}
/**
* 获得商品品牌分页
*
* @param pageVO 商品品牌分页查询
* @return 商品品牌分页结果
*/
public PageResult<ProductBrandRespVO> pageProductBrand(ProductBrandPageReqVO pageVO) {
CommonResult<PageResult<ProductBrandRespDTO>> pageProductBrandResult = productBrandFeign.pageProductBrand(ProductBrandConvert.INSTANCE.convert(pageVO));
pageProductBrandResult.checkError();
return ProductBrandConvert.INSTANCE.convertPage(pageProductBrandResult.getData());
}
}

View File

@@ -1,106 +0,0 @@
package cn.iocoder.mall.managementweb.manager.product;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryCreateReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryTreeNodeRespVO;
import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryUpdateReqVO;
import cn.iocoder.mall.managementweb.convert.product.ProductCategoryConvert;
import cn.iocoder.mall.productservice.enums.category.ProductCategoryIdEnum;
import cn.iocoder.mall.productservice.rpc.category.ProductCategoryFeign;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* 商品分类表 Manager
*/
@Service
@Slf4j
public class ProductCategoryManager {
@Autowired
private ProductCategoryFeign productCategoryFeign;
/**
* 创建商品分类表
*
* @param createVO 创建商品分类表 VO
* @return 商品分类表
*/
public Integer createProductCategory(ProductCategoryCreateReqVO createVO) {
CommonResult<Integer> createProductCategoryResult = productCategoryFeign.createProductCategory(ProductCategoryConvert.INSTANCE.convert(createVO));
createProductCategoryResult.checkError();
return createProductCategoryResult.getData();
}
/**
* 更新商品分类表
*
* @param updateVO 更新商品分类表 VO
*/
public void updateProductCategory(ProductCategoryUpdateReqVO updateVO) {
CommonResult<Boolean> updateProductCategoryResult = productCategoryFeign.updateProductCategory(ProductCategoryConvert.INSTANCE.convert(updateVO));
updateProductCategoryResult.checkError();
}
/**
* 删除商品分类表
*
* @param productCategoryId 商品分类表编号
*/
public void deleteProductCategory(Integer productCategoryId) {
CommonResult<Boolean> deleteProductCategoryResult = productCategoryFeign.deleteProductCategory(productCategoryId);
deleteProductCategoryResult.checkError();
}
/**
* 获得商品分类树结构
*
* @return 商品分类树结构
*/
public List<ProductCategoryTreeNodeRespVO> treeProductCategory() {
// 获得商品分类全列表
CommonResult<List<ProductCategoryRespDTO>> listProductCategories = productCategoryFeign.listProductCategories(new ProductCategoryListQueryReqDTO());
listProductCategories.checkError();
// 构建菜单树
return buildProductCategoryTree(listProductCategories.getData());
}
/**
* 构建商品分类树
*
* @param productCategories 商品分类列表
* @return 商品分类树
*/
private static List<ProductCategoryTreeNodeRespVO> buildProductCategoryTree(List<ProductCategoryRespDTO> productCategories) {
// 排序,保证菜单的有序性
productCategories.sort(Comparator.comparing(ProductCategoryRespDTO::getSort));
// 构建菜单树
// 使用 LinkedHashMap 的原因,是为了排序 。实际也可以用 Stream API ,就是太丑了。
Map<Integer, ProductCategoryTreeNodeRespVO> treeNodeMap = new LinkedHashMap<>();
productCategories.forEach(category -> treeNodeMap.put(category.getId(), ProductCategoryConvert.INSTANCE.convertTreeNode(category)));
// 处理父子关系
treeNodeMap.values().stream().filter(node -> !node.getPid().equals(ProductCategoryIdEnum.ROOT.getId())).forEach((childNode) -> {
// 获得父节点
ProductCategoryTreeNodeRespVO parentNode = treeNodeMap.get(childNode.getPid());
if (parentNode == null) {
log.error("[buildProductCategoryTree][category({}) 找不到父商品分类({})]", childNode.getId(), childNode.getPid());
return;
}
// 将自己添加到父节点中
if (parentNode.getChildren() == null) {
parentNode.setChildren(new ArrayList<>());
}
parentNode.getChildren().add(childNode);
});
// 获得到所有的根节点
return treeNodeMap.values().stream().filter(node -> node.getPid().equals(ProductCategoryIdEnum.ROOT.getId()))
.collect(Collectors.toList());
}
}

View File

@@ -1,63 +0,0 @@
package cn.iocoder.mall.managementweb.manager.product;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuCreateReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuPageReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuRespVO;
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuUpdateReqVO;
import cn.iocoder.mall.managementweb.convert.product.ProductSpuConvert;
import cn.iocoder.mall.productservice.rpc.spu.ProductSpuFeign;
import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 商品 SPU Manager
*/
@Service
public class ProductSpuManager {
@Autowired
private ProductSpuFeign productSpuFeign;
/**
* 获得商品 SPU
*
* @param productSpuId 商品 SPU编号
* @return 商品 SPU
*/
public ProductSpuRespVO getProductSpu(Integer productSpuId) {
CommonResult<ProductSpuRespDTO> getProductSpuResult = productSpuFeign.getProductSpu(productSpuId);
getProductSpuResult.checkError();
return ProductSpuConvert.INSTANCE.convert(getProductSpuResult.getData());
}
/**
* 获得商品 SPU列表
*
* @param productSpuIds 商品 SPU编号列表
* @return 商品 SPU列表
*/
public List<ProductSpuRespVO> listProductSpus(List<Integer> productSpuIds) {
CommonResult<List<ProductSpuRespDTO>> listProductSpuResult = productSpuFeign.listProductSpus(productSpuIds);
listProductSpuResult.checkError();
return ProductSpuConvert.INSTANCE.convertList(listProductSpuResult.getData());
}
/**
* 获得商品 SPU分页
*
* @param pageVO 商品 SPU分页查询
* @return 商品 SPU分页结果
*/
public PageResult<ProductSpuRespVO> pageProductSpu(ProductSpuPageReqVO pageVO) {
CommonResult<PageResult<ProductSpuRespDTO>> pageProductSpuResult = productSpuFeign.pageProductSpu(ProductSpuConvert.INSTANCE.convert(pageVO));
pageProductSpuResult.checkError();
return ProductSpuConvert.INSTANCE.convertPage(pageProductSpuResult.getData());
}
}