增加数据字典 tree 接口
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
package cn.iocoder.mall.product.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.product.api.ProductAttrService;
|
||||
import cn.iocoder.mall.product.api.bo.ProductAttrPageBO;
|
||||
import cn.iocoder.mall.product.api.bo.ProductAttrSimpleBO;
|
||||
import cn.iocoder.mall.product.api.dto.ProductAttrPageDTO;
|
||||
import cn.iocoder.mall.product.application.convert.ProductAttrConvert;
|
||||
import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrPageVO;
|
||||
import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrSimpleVO;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("admins")
|
||||
@Api("商品规格")
|
||||
public class AdminsProductAttrController {
|
||||
|
||||
@Reference(validation = "true")
|
||||
private ProductAttrService productAttrService;
|
||||
|
||||
@GetMapping("/attr/page")
|
||||
public CommonResult<AdminsProductAttrPageVO> attrPage(@RequestParam(value = "name", required = false) String name,
|
||||
@RequestParam(value = "pageNo", defaultValue = "0") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
// 创建 ProductAttrPageDTO 对象
|
||||
ProductAttrPageDTO productAttrPageDTO = new ProductAttrPageDTO().setName(name).setPageNo(pageNo).setPageSize(pageSize);
|
||||
// 查询分页
|
||||
CommonResult<ProductAttrPageBO> result = productAttrService.getProductAttrPage(productAttrPageDTO);
|
||||
// 返回结果
|
||||
return ProductAttrConvert.INSTANCE.convert2(result);
|
||||
}
|
||||
|
||||
@GetMapping("/attr/tree")
|
||||
public CommonResult<List<AdminsProductAttrSimpleVO>> tree() {
|
||||
// 查询全列表
|
||||
CommonResult<List<ProductAttrSimpleBO>> result = productAttrService.getProductAttrList();
|
||||
// 返回结果
|
||||
return ProductAttrConvert.INSTANCE.convert(result);
|
||||
}
|
||||
|
||||
@PostMapping("/attr/add")
|
||||
public CommonResult addAttr() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public CommonResult<Boolean> updateAttr() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public CommonResult<Boolean> updateAttrStatus() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO 芋艿 暂时不考虑 delete Attr 。因为关联逻辑比较多
|
||||
|
||||
public CommonResult addAttrValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public CommonResult<Boolean> updateAttrValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public CommonResult<Boolean> updateAttrValueStr() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO 芋艿 暂时不考虑 delete Attr Value 。因为关联逻辑比较多
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.iocoder.mall.product.application.convert;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.product.api.bo.ProductAttrPageBO;
|
||||
import cn.iocoder.mall.product.api.bo.ProductAttrSimpleBO;
|
||||
import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrPageVO;
|
||||
import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrSimpleVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ProductAttrConvert {
|
||||
|
||||
ProductAttrConvert INSTANCE = Mappers.getMapper(ProductAttrConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
CommonResult<AdminsProductAttrPageVO> convert2(CommonResult<ProductAttrPageBO> result);
|
||||
|
||||
@Mappings({})
|
||||
CommonResult<List<AdminsProductAttrSimpleVO>> convert(CommonResult<List<ProductAttrSimpleBO>> result);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.iocoder.mall.product.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(value = "商品规格属性和值对 VO")
|
||||
public class AdminsProductAttrAndValuePairVO {
|
||||
|
||||
@ApiModelProperty(value = "规格编号", required = true, example = "1")
|
||||
private Integer attrId;
|
||||
@ApiModelProperty(value = "规格名", required = true, example = "颜色")
|
||||
private String attrName;
|
||||
@ApiModelProperty(value = "规格值", required = true, example = "10")
|
||||
private Integer attrValueId;
|
||||
@ApiModelProperty(value = "规格值名", required = true, example = "红色")
|
||||
private String attrValueName;
|
||||
|
||||
public Integer getAttrId() {
|
||||
return attrId;
|
||||
}
|
||||
|
||||
public AdminsProductAttrAndValuePairVO setAttrId(Integer attrId) {
|
||||
this.attrId = attrId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAttrName() {
|
||||
return attrName;
|
||||
}
|
||||
|
||||
public AdminsProductAttrAndValuePairVO setAttrName(String attrName) {
|
||||
this.attrName = attrName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getAttrValueId() {
|
||||
return attrValueId;
|
||||
}
|
||||
|
||||
public AdminsProductAttrAndValuePairVO setAttrValueId(Integer attrValueId) {
|
||||
this.attrValueId = attrValueId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAttrValueName() {
|
||||
return attrValueName;
|
||||
}
|
||||
|
||||
public AdminsProductAttrAndValuePairVO setAttrValueName(String attrValueName) {
|
||||
this.attrValueName = attrValueName;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,51 +3,65 @@ package cn.iocoder.mall.product.application.vo.admins;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(value = "商品规格 VO")
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "商品规格明细 VO", description = "带有规格值数组")
|
||||
public class AdminsProductAttrDetailVO {
|
||||
|
||||
@ApiModelProperty(value = "规格编号", required = true, example = "1")
|
||||
private Integer attrId;
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "规格名", required = true, example = "颜色")
|
||||
private String attrName;
|
||||
@ApiModelProperty(value = "规格值", required = true, example = "10")
|
||||
private Integer attrValueId;
|
||||
@ApiModelProperty(value = "规格值名", required = true, example = "红色")
|
||||
private String attrValueName;
|
||||
private String name;
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳")
|
||||
private Date createTime;
|
||||
@ApiModelProperty(value = "规格值数组", required = true)
|
||||
private List<AdminsProductAttrValueDetailVO> values;
|
||||
|
||||
public Integer getAttrId() {
|
||||
return attrId;
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public AdminsProductAttrDetailVO setAttrId(Integer attrId) {
|
||||
this.attrId = attrId;
|
||||
public AdminsProductAttrDetailVO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAttrName() {
|
||||
return attrName;
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public AdminsProductAttrDetailVO setAttrName(String attrName) {
|
||||
this.attrName = attrName;
|
||||
public AdminsProductAttrDetailVO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getAttrValueId() {
|
||||
return attrValueId;
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public AdminsProductAttrDetailVO setAttrValueId(Integer attrValueId) {
|
||||
this.attrValueId = attrValueId;
|
||||
public AdminsProductAttrDetailVO setStatus(Integer status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAttrValueName() {
|
||||
return attrValueName;
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public AdminsProductAttrDetailVO setAttrValueName(String attrValueName) {
|
||||
this.attrValueName = attrValueName;
|
||||
public AdminsProductAttrDetailVO setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<AdminsProductAttrValueDetailVO> getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public AdminsProductAttrDetailVO setValues(List<AdminsProductAttrValueDetailVO> values) {
|
||||
this.values = values;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package cn.iocoder.mall.product.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "商品规格明细分页 VO")
|
||||
public class AdminsProductAttrPageVO {
|
||||
|
||||
@ApiModelProperty(value = "规格数组", required = true)
|
||||
private List<AdminsProductAttrDetailVO> attrs;
|
||||
@ApiModelProperty(value = "总数", required = true)
|
||||
private Integer count;
|
||||
|
||||
public List<AdminsProductAttrDetailVO> getAttrs() {
|
||||
return attrs;
|
||||
}
|
||||
|
||||
public AdminsProductAttrPageVO setAttrs(List<AdminsProductAttrDetailVO> attrs) {
|
||||
this.attrs = attrs;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public AdminsProductAttrPageVO setCount(Integer count) {
|
||||
this.count = count;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.iocoder.mall.product.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "商品规格精简 VO", description = "带有规格值数组")
|
||||
public class AdminsProductAttrSimpleVO {
|
||||
|
||||
@ApiModelProperty(value = "规格编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "规格名", required = true, example = "颜色")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "规格值数组", required = true)
|
||||
private List<AdminsProductAttrValueSimpleVO> values;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public AdminsProductAttrSimpleVO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public AdminsProductAttrSimpleVO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<AdminsProductAttrValueSimpleVO> getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public AdminsProductAttrSimpleVO setValues(List<AdminsProductAttrValueSimpleVO> values) {
|
||||
this.values = values;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.mall.product.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel(value = "商品规格 VO", description = "不带有规格值数组")
|
||||
public class AdminsProductAttrVO {
|
||||
|
||||
@ApiModelProperty(value = "规格编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "规格名", required = true, example = "颜色")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package cn.iocoder.mall.product.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel(value = "商品规格值 VO")
|
||||
public class AdminsProductAttrValueDetailVO {
|
||||
|
||||
@ApiModelProperty(value = "规格值编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "规格值名", required = true, example = "颜色")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳")
|
||||
private Date createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public AdminsProductAttrValueDetailVO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public AdminsProductAttrValueDetailVO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public AdminsProductAttrValueDetailVO setStatus(Integer status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public AdminsProductAttrValueDetailVO setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.iocoder.mall.product.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(value = "商品规格值精简 VO")
|
||||
public class AdminsProductAttrValueSimpleVO {
|
||||
|
||||
@ApiModelProperty(value = "规格值编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "规格值名", required = true, example = "颜色")
|
||||
private String name;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public AdminsProductAttrValueSimpleVO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public AdminsProductAttrValueSimpleVO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public class AdminsProductSkuDetailVO {
|
||||
@ApiModelProperty(value = "图片地址", required = true, example = "http://www.iocoder.cn")
|
||||
private String picURL;
|
||||
@ApiModelProperty(value = "规格值数组", required = true)
|
||||
private List<AdminsProductAttrDetailVO> attrs;
|
||||
private List<AdminsProductAttrAndValuePairVO> attrs;
|
||||
@ApiModelProperty(value = "价格,单位:分", required = true, example = "100")
|
||||
private Integer price;
|
||||
@ApiModelProperty(value = "库存数量", required = true, example = "100")
|
||||
@@ -68,11 +68,11 @@ public class AdminsProductSkuDetailVO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<AdminsProductAttrDetailVO> getAttrs() {
|
||||
public List<AdminsProductAttrAndValuePairVO> getAttrs() {
|
||||
return attrs;
|
||||
}
|
||||
|
||||
public AdminsProductSkuDetailVO setAttrs(List<AdminsProductAttrDetailVO> attrs) {
|
||||
public AdminsProductSkuDetailVO setAttrs(List<AdminsProductAttrAndValuePairVO> attrs) {
|
||||
this.attrs = attrs;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
package cn.iocoder.mall.product.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("商品 SPU 分页 VO")
|
||||
public class AdminsProductSpuPageVO {
|
||||
|
||||
/**
|
||||
* spu 数组
|
||||
*/
|
||||
@ApiModelProperty(value = "spu 数组", required = true)
|
||||
private List<AdminsProductSpuVO> spus;
|
||||
/**
|
||||
* 总数
|
||||
*/
|
||||
@ApiModelProperty(value = "总数", required = true)
|
||||
private Integer count;
|
||||
|
||||
public List<AdminsProductSpuVO> getSpus() {
|
||||
|
||||
Reference in New Issue
Block a user