支持无限级查询

This commit is contained in:
RuoYi
2018-08-07 22:28:11 +08:00
parent 3d37041193
commit d394307901
7 changed files with 39 additions and 24 deletions

View File

@@ -263,12 +263,7 @@ public class ShiroConfig
shiroFilterFactoryBean.setFilters(filters);
// 所有请求需要认证
filterChainDefinitionMap.put("/**", "user");
// 系统请求记录当前会话
filterChainDefinitionMap.put("/main", "onlineSession,syncOnlineSession");
filterChainDefinitionMap.put("/system/**", "onlineSession,syncOnlineSession");
filterChainDefinitionMap.put("/monitor/**", "onlineSession,syncOnlineSession");
filterChainDefinitionMap.put("/tool/**", "onlineSession,syncOnlineSession");
filterChainDefinitionMap.put("/**", "user,onlineSession,syncOnlineSession");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;

View File

@@ -14,6 +14,8 @@ public class Dept extends BaseEntity
private Long deptId;
/** 父部门ID */
private Long parentId;
/** 祖级列表 */
private String ancestors;
/** 部门名称 */
private String deptName;
/** 显示顺序 */
@@ -49,6 +51,16 @@ public class Dept extends BaseEntity
this.parentId = parentId;
}
public String getAncestors()
{
return ancestors;
}
public void setAncestors(String ancestors)
{
this.ancestors = ancestors;
}
public String getDeptName()
{
return deptName;
@@ -122,9 +134,9 @@ public class Dept extends BaseEntity
@Override
public String toString()
{
return "Dept [deptId=" + deptId + ", parentId=" + parentId + ", deptName=" + deptName + ", orderNum=" + orderNum
+ ", leader=" + leader + ", phone=" + phone + ", email=" + email + ", status=" + status
+ ", parentName=" + parentName + "]";
return "Dept [deptId=" + deptId + ", parentId=" + parentId + ", ancestors=" + ancestors + ", deptName="
+ deptName + ", orderNum=" + orderNum + ", leader=" + leader + ", phone=" + phone + ", email=" + email
+ ", status=" + status + ", parentName=" + parentName + "]";
}
}

View File

@@ -119,7 +119,9 @@ public class DeptServiceImpl implements IDeptService
@Override
public int insertDept(Dept dept)
{
Dept info = deptMapper.selectDeptById(dept.getParentId());
dept.setCreateBy(ShiroUtils.getLoginName());
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
return deptMapper.insertDept(dept);
}
@@ -132,7 +134,9 @@ public class DeptServiceImpl implements IDeptService
@Override
public int updateDept(Dept dept)
{
Dept info = deptMapper.selectDeptById(dept.getParentId());
dept.setUpdateBy(ShiroUtils.getLoginName());
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
return deptMapper.updateDept(dept);
}