合并代码
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.common.core.domain.Ztree;
|
||||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||||
import com.ghy.goods.domain.GoodsCategory;
|
import com.ghy.goods.domain.GoodsCategory;
|
||||||
|
import com.ghy.goods.service.DeptGoodsCategoryService;
|
||||||
import com.ghy.goods.service.GoodsCategoryService;
|
import com.ghy.goods.service.GoodsCategoryService;
|
||||||
import com.ghy.goods.service.GoodsDeptCategoryService;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
|
|
@ -25,7 +25,7 @@ public class GoodsDeptCategoryController extends BaseController {
|
||||||
GoodsCategoryService goodsCategoryService;
|
GoodsCategoryService goodsCategoryService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
GoodsDeptCategoryService goodsDeptCategoryService;
|
DeptGoodsCategoryService deptGoodsCategoryService;
|
||||||
|
|
||||||
@RequiresPermissions("goods:deptcategory:view")
|
@RequiresPermissions("goods:deptcategory:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
|
|
@ -60,8 +60,8 @@ public class GoodsDeptCategoryController extends BaseController {
|
||||||
|
|
||||||
@PostMapping("/app/list")
|
@PostMapping("/app/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult appList(@RequestBody DeptGoodsCategory deptGoodsCategory){
|
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;
|
package com.ghy.goods.service;
|
||||||
|
|
||||||
|
import com.ghy.common.core.domain.Ztree;
|
||||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
@ -47,4 +48,12 @@ public interface DeptGoodsCategoryService {
|
||||||
* @return 分公司类目
|
* @return 分公司类目
|
||||||
*/
|
*/
|
||||||
DeptGoodsCategory get(long id);
|
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 {
|
public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DeptGoodsCategoryMapper goodsCategoryMapper;
|
private GoodsCategoryService goodsCategoryService;
|
||||||
@Resource
|
@Resource
|
||||||
GoodsCategoryService goodsCategoryService;
|
private DeptGoodsCategoryMapper deptGoodsCategoryMapper;
|
||||||
@Resource
|
|
||||||
DeptGoodsCategoryMapper deptGoodsCategoryMapper;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeptGoodsCategory> list(Long deptId) {
|
public List<DeptGoodsCategory> list(Long deptId) {
|
||||||
|
|
@ -80,7 +78,7 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
|
||||||
DeptGoodsCategory deptGoodsCategory = new DeptGoodsCategory();
|
DeptGoodsCategory deptGoodsCategory = new DeptGoodsCategory();
|
||||||
deptGoodsCategory.setDeptId(deptId);
|
deptGoodsCategory.setDeptId(deptId);
|
||||||
// 第一层
|
// 第一层
|
||||||
List<DeptGoodsCategory> goodsCategoryList = goodsCategoryMapper.appList(deptGoodsCategory);
|
List<DeptGoodsCategory> goodsCategoryList = deptGoodsCategoryMapper.appList(deptGoodsCategory);
|
||||||
// 第二层
|
// 第二层
|
||||||
this.fillChild(goodsCategoryList);
|
this.fillChild(goodsCategoryList);
|
||||||
// 第三层
|
// 第三层
|
||||||
|
|
@ -105,7 +103,7 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
|
||||||
private void fillChild(List<DeptGoodsCategory> goodsCategoryList) {
|
private void fillChild(List<DeptGoodsCategory> goodsCategoryList) {
|
||||||
List<DeptGoodsCategory> childList;
|
List<DeptGoodsCategory> childList;
|
||||||
for (DeptGoodsCategory deptGoodsCategory : goodsCategoryList) {
|
for (DeptGoodsCategory deptGoodsCategory : goodsCategoryList) {
|
||||||
childList = goodsCategoryMapper.appList(deptGoodsCategory);
|
childList = deptGoodsCategoryMapper.appList(deptGoodsCategory);
|
||||||
if (childList.size() > 0) {
|
if (childList.size() > 0) {
|
||||||
deptGoodsCategory.setChild(childList);
|
deptGoodsCategory.setChild(childList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue