use of com.dimple.project.system.domain.Menu in project DimpleBlog by martin-chips.
the class MenuServiceImpl method recursionFn.
/**
* 递归列表
*
* @param list
* @param t
*/
private void recursionFn(List<Menu> list, Menu t) {
// 得到子节点列表
List<Menu> childList = getChildList(list, t);
t.setChildren(childList);
for (Menu tChild : childList) {
if (hasChild(list, tChild)) {
// 判断是否有子节点
Iterator<Menu> it = childList.iterator();
while (it.hasNext()) {
Menu n = it.next();
recursionFn(list, n);
}
}
}
}
use of com.dimple.project.system.domain.Menu in project DimpleBlog by martin-chips.
the class MenuServiceImpl method getChildList.
/**
* 得到子节点列表
*/
private List<Menu> getChildList(List<Menu> list, Menu t) {
List<Menu> tlist = new ArrayList<>();
Iterator<Menu> it = list.iterator();
while (it.hasNext()) {
Menu n = it.next();
if (n.getParentId().longValue() == t.getId().longValue()) {
tlist.add(n);
}
}
return tlist;
}
use of com.dimple.project.system.domain.Menu in project DimpleBlog by martin-chips.
the class MenuServiceImpl method getChildPerms.
/**
* 根据父节点的ID获取所有子节点
*
* @param list 分类表
* @param parentId 传入的父节点ID
* @return String
*/
public List<Menu> getChildPerms(List<Menu> list, int parentId) {
List<Menu> returnList = new ArrayList<>();
for (Iterator<Menu> iterator = list.iterator(); iterator.hasNext(); ) {
Menu t = iterator.next();
// 一、根据传入的某个父节点ID,遍历该父节点的所有子节点
if (t.getParentId() == parentId) {
recursionFn(list, t);
returnList.add(t);
}
}
return returnList;
}
use of com.dimple.project.system.domain.Menu in project DimpleBlog by martin-chips.
the class MenuServiceImpl method buildMenus.
@Override
public List<RouterVo> buildMenus(List<Menu> menus) {
List<RouterVo> routers = new LinkedList<>();
for (Menu menu : menus) {
RouterVo router = new RouterVo();
router.setName(menu.getMenuName());
router.setPath(getRouterPath(menu));
router.setComponent(StringUtils.isEmpty(menu.getComponent()) ? "Layout" : menu.getComponent());
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon()));
router.setName(menu.getMenuName());
List<Menu> cMenus = menu.getChildren();
if (!cMenus.isEmpty() && "M".equals(menu.getMenuType())) {
router.setAlwaysShow(true);
router.setRedirect("noRedirect");
router.setChildren(buildMenus(cMenus));
}
routers.add(router);
}
return routers;
}
use of com.dimple.project.system.domain.Menu in project DimpleBlog by martin-chips.
the class MenuServiceImpl method checkMenuNameUnique.
@Override
public String checkMenuNameUnique(Menu menu) {
Long menuId = StringUtils.isNull(menu.getId()) ? -1L : menu.getId();
Menu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId());
if (StringUtils.isNotNull(info) && info.getId().longValue() != menuId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
Aggregations