封装es存储实体
package com.zsy.common.to.es;
/**
* 传输对象,存储到es的数据
*
* @author: zhangshuaiyin
* @date: 2021/3/12 15:37
*/
@Data
public class SkuEsModel {
private Long skuId;
private Long spuId;
private String skuTitle;
private BigDecimal skuPrice;
private String skuImg;
private Long saleCount;
/**
* 是否有库存
*/
private Boolean hasStock;
/**
* 热度
*/
private Long hotScore;
private Long brandId;
private Long catalogId;
private String brandName;
private String brandImg;
private String catalogName;
private List<Attrs> attrs;
@Data
public static class Attrs {
private Long attrId;
private String attrName;
private String attrValue;
}
}
上架接口定义
/**
* 商品上架功能
*
* @param spuId
* @return
*/
@PostMapping("/{spuId}/up")
public R upSpu(@PathVariable Long spuId) {
spuInfoService.up(spuId);
return R.ok();
}
具体实现查看:Github SpuInfoController.java