TRX пре 1 година
родитељ
комит
692747c0d6

+ 3 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/org/ModularModel.java

@@ -16,6 +16,9 @@ public class ModularModel implements Serializable {
 
     private String value;
 
+    @Schema(description = "排序")
+    private int index = 0;
+
     public String getValue() {
         return name;
     }

+ 13 - 4
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/user/RoleServiceImpl.java

@@ -345,6 +345,13 @@ public class RoleServiceImpl extends SuperService {
             }
         };
 
+        Comparator comparator1 = new Comparator<ModularModel>() {
+            @Override
+            public int compare(ModularModel o1, ModularModel o2) {
+                return Integer.compare(o1.getIndex(), o2.getIndex());
+            }
+        };
+
         Map<String, List<AuthModel>> maps = authModels.stream().collect(Collectors.groupingBy(AuthModel::getModularName));
         List<ModularModel> modularModels = new ArrayList<>();
         maps.forEach((key, val) -> {
@@ -356,8 +363,12 @@ public class RoleServiceImpl extends SuperService {
                 val.sort(comparator);
             }
             modularModel.setAuthModels(val);
+            if (ObjectUtils.isNotEmpty(val)) {
+                modularModel.setIndex(val.get(0).getIndex());
+            }
             modularModels.add(modularModel);
         });
+        modularModels.sort(comparator1);
         return modularModels;
     }
 
@@ -567,8 +578,7 @@ public class RoleServiceImpl extends SuperService {
         if (ObjectUtils.isEmpty(userAccount)) {
             return false;
         }
-        OrganizationUser organizationUser = organizationUserDao.findTopByOrganizationAndUser(
-                organization, userAccount);
+        OrganizationUser organizationUser = organizationUserDao.findTopByOrganizationAndUser(organization, userAccount);
         if (ObjectUtils.isEmpty(organizationUser)) {
             return false;
         }
@@ -587,8 +597,7 @@ public class RoleServiceImpl extends SuperService {
         if (ObjectUtils.isEmpty(organization)) {
             return false;
         }
-        OrganizationUser organizationUser = organizationUserDao.findTopByOrganizationAndUser(
-                organization, userAccount);
+        OrganizationUser organizationUser = organizationUserDao.findTopByOrganizationAndUser(organization, userAccount);
         if (ObjectUtils.isNotEmpty(organizationUser)) {
             return true;
         }