合并代码
This commit is contained in:
parent
82f1cdbad6
commit
dc94c472cb
|
|
@ -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()
|
||||
|
|
@ -61,7 +61,7 @@ public class GoodsDeptCategoryController extends BaseController {
|
|||
@PostMapping("/app/list")
|
||||
@ResponseBody
|
||||
public AjaxResult appList(@RequestBody DeptGoodsCategory deptGoodsCategory) {
|
||||
return AjaxResult.success(goodsDeptCategoryService.appList(deptGoodsCategory.getDeptId()));
|
||||
return AjaxResult.success(deptGoodsCategoryService.appList(deptGoodsCategory.getDeptId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Ztree> tree(Long parentId);
|
||||
|
||||
/**
|
||||
* @param deptId 筛选条件
|
||||
* @return 父子层级的list
|
||||
*/
|
||||
List<DeptGoodsCategory> appList(Long deptId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Ztree> tree(Long parentId);
|
||||
|
||||
/**
|
||||
* @param deptId 筛选条件
|
||||
* @return 父子层级的list
|
||||
*/
|
||||
List<DeptGoodsCategory> appList(Long deptId);
|
||||
|
||||
}
|
||||
|
|
@ -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<DeptGoodsCategory> list(Long deptId) {
|
||||
|
|
@ -80,7 +78,7 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
|
|||
DeptGoodsCategory deptGoodsCategory = new DeptGoodsCategory();
|
||||
deptGoodsCategory.setDeptId(deptId);
|
||||
// 第一层
|
||||
List<DeptGoodsCategory> goodsCategoryList = goodsCategoryMapper.appList(deptGoodsCategory);
|
||||
List<DeptGoodsCategory> goodsCategoryList = deptGoodsCategoryMapper.appList(deptGoodsCategory);
|
||||
// 第二层
|
||||
this.fillChild(goodsCategoryList);
|
||||
// 第三层
|
||||
|
|
@ -105,7 +103,7 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
|
|||
private void fillChild(List<DeptGoodsCategory> goodsCategoryList) {
|
||||
List<DeptGoodsCategory> childList;
|
||||
for (DeptGoodsCategory deptGoodsCategory : goodsCategoryList) {
|
||||
childList = goodsCategoryMapper.appList(deptGoodsCategory);
|
||||
childList = deptGoodsCategoryMapper.appList(deptGoodsCategory);
|
||||
if (childList.size() > 0) {
|
||||
deptGoodsCategory.setChild(childList);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue