From f650c0a833c732f1f22e322a94103977c735ec8e Mon Sep 17 00:00:00 2001 From: clunt Date: Tue, 15 Mar 2022 14:30:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=94=A8=E6=88=B7=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E5=85=AC=E5=8F=B8=E7=99=BB=E9=99=86=E8=BF=9B=E6=9D=A5?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E7=9C=8B=E5=88=B0=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=8D=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/system/SysDeptController.java | 15 ++++++++++++++- .../com/ghy/common/constant/UserConstants.java | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) 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; + /** * 平台内系统用户的唯一标志 */