|
@@ -10,6 +10,7 @@ import com.qs.mp.admin.domain.GoodsCategory;
|
|
|
import com.qs.mp.admin.domain.GoodsSku;
|
|
|
import com.qs.mp.admin.domain.GoodsTag;
|
|
|
import com.qs.mp.admin.domain.GoodsTagRel;
|
|
|
+import com.qs.mp.admin.domain.vo.GoodsCategoryTreeVO;
|
|
|
import com.qs.mp.admin.domain.vo.GoodsListVO;
|
|
|
import com.qs.mp.admin.domain.vo.GoodsVO;
|
|
|
import com.qs.mp.admin.service.IExchangeBannerService;
|
|
@@ -79,6 +80,39 @@ public class UserExchangeController extends BaseApiController {
|
|
|
@Autowired
|
|
|
private MapperFacade mapperFacade;
|
|
|
|
|
|
+ @PostMapping("/category/listTree")
|
|
|
+ @ApiOperation("商品分类树状列表")
|
|
|
+ @ApiResponses(
|
|
|
+ @ApiResponse(code = 200, message = "success" , response = GoodsCategoryTreeVO.class)
|
|
|
+ )
|
|
|
+ public TableDataInfo listTree(@RequestBody JSONObject param) {
|
|
|
+ startPage();
|
|
|
+
|
|
|
+ // 获取父分类
|
|
|
+ List<GoodsCategory> categoryList = goodsCategoryService.list(
|
|
|
+ new LambdaQueryWrapper<GoodsCategory>()
|
|
|
+ .eq(GoodsCategory::getParentId, 0)
|
|
|
+ .orderByDesc(GoodsCategory::getSort));
|
|
|
+ if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isEmpty(categoryList)) {
|
|
|
+ return getErrorDataTable("分类信息不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<GoodsCategoryTreeVO> treeList = categoryList.stream().map(goodsCategory -> {
|
|
|
+ GoodsCategoryTreeVO goodsCategoryTreeVO = new GoodsCategoryTreeVO();
|
|
|
+ BeanUtils.copyProperties(goodsCategory, goodsCategoryTreeVO);
|
|
|
+ // 获取子分类
|
|
|
+ List<GoodsCategory> list = goodsCategoryService.list(
|
|
|
+ new LambdaQueryWrapper<GoodsCategory>()
|
|
|
+ .eq(GoodsCategory::getParentId, goodsCategory.getCategoryId())
|
|
|
+ .orderByDesc(GoodsCategory::getSort));
|
|
|
+ goodsCategoryTreeVO.setGoodsCategoryList(list);
|
|
|
+ return goodsCategoryTreeVO;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ return getDataTable(treeList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 商品列表
|
|
|
*/
|