feat(手机端): 商品列表

添加分类图片展示
master
hequan_waynaqua 4 years ago
parent 43c5a7b913
commit 98b9b7aaa3

@ -190,6 +190,6 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
@Override
public R selectListPageByCateIds(Page<Goods> page, List<Long> l2cateList) {
return R.success().add("data", goodsMapper.selectGoodsListPageByl2CateId(page, l2cateList).getRecords());
return R.success().add("goods", goodsMapper.selectGoodsListPageByl2CateId(page, l2cateList).getRecords());
}
}

@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@ -58,12 +59,23 @@ public class CategoryController extends BaseController {
return success;
}
@GetMapping("goods")
public R listGoodsByFirstCate(@RequestParam(defaultValue = "0") Long cateId) {
@GetMapping("firstCategoryGoods")
public R firstCateGoods(@RequestParam(defaultValue = "0") Long cateId) {
Page<Goods> page = getPage();
List<Category> categoryList = iCategoryService.list(new QueryWrapper<Category>().select("id").eq("pid", cateId));
List<Long> cateList = categoryList.stream().map(Category::getId).collect(Collectors.toList());
return iGoodsService.selectListPageByCateIds(page, cateList);
R success = iGoodsService.selectListPageByCateIds(page, cateList);
success.add("category", iCategoryService.getById(cateId));
return success;
}
@GetMapping("secondCategoryGoods")
public R secondCateGoods(@RequestParam(defaultValue = "0") Long cateId) {
Page<Goods> page = getPage();
List<Long> cateList = Arrays.asList(cateId);
R success = iGoodsService.selectListPageByCateIds(page, cateList);
success.add("category", iCategoryService.getById(cateId));
return success;
}

Loading…
Cancel
Save