根据类目查询师傅列表,商品列表修改
This commit is contained in:
parent
e75f738c4d
commit
77e60de9ef
|
|
@ -75,6 +75,19 @@ public class GoodsController extends BaseController {
|
||||||
if (goodsCategory.getLevel() == 0) {
|
if (goodsCategory.getLevel() == 0) {
|
||||||
goods.setDeptGoodsCategoryId(null);
|
goods.setDeptGoodsCategoryId(null);
|
||||||
} else if (goodsCategory.getLevel() == 1) {
|
} 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();
|
GoodsCategory params = new GoodsCategory();
|
||||||
params.setParentCategoryId(goodsCategory.getGoodsCategoryId());
|
params.setParentCategoryId(goodsCategory.getGoodsCategoryId());
|
||||||
List<GoodsCategory> filteredCategory = goodsCategoryService.selectGoodsCategoryList(params);
|
List<GoodsCategory> filteredCategory = goodsCategoryService.selectGoodsCategoryList(params);
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,19 @@ public class WorkerController extends BaseController {
|
||||||
if (goodsCategory.getLevel() == 0) {
|
if (goodsCategory.getLevel() == 0) {
|
||||||
workerGoodsCategory.setGoodsCategoryId(null);
|
workerGoodsCategory.setGoodsCategoryId(null);
|
||||||
} else if (goodsCategory.getLevel() == 1) {
|
} 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();
|
GoodsCategory params = new GoodsCategory();
|
||||||
params.setParentCategoryId(goodsCategory.getGoodsCategoryId());
|
params.setParentCategoryId(goodsCategory.getGoodsCategoryId());
|
||||||
List<GoodsCategory> filteredCategory = goodsCategoryService.selectGoodsCategoryList(params);
|
List<GoodsCategory> filteredCategory = goodsCategoryService.selectGoodsCategoryList(params);
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,7 @@
|
||||||
AND dept_goods_category_id = #{deptGoodsCategoryId}
|
AND dept_goods_category_id = #{deptGoodsCategoryId}
|
||||||
</if>
|
</if>
|
||||||
<if test="deptGoodsCategoryIds != null">
|
<if test="deptGoodsCategoryIds != null">
|
||||||
|
AND dept_goods_category_id in
|
||||||
<foreach collection="deptGoodsCategoryIds" item="deptGoodsCategoryId" open="(" separator="," close=")">
|
<foreach collection="deptGoodsCategoryIds" item="deptGoodsCategoryId" open="(" separator="," close=")">
|
||||||
#{deptGoodsCategoryId}
|
#{deptGoodsCategoryId}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@
|
||||||
AND wgc.goods_category_id = #{goodsCategoryId}
|
AND wgc.goods_category_id = #{goodsCategoryId}
|
||||||
</if>
|
</if>
|
||||||
<if test="goodsCategoryIds != null">
|
<if test="goodsCategoryIds != null">
|
||||||
|
AND wgc.goods_category_id in
|
||||||
<foreach collection="goodsCategoryIds" item="goodsCategoryId" open="(" separator="," close=")">
|
<foreach collection="goodsCategoryIds" item="goodsCategoryId" open="(" separator="," close=")">
|
||||||
#{goodsCategoryId}
|
#{goodsCategoryId}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue