diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/system/SysDeptController.java b/ghy-admin/src/main/java/com/ghy/web/controller/system/SysDeptController.java index 99e866c0..b78fc5aa 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/system/SysDeptController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/system/SysDeptController.java @@ -1,6 +1,8 @@ package com.ghy.web.controller.system; import java.util.List; + +import com.ghy.common.core.domain.entity.SysUser; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -178,7 +180,7 @@ public class SysDeptController extends BaseController @ResponseBody public List treeData() { - List ztrees = deptService.selectDeptTree(new SysDept()); + List ztrees = deptService.selectDeptTree(this.isAdmin()); return ztrees; } @@ -205,4 +207,15 @@ public class SysDeptController extends BaseController List ztrees = deptService.roleDeptTreeData(role); return ztrees; } + + /** + * 判断是否为主公司。 + * */ + public SysDept isAdmin(){ + SysDept dept = new SysDept(); + if(this.getSysUser().getDept().getParentId() != UserConstants.SYS_ADMIN_DEPT){ + dept.setParentId(this.getSysUser().getDept().getParentId()); + } + return dept; + } } diff --git a/ghy-common/src/main/java/com/ghy/common/constant/UserConstants.java b/ghy-common/src/main/java/com/ghy/common/constant/UserConstants.java index 6213bc45..1e52a64e 100644 --- a/ghy-common/src/main/java/com/ghy/common/constant/UserConstants.java +++ b/ghy-common/src/main/java/com/ghy/common/constant/UserConstants.java @@ -7,6 +7,9 @@ package com.ghy.common.constant; */ public class UserConstants { + + public static final long SYS_ADMIN_DEPT = 101L; + /** * 平台内系统用户的唯一标志 */