部门管理,菜单管理,构建树时使用Lambda表达式提取id,简化使用三目运算
This commit is contained in:
parent
ac030b7275
commit
7769713a40
@ -58,11 +58,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||||||
public List<SysDept> buildDeptTree(List<SysDept> depts)
|
public List<SysDept> buildDeptTree(List<SysDept> depts)
|
||||||
{
|
{
|
||||||
List<SysDept> returnList = new ArrayList<SysDept>();
|
List<SysDept> returnList = new ArrayList<SysDept>();
|
||||||
List<Long> tempList = new ArrayList<Long>();
|
List<Long> tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList());
|
||||||
for (SysDept dept : depts)
|
|
||||||
{
|
|
||||||
tempList.add(dept.getDeptId());
|
|
||||||
}
|
|
||||||
for (SysDept dept : depts)
|
for (SysDept dept : depts)
|
||||||
{
|
{
|
||||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||||
|
@ -202,11 +202,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
public List<SysMenu> buildMenuTree(List<SysMenu> menus)
|
public List<SysMenu> buildMenuTree(List<SysMenu> menus)
|
||||||
{
|
{
|
||||||
List<SysMenu> returnList = new ArrayList<SysMenu>();
|
List<SysMenu> returnList = new ArrayList<SysMenu>();
|
||||||
List<Long> tempList = new ArrayList<Long>();
|
List<Long> tempList = menus.stream().map(SysMenu::getMenuId).collect(Collectors.toList());
|
||||||
for (SysMenu dept : menus)
|
|
||||||
{
|
|
||||||
tempList.add(dept.getMenuId());
|
|
||||||
}
|
|
||||||
for (Iterator<SysMenu> iterator = menus.iterator(); iterator.hasNext();)
|
for (Iterator<SysMenu> iterator = menus.iterator(); iterator.hasNext();)
|
||||||
{
|
{
|
||||||
SysMenu menu = (SysMenu) iterator.next();
|
SysMenu menu = (SysMenu) iterator.next();
|
||||||
@ -259,7 +255,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
public boolean hasChildByMenuId(Long menuId)
|
public boolean hasChildByMenuId(Long menuId)
|
||||||
{
|
{
|
||||||
int result = menuMapper.hasChildByMenuId(menuId);
|
int result = menuMapper.hasChildByMenuId(menuId);
|
||||||
return result > 0 ? true : false;
|
return result > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -272,7 +268,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
public boolean checkMenuExistRole(Long menuId)
|
public boolean checkMenuExistRole(Long menuId)
|
||||||
{
|
{
|
||||||
int result = roleMenuMapper.checkMenuExistRole(menuId);
|
int result = roleMenuMapper.checkMenuExistRole(menuId);
|
||||||
return result > 0 ? true : false;
|
return result > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -458,8 +454,8 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
/**
|
/**
|
||||||
* 递归列表
|
* 递归列表
|
||||||
*
|
*
|
||||||
* @param list
|
* @param list 分类表
|
||||||
* @param t
|
* @param t 子节点
|
||||||
*/
|
*/
|
||||||
private void recursionFn(List<SysMenu> list, SysMenu t)
|
private void recursionFn(List<SysMenu> list, SysMenu t)
|
||||||
{
|
{
|
||||||
@ -504,7 +500,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
/**
|
/**
|
||||||
* 内链域名特殊字符替换
|
* 内链域名特殊字符替换
|
||||||
*
|
*
|
||||||
* @return
|
* @return 替换后的内链域名
|
||||||
*/
|
*/
|
||||||
public String innerLinkReplaceEach(String path)
|
public String innerLinkReplaceEach(String path)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user