解决用户不同公司登陆进来后,看到的数据不同
This commit is contained in:
parent
c590ffae45
commit
f650c0a833
|
|
@ -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<Ztree> treeData()
|
||||
{
|
||||
List<Ztree> ztrees = deptService.selectDeptTree(new SysDept());
|
||||
List<Ztree> ztrees = deptService.selectDeptTree(this.isAdmin());
|
||||
return ztrees;
|
||||
}
|
||||
|
||||
|
|
@ -205,4 +207,15 @@ public class SysDeptController extends BaseController
|
|||
List<Ztree> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ package com.ghy.common.constant;
|
|||
*/
|
||||
public class UserConstants
|
||||
{
|
||||
|
||||
public static final long SYS_ADMIN_DEPT = 101L;
|
||||
|
||||
/**
|
||||
* 平台内系统用户的唯一标志
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue