Browse Source

菜单排序修改

tags/24080901
WendyYang 1 year ago
parent
commit
e15ec02ce3
2 changed files with 4 additions and 1 deletions
  1. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/App.java
  2. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/App.java View File

@@ -7,6 +7,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
@@ -21,6 +22,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableScheduling @EnableScheduling
@EnableTransactionManagement @EnableTransactionManagement
@EnableAspectJAutoProxy(exposeProxy = true) @EnableAspectJAutoProxy(exposeProxy = true)
@ComponentScan(basePackages = {"com.ningdatech.pmapi", "com.ningdatech.irs"})
public class App { public class App {


protected static final String MAPPER_PACKAGES = "com.ningdatech.pmapi.**.mapper"; protected static final String MAPPER_PACKAGES = "com.ningdatech.pmapi.**.mapper";


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java View File

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.common.util;




import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.ningdatech.basic.util.CollUtils; import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.basic.util.StrPool; import com.ningdatech.basic.util.StrPool;
@@ -145,7 +146,7 @@ public final class TreeUtil {
} else { } else {
menus = new ArrayList<>(currMenus); menus = new ArrayList<>(currMenus);
} }
menus.sort(Comparator.comparing(MenuRoleVO::getSort));
menus.sort(Comparator.comparing(w -> ObjectUtil.defaultIfNull(w.getSort(), 99)));
ListIterator<MenuRoleVO> currIter = menus.listIterator(); ListIterator<MenuRoleVO> currIter = menus.listIterator();
while (currIter.hasNext()) { while (currIter.hasNext()) {
MenuRoleVO curr = currIter.next(); MenuRoleVO curr = currIter.next();


Loading…
Cancel
Save