2
0

fix(user): 菜单order排序

This commit is contained in:
TsMask
2024-12-04 17:33:01 +08:00
parent ee7b118a3c
commit 3d4ecd7de7
2 changed files with 22 additions and 8 deletions

View File

@@ -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 UMenuServiceImpl implements IUMenuService
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<UMenu> cMenus = menu.getChildren(); List<UMenu> 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 UMenuServiceImpl implements IUMenuService
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 UMenuServiceImpl implements IUMenuService
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);
} }