封装es存储实体

  1. package com.zsy.common.to.es;
  2. /**
  3. * 传输对象,存储到es的数据
  4. *
  5. * @author: zhangshuaiyin
  6. * @date: 2021/3/12 15:37
  7. */
  8. @Data
  9. public class SkuEsModel {
  10. private Long skuId;
  11. private Long spuId;
  12. private String skuTitle;
  13. private BigDecimal skuPrice;
  14. private String skuImg;
  15. private Long saleCount;
  16. /**
  17. * 是否有库存
  18. */
  19. private Boolean hasStock;
  20. /**
  21. * 热度
  22. */
  23. private Long hotScore;
  24. private Long brandId;
  25. private Long catalogId;
  26. private String brandName;
  27. private String brandImg;
  28. private String catalogName;
  29. private List<Attrs> attrs;
  30. @Data
  31. public static class Attrs {
  32. private Long attrId;
  33. private String attrName;
  34. private String attrValue;
  35. }
  36. }

上架接口定义

  1. /**
  2. * 商品上架功能
  3. *
  4. * @param spuId
  5. * @return
  6. */
  7. @PostMapping("/{spuId}/up")
  8. public R upSpu(@PathVariable Long spuId) {
  9. spuInfoService.up(spuId);
  10. return R.ok();
  11. }

具体实现查看:Github SpuInfoController.java