根据类目查询师傅列表,商品列表修改

This commit is contained in:
donqi 2022-08-04 23:29:09 +08:00
parent e75f738c4d
commit 77e60de9ef
4 changed files with 28 additions and 0 deletions

View File

@ -75,6 +75,19 @@ public class GoodsController extends BaseController {
if (goodsCategory.getLevel() == 0) {
goods.setDeptGoodsCategoryId(null);
} else if (goodsCategory.getLevel() == 1) {
GoodsCategory params = new GoodsCategory();
params.setParentCategoryId(goodsCategory.getGoodsCategoryId());
List<GoodsCategory> secondCategories = goodsCategoryService.selectGoodsCategoryList(params);
List<Long> secondCategoryIds = secondCategories.stream().map(GoodsCategory::getGoodsCategoryId).collect(Collectors.toList());
List<Long> thirdCategoryIds = new ArrayList<Long>();
secondCategoryIds.forEach(id -> {
params.setParentCategoryId(id);
List<GoodsCategory> thirdCategories = goodsCategoryService.selectGoodsCategoryList(params);
thirdCategoryIds.addAll(thirdCategories.stream().map(GoodsCategory::getGoodsCategoryId).collect(Collectors.toList()));
});
goods.setDeptGoodsCategoryId(null);
goods.setDeptGoodsCategoryIds(thirdCategoryIds);
} else if (goodsCategory.getLevel() == 2) {
GoodsCategory params = new GoodsCategory();
params.setParentCategoryId(goodsCategory.getGoodsCategoryId());
List<GoodsCategory> filteredCategory = goodsCategoryService.selectGoodsCategoryList(params);

View File

@ -139,6 +139,19 @@ public class WorkerController extends BaseController {
if (goodsCategory.getLevel() == 0) {
workerGoodsCategory.setGoodsCategoryId(null);
} else if (goodsCategory.getLevel() == 1) {
GoodsCategory params = new GoodsCategory();
params.setParentCategoryId(goodsCategory.getGoodsCategoryId());
List<GoodsCategory> secondCategories = goodsCategoryService.selectGoodsCategoryList(params);
List<Long> secondCategoryIds = secondCategories.stream().map(GoodsCategory::getGoodsCategoryId).collect(Collectors.toList());
List<Long> thirdCategoryIds = new ArrayList<Long>();
secondCategoryIds.forEach(id -> {
params.setParentCategoryId(id);
List<GoodsCategory> thirdCategories = goodsCategoryService.selectGoodsCategoryList(params);
thirdCategoryIds.addAll(thirdCategories.stream().map(GoodsCategory::getGoodsCategoryId).collect(Collectors.toList()));
});
workerGoodsCategory.setGoodsCategoryId(null);
workerGoodsCategory.setGoodsCategoryIds(thirdCategoryIds);
} else if (goodsCategory.getLevel() == 2) {
GoodsCategory params = new GoodsCategory();
params.setParentCategoryId(goodsCategory.getGoodsCategoryId());
List<GoodsCategory> filteredCategory = goodsCategoryService.selectGoodsCategoryList(params);

View File

@ -101,6 +101,7 @@
AND dept_goods_category_id = #{deptGoodsCategoryId}
</if>
<if test="deptGoodsCategoryIds != null">
AND dept_goods_category_id in
<foreach collection="deptGoodsCategoryIds" item="deptGoodsCategoryId" open="(" separator="," close=")">
#{deptGoodsCategoryId}
</foreach>

View File

@ -57,6 +57,7 @@
AND wgc.goods_category_id = #{goodsCategoryId}
</if>
<if test="goodsCategoryIds != null">
AND wgc.goods_category_id in
<foreach collection="goodsCategoryIds" item="goodsCategoryId" open="(" separator="," close=")">
#{goodsCategoryId}
</foreach>