From dc94c472cbfe866d1b301bf8da628e2091b4bfe1 Mon Sep 17 00:00:00 2001 From: HH Date: Tue, 10 May 2022 19:34:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/GoodsDeptCategoryController.java | 8 ++++---- .../service/DeptGoodsCategoryService.java | 9 +++++++++ .../service/GoodsDeptCategoryService.java | 18 ------------------ .../impl/DeptGoodsCategoryServiceImpl.java | 10 ++++------ 4 files changed, 17 insertions(+), 28 deletions(-) delete mode 100644 ghy-goods/src/main/java/com/ghy/goods/service/GoodsDeptCategoryService.java diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsDeptCategoryController.java b/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsDeptCategoryController.java index 19bac7ae..d55e321e 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsDeptCategoryController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsDeptCategoryController.java @@ -5,8 +5,8 @@ import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.core.domain.Ztree; import com.ghy.goods.domain.DeptGoodsCategory; import com.ghy.goods.domain.GoodsCategory; +import com.ghy.goods.service.DeptGoodsCategoryService; import com.ghy.goods.service.GoodsCategoryService; -import com.ghy.goods.service.GoodsDeptCategoryService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -25,7 +25,7 @@ public class GoodsDeptCategoryController extends BaseController { GoodsCategoryService goodsCategoryService; @Resource - GoodsDeptCategoryService goodsDeptCategoryService; + DeptGoodsCategoryService deptGoodsCategoryService; @RequiresPermissions("goods:deptcategory:view") @GetMapping() @@ -60,8 +60,8 @@ public class GoodsDeptCategoryController extends BaseController { @PostMapping("/app/list") @ResponseBody - public AjaxResult appList(@RequestBody DeptGoodsCategory deptGoodsCategory){ - return AjaxResult.success(goodsDeptCategoryService.appList(deptGoodsCategory.getDeptId())); + public AjaxResult appList(@RequestBody DeptGoodsCategory deptGoodsCategory) { + return AjaxResult.success(deptGoodsCategoryService.appList(deptGoodsCategory.getDeptId())); } } diff --git a/ghy-goods/src/main/java/com/ghy/goods/service/DeptGoodsCategoryService.java b/ghy-goods/src/main/java/com/ghy/goods/service/DeptGoodsCategoryService.java index 1b53deca..1bf6b7ba 100644 --- a/ghy-goods/src/main/java/com/ghy/goods/service/DeptGoodsCategoryService.java +++ b/ghy-goods/src/main/java/com/ghy/goods/service/DeptGoodsCategoryService.java @@ -1,5 +1,6 @@ package com.ghy.goods.service; +import com.ghy.common.core.domain.Ztree; import com.ghy.goods.domain.DeptGoodsCategory; import java.util.Collection; @@ -47,4 +48,12 @@ public interface DeptGoodsCategoryService { * @return 分公司类目 */ DeptGoodsCategory get(long id); + + List tree(Long parentId); + + /** + * @param deptId 筛选条件 + * @return 父子层级的list + */ + List appList(Long deptId); } diff --git a/ghy-goods/src/main/java/com/ghy/goods/service/GoodsDeptCategoryService.java b/ghy-goods/src/main/java/com/ghy/goods/service/GoodsDeptCategoryService.java deleted file mode 100644 index 31331125..00000000 --- a/ghy-goods/src/main/java/com/ghy/goods/service/GoodsDeptCategoryService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ghy.goods.service; - -import com.ghy.common.core.domain.Ztree; -import com.ghy.goods.domain.DeptGoodsCategory; - -import java.util.List; - -public interface GoodsDeptCategoryService { - - List tree(Long parentId); - - /** - * @param deptId 筛选条件 - * @return 父子层级的list - */ - List appList(Long deptId); - -} diff --git a/ghy-goods/src/main/java/com/ghy/goods/service/impl/DeptGoodsCategoryServiceImpl.java b/ghy-goods/src/main/java/com/ghy/goods/service/impl/DeptGoodsCategoryServiceImpl.java index 81051500..19c0642c 100644 --- a/ghy-goods/src/main/java/com/ghy/goods/service/impl/DeptGoodsCategoryServiceImpl.java +++ b/ghy-goods/src/main/java/com/ghy/goods/service/impl/DeptGoodsCategoryServiceImpl.java @@ -23,11 +23,9 @@ import java.util.stream.Collectors; public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService { @Resource - private DeptGoodsCategoryMapper goodsCategoryMapper; + private GoodsCategoryService goodsCategoryService; @Resource - GoodsCategoryService goodsCategoryService; - @Resource - DeptGoodsCategoryMapper deptGoodsCategoryMapper; + private DeptGoodsCategoryMapper deptGoodsCategoryMapper; @Override public List list(Long deptId) { @@ -80,7 +78,7 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService { DeptGoodsCategory deptGoodsCategory = new DeptGoodsCategory(); deptGoodsCategory.setDeptId(deptId); // 第一层 - List goodsCategoryList = goodsCategoryMapper.appList(deptGoodsCategory); + List goodsCategoryList = deptGoodsCategoryMapper.appList(deptGoodsCategory); // 第二层 this.fillChild(goodsCategoryList); // 第三层 @@ -105,7 +103,7 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService { private void fillChild(List goodsCategoryList) { List childList; for (DeptGoodsCategory deptGoodsCategory : goodsCategoryList) { - childList = goodsCategoryMapper.appList(deptGoodsCategory); + childList = deptGoodsCategoryMapper.appList(deptGoodsCategory); if (childList.size() > 0) { deptGoodsCategory.setChild(childList); }