Browse Source

用户管理的 组织机构选择树代码调整

qxp 5 years ago
parent
commit
fa266fa33a

+ 24 - 16
dgtly-admin/src/main/java/com/dgtly/web/controller/system/SysDeptController.java

@@ -1,30 +1,27 @@
 package com.dgtly.web.controller.system;
 
-import java.util.List;
-
-import com.dgtly.common.exception.BusinessException;
-import com.dgtly.system.domain.SysUser;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.ModelMap;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
 import com.dgtly.common.annotation.Log;
 import com.dgtly.common.constant.UserConstants;
 import com.dgtly.common.core.controller.BaseController;
 import com.dgtly.common.core.domain.AjaxResult;
 import com.dgtly.common.core.domain.Ztree;
 import com.dgtly.common.enums.BusinessType;
+import com.dgtly.common.exception.BusinessException;
 import com.dgtly.common.utils.StringUtils;
 import com.dgtly.framework.util.ShiroUtils;
 import com.dgtly.system.domain.SysDept;
 import com.dgtly.system.domain.SysRole;
+import com.dgtly.system.domain.SysUser;
+import com.dgtly.system.service.ISysConfigService;
 import com.dgtly.system.service.ISysDeptService;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 /**
  * 部门信息
@@ -40,6 +37,9 @@ public class SysDeptController extends BaseController
     @Autowired
     private ISysDeptService deptService;
 
+    @Autowired
+    private ISysConfigService configService;
+
     @RequiresPermissions("system:dept:view")
     @GetMapping()
     public String dept(ModelMap mmap)
@@ -190,9 +190,17 @@ public class SysDeptController extends BaseController
     public List<Ztree> treeData()
     {
         SysUser user = ShiroUtils.getSysUser();
+        List<Ztree> ztrees;
         SysDept dept = new SysDept();
-
-        List<Ztree> ztrees = deptService.selectDeptTree(dept);
+        /*判断是否是系统内部人员*/
+        SysRole role = new SysRole();
+        role.setRoleId(user.getRoleId());
+        ztrees= deptService.roleDeptTreeData(role);
+        /*if(ShiroUtils.getCompanyId()==Long.parseLong(configService.selectConfigByKey("sys.company.id"))){
+            ztrees= deptService.selectDeptTree(dept);
+        }else{
+            ztrees= deptService.roleDeptTreeData(role);
+        }*/
         return ztrees;
     }