parent
335c19e62d
commit
03f6b2b82c
@ -1,32 +0,0 @@
|
||||
package cn.iocoder.mall.product.application.controller.users;
|
||||
|
||||
import cn.iocoder.mall.product.api.ProductSpuService;
|
||||
import cn.iocoder.mall.product.api.bo.ProductSpuBO;
|
||||
import cn.iocoder.mall.product.application.vo.ProductSpuListVO;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("user/product/spu")
|
||||
public class ProductSpuController {
|
||||
|
||||
@Reference(validation = "true")
|
||||
private ProductSpuService productSpuService;
|
||||
|
||||
// TODO 详情
|
||||
@GetMapping("/info")
|
||||
public ProductSpuBO info(@RequestParam("id") Integer id) {
|
||||
// return productSpuService.getProductSpu(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO 分页
|
||||
@GetMapping("/list")
|
||||
public ProductSpuListVO list() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package cn.iocoder.mall.product.application.controller.users;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.product.api.ProductSpuService;
|
||||
import cn.iocoder.mall.product.api.bo.ProductSpuPageBO;
|
||||
import cn.iocoder.mall.product.api.dto.ProductSpuPageDTO;
|
||||
import cn.iocoder.mall.product.application.convert.ProductSpuConvert;
|
||||
import cn.iocoder.mall.product.application.vo.users.UsersProductSpuDetailVO;
|
||||
import cn.iocoder.mall.product.application.vo.users.UsersProductSpuPageVO;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("users/spu")
|
||||
@Api("商品 SPU + SKU")
|
||||
public class UsersProductSpuController {
|
||||
|
||||
@Reference(validation = "true")
|
||||
private ProductSpuService productSpuService;
|
||||
|
||||
@GetMapping("/info")
|
||||
@ApiOperation("商品 SPU 明细")
|
||||
@ApiImplicitParam(name = "id", value = "SPU 编号", required = true, example = "100")
|
||||
public CommonResult<UsersProductSpuDetailVO> info(@RequestParam("id") Integer id) {
|
||||
return ProductSpuConvert.INSTANCE.convert4(productSpuService.getProductSpu(id));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("商品 SPU 分页列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "cid", value = "分类编号", example = "1"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "页码,从 0 开始", example = "0"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, example = "10"),
|
||||
})
|
||||
public CommonResult<UsersProductSpuPageVO> page(@RequestParam(value = "cid", required = false) Integer cid,
|
||||
@RequestParam(value = "pageNo", defaultValue = "0") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
// 创建 ProductSpuPageDTO 对象
|
||||
ProductSpuPageDTO productSpuPageDTO = new ProductSpuPageDTO().setCid(cid).setVisible(true)
|
||||
.setPageNo(pageNo).setPageSize(pageSize);
|
||||
// 查询分页
|
||||
CommonResult<ProductSpuPageBO> result = productSpuService.getProductSpuPage(productSpuPageDTO);
|
||||
// 返回结果
|
||||
return ProductSpuConvert.INSTANCE.convert3(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package cn.iocoder.mall.product.application.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ProductSpuListVO {
|
||||
|
||||
/**
|
||||
* SPU 数组
|
||||
*/
|
||||
private List<ProductSpuVO> list;
|
||||
/**
|
||||
* 是否还有下一页
|
||||
*/
|
||||
private Boolean hasNext;
|
||||
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
package cn.iocoder.mall.product.application.vo;
|
||||
|
||||
public class ProductSpuVO {
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
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 AdminsProductAttrValueVO {
|
||||
|
||||
@ApiModelProperty(value = "规格值编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "规格编号", required = true, example = "1")
|
||||
private Integer attrId;
|
||||
@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 AdminsProductAttrValueVO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public AdminsProductAttrValueVO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public AdminsProductAttrValueVO setStatus(Integer status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public AdminsProductAttrValueVO setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getAttrId() {
|
||||
return attrId;
|
||||
}
|
||||
|
||||
public AdminsProductAttrValueVO setAttrId(Integer attrId) {
|
||||
this.attrId = attrId;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package cn.iocoder.mall.product.application.vo.users;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(value = "商品规格属性和值对 VO")
|
||||
public class UsersProductAttrAndValuePairVO {
|
||||
|
||||
@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 UsersProductAttrAndValuePairVO setAttrId(Integer attrId) {
|
||||
this.attrId = attrId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAttrName() {
|
||||
return attrName;
|
||||
}
|
||||
|
||||
public UsersProductAttrAndValuePairVO setAttrName(String attrName) {
|
||||
this.attrName = attrName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getAttrValueId() {
|
||||
return attrValueId;
|
||||
}
|
||||
|
||||
public UsersProductAttrAndValuePairVO setAttrValueId(Integer attrValueId) {
|
||||
this.attrValueId = attrValueId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAttrValueName() {
|
||||
return attrValueName;
|
||||
}
|
||||
|
||||
public UsersProductAttrAndValuePairVO setAttrValueName(String attrValueName) {
|
||||
this.attrValueName = attrValueName;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
package cn.iocoder.mall.product.application.vo.users;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品 Sku 明细 BO
|
||||
*/
|
||||
public class UsersProductSkuDetailVO {
|
||||
|
||||
@ApiModelProperty(value = "sku 编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "SPU 编号", required = true, example = "1")
|
||||
private Integer spuId;
|
||||
@ApiModelProperty(value = "图片地址", required = true, example = "http://www.iocoder.cn")
|
||||
private String picURL;
|
||||
@ApiModelProperty(value = "规格值数组", required = true)
|
||||
private List<UsersProductAttrAndValuePairVO> attrs;
|
||||
@ApiModelProperty(value = "价格,单位:分", required = true, example = "100")
|
||||
private Integer price;
|
||||
@ApiModelProperty(value = "库存数量", required = true, example = "100")
|
||||
private Integer quantity;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public UsersProductSkuDetailVO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getSpuId() {
|
||||
return spuId;
|
||||
}
|
||||
|
||||
public UsersProductSkuDetailVO setSpuId(Integer spuId) {
|
||||
this.spuId = spuId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPicURL() {
|
||||
return picURL;
|
||||
}
|
||||
|
||||
public UsersProductSkuDetailVO setPicURL(String picURL) {
|
||||
this.picURL = picURL;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public UsersProductSkuDetailVO setPrice(Integer price) {
|
||||
this.price = price;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public UsersProductSkuDetailVO setQuantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<UsersProductAttrAndValuePairVO> getAttrs() {
|
||||
return attrs;
|
||||
}
|
||||
|
||||
public UsersProductSkuDetailVO setAttrs(List<UsersProductAttrAndValuePairVO> attrs) {
|
||||
this.attrs = attrs;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.mall.product.application.vo.users;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "商品 SPU 详细 VO", description = "包括 SKU 信息 VO")
|
||||
public class UsersProductSpuDetailVO {
|
||||
|
||||
@ApiModelProperty(value = "SPU 编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
|
||||
// ========== 基本信息 =========
|
||||
@ApiModelProperty(value = "SPU 名字", required = true, example = "厮大牛逼")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "卖点", required = true, example = "各种 MQ 骚操作")
|
||||
private String sellPoint;
|
||||
@ApiModelProperty(value = "描述", required = true, example = "你就说强不强")
|
||||
private String description;
|
||||
@ApiModelProperty(value = "分类编号", required = true, example = "反正我是信了")
|
||||
private Integer cid;
|
||||
@ApiModelProperty(value = "商品主图地址的数组", required = true, example = "http://www.iocoder.cn")
|
||||
private List<String> picUrls;
|
||||
|
||||
// ========== SKU =========
|
||||
|
||||
/**
|
||||
* SKU 数组
|
||||
*/
|
||||
private List<UsersProductSkuDetailVO> skus;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public UsersProductSpuDetailVO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public UsersProductSpuDetailVO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSellPoint() {
|
||||
return sellPoint;
|
||||
}
|
||||
|
||||
public UsersProductSpuDetailVO setSellPoint(String sellPoint) {
|
||||
this.sellPoint = sellPoint;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public UsersProductSpuDetailVO setDescription(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getCid() {
|
||||
return cid;
|
||||
}
|
||||
|
||||
public UsersProductSpuDetailVO setCid(Integer cid) {
|
||||
this.cid = cid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getPicUrls() {
|
||||
return picUrls;
|
||||
}
|
||||
|
||||
public UsersProductSpuDetailVO setPicUrls(List<String> picUrls) {
|
||||
this.picUrls = picUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<UsersProductSkuDetailVO> getSkus() {
|
||||
return skus;
|
||||
}
|
||||
|
||||
public UsersProductSpuDetailVO setSkus(List<UsersProductSkuDetailVO> skus) {
|
||||
this.skus = skus;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.mall.product.application.vo.users;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("商品 SPU 分页 VO")
|
||||
public class UsersProductSpuPageVO {
|
||||
|
||||
@ApiModelProperty(value = "spu 数组", required = true)
|
||||
private List<UsersProductSpuVO> spus;
|
||||
@ApiModelProperty(value = "总数", required = true)
|
||||
private Integer count;
|
||||
|
||||
public List<UsersProductSpuVO> getSpus() {
|
||||
return spus;
|
||||
}
|
||||
|
||||
public UsersProductSpuPageVO setSpus(List<UsersProductSpuVO> spus) {
|
||||
this.spus = spus;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public UsersProductSpuPageVO setCount(Integer count) {
|
||||
this.count = count;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue