正版python深度学习逻辑算法与编程
80.9元
(需用券)
去购买 >
查询所有商品分类
遍历每个分类
如果能查到父级,就将子类放入父级中
根据分类Id查询商品列表
最后将查询到的商品放入分类中
controller代码
@GetMapping("/list")
@ApiOperation(value = "分类下的商品", notes = "所有分类包含商品", produces = "application/json")
public ResultPoJo> getCategoryproducts(Pagination pagination,String keyword) {
LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().orderByAsc(YxJpProductCategory::getSort).orderByDesc(YxJpProductCategory::getCreateDate);
CommonUtil.emptyStr(keyword).ifPresent(key -> queryWrapper.and(andQw ->
andQw.or(orQw -> orQw.like(YxJpProductCategory::getName, key))