Quellcode durchsuchen

将用户信息的List改成set

tuonina vor 5 Jahren
Ursprung
Commit
72625a362a

+ 7 - 6
tuon-core/src/main/java/cn/tonyandmoney/tuon/core/user/IUser.java

@@ -2,6 +2,7 @@ package cn.tonyandmoney.tuon.core.user;
 
 import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 
 /**
  * @Classname IUser
@@ -33,16 +34,16 @@ public interface IUser {
     String getAccount();
 
 
-    default List<String> getRoleIdList() {
-        return Collections.emptyList();
+    default Set<String> getRoleIdList() {
+        return Collections.emptySet();
     }
 
-    default List<String> getGroupIdList() {
-        return Collections.emptyList();
+    default Set<String> getGroupIdList() {
+        return Collections.emptySet();
     }
 
-    default List<String> getDeptIdList() {
-        return Collections.emptyList();
+    default Set<String> getDeptIdList() {
+        return Collections.emptySet();
     }
 
     default List<IDept> getDepts() {

+ 7 - 9
tuon-core/src/main/java/cn/tonyandmoney/tuon/core/utils/CoreUtils.java

@@ -3,9 +3,7 @@ package cn.tonyandmoney.tuon.core.utils;
 import cn.tonyandmoney.tuon.core.TuonCoreKt;
 import org.springframework.lang.Nullable;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
 
 import static org.springframework.util.StringUtils.deleteAny;
 
@@ -15,11 +13,11 @@ import static org.springframework.util.StringUtils.deleteAny;
 public class CoreUtils {
 
 
-    public static List<String> delimitedList(String str) {
+    public static Set<String> delimitedList(String str) {
         return delimitedList(str, TuonCoreKt.DELIMITER);
     }
 
-    public static List<String> delimitedList(@Nullable String str, @Nullable String delimiter) {
+    public static Set<String> delimitedList(@Nullable String str, @Nullable String delimiter) {
         return delimitedList(str, delimiter, null);
     }
 
@@ -31,15 +29,15 @@ public class CoreUtils {
      * @param charsToDelete
      * @return
      */
-    public static List<String> delimitedList(@Nullable String str, @Nullable String delimiter, @Nullable String charsToDelete) {
+    public static Set<String> delimitedList(@Nullable String str, @Nullable String delimiter, @Nullable String charsToDelete) {
         if (str == null) {
-            return Collections.emptyList();
+            return Collections.emptySet();
         }
         if (delimiter == null) {
-            return Collections.emptyList();
+            return Collections.emptySet();
         }
 
-        List<String> result = new ArrayList<>();
+        Set<String> result = new HashSet<>();
         if (delimiter.isEmpty()) {
             for (int i = 0; i < str.length(); i++) {
                 result.add(deleteAny(str.substring(i, i + 1), charsToDelete));

+ 2 - 2
tuon-core/src/main/kotlin/cn/tonyandmoney/tuon/core/TuonCore.kt

@@ -10,5 +10,5 @@ package cn.tonyandmoney.tuon.core
 /**
  * 分隔符
  */
-const val DELIMITER = ",";
-const val DELIMITER_="_";
+const val DELIMITER = ","
+const val DELIMITER_="_"