商品品牌的迁移,准备和前端管理后台对接

This commit is contained in:
YunaiV
2020-07-25 22:29:38 +08:00
parent 2b8459680b
commit 24f3e697b8
81 changed files with 931 additions and 2169 deletions

View File

@@ -0,0 +1,82 @@
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

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

@@ -0,0 +1,19 @@
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

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

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

@@ -16,7 +16,7 @@ public class ProductCategoryRespVO {
private Integer pid;
@ApiModelProperty(value = "分类名称", required = true, example = "手机")
private String name;
@ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊")
@ApiModelProperty(value = "分类描述", required = true, example = "这个商品分类很吊")
private String description;
@ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;