2
0

fix(system): 菜单order排序

This commit is contained in:
TsMask
2024-12-06 21:47:09 +08:00
parent af3d3d1e60
commit 33cf4d306d
3 changed files with 26 additions and 12 deletions

View File

@@ -4,7 +4,7 @@ import org.wfc.common.core.utils.StringUtils;
/** /**
* 路由显示信息 * 路由显示信息
* *
* @author wfc * @author wfc
*/ */
public class MetaVo public class MetaVo
@@ -29,35 +29,41 @@ public class MetaVo
*/ */
private String link; private String link;
/** 显示顺序 */
private Integer order;
public MetaVo() public MetaVo()
{ {
} }
public MetaVo(String title, String icon) public MetaVo(String title, String icon, Integer order)
{ {
this.title = title; this.title = title;
this.icon = icon; this.icon = icon;
} }
public MetaVo(String title, String icon, boolean noCache) public MetaVo(String title, String icon, boolean noCache, Integer order)
{ {
this.title = title; this.title = title;
this.icon = icon; this.icon = icon;
this.noCache = noCache; this.noCache = noCache;
this.order = order;
} }
public MetaVo(String title, String icon, String link) public MetaVo(String title, String icon, String link, Integer order)
{ {
this.title = title; this.title = title;
this.icon = icon; this.icon = icon;
this.link = link; this.link = link;
this.order = order;
} }
public MetaVo(String title, String icon, boolean noCache, String link) public MetaVo(String title, String icon, boolean noCache, String link, Integer order)
{ {
this.title = title; this.title = title;
this.icon = icon; this.icon = icon;
this.noCache = noCache; this.noCache = noCache;
this.order = order;
if (StringUtils.ishttp(link)) if (StringUtils.ishttp(link))
{ {
this.link = link; this.link = link;
@@ -103,4 +109,12 @@ public class MetaVo
{ {
this.link = link; this.link = link;
} }
public Integer getOrder() {
return order;
}
public void setOrder(Integer order) {
this.order = order;
}
} }

View File

@@ -168,7 +168,7 @@ public class SysMenuServiceImpl implements ISysMenuService
router.setPath(getRouterPath(menu)); router.setPath(getRouterPath(menu));
router.setComponent(getComponent(menu)); router.setComponent(getComponent(menu));
router.setQuery(menu.getQuery()); router.setQuery(menu.getQuery());
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath(), menu.getOrderNum()));
List<SysMenu> cMenus = menu.getChildren(); List<SysMenu> cMenus = menu.getChildren();
if (StringUtils.isNotEmpty(cMenus) && UserConstants.TYPE_DIR.equals(menu.getMenuType())) if (StringUtils.isNotEmpty(cMenus) && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
{ {
@@ -184,14 +184,14 @@ public class SysMenuServiceImpl implements ISysMenuService
children.setPath(menu.getPath()); children.setPath(menu.getPath());
children.setComponent(menu.getComponent()); children.setComponent(menu.getComponent());
children.setName(menu.getName()); children.setName(menu.getName());
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath(), menu.getOrderNum()));
children.setQuery(menu.getQuery()); children.setQuery(menu.getQuery());
childrenList.add(children); childrenList.add(children);
router.setChildren(childrenList); router.setChildren(childrenList);
} }
else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) else if (menu.getParentId().intValue() == 0 && isInnerLink(menu))
{ {
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getOrderNum()));
router.setPath("/"); router.setPath("/");
List<RouterVo> childrenList = new ArrayList<RouterVo>(); List<RouterVo> childrenList = new ArrayList<RouterVo>();
RouterVo children = new RouterVo(); RouterVo children = new RouterVo();
@@ -199,7 +199,7 @@ public class SysMenuServiceImpl implements ISysMenuService
children.setPath(routerPath); children.setPath(routerPath);
children.setComponent(UserConstants.INNER_LINK); children.setComponent(UserConstants.INNER_LINK);
children.setName(menu.getName()); children.setName(menu.getName());
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath())); children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath(), menu.getOrderNum()));
childrenList.add(children); childrenList.add(children);
router.setChildren(childrenList); router.setChildren(childrenList);
} }

View File

@@ -31,7 +31,7 @@ public class SysPermissionServiceImpl implements ISysPermissionService
/** /**
* 获取角色数据权限 * 获取角色数据权限
* *
* @param userId 用户Id * @param user 用户
* @return 角色权限信息 * @return 角色权限信息
*/ */
@Override @Override
@@ -41,7 +41,7 @@ public class SysPermissionServiceImpl implements ISysPermissionService
// 管理员拥有所有权限 // 管理员拥有所有权限
if (user.isAdmin()) if (user.isAdmin())
{ {
roles.add("admin"); roles.add("super");
} }
else else
{ {
@@ -53,7 +53,7 @@ public class SysPermissionServiceImpl implements ISysPermissionService
/** /**
* 获取菜单数据权限 * 获取菜单数据权限
* *
* @param userId 用户Id * @param user 用户
* @return 菜单权限信息 * @return 菜单权限信息
*/ */
@Override @Override