|
@@ -1,5 +1,6 @@
|
|
|
package com.boman.web.core.utils;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.boman.common.core.utils.SpringUtils;
|
|
|
import com.boman.common.redis.RedisKey;
|
|
|
import com.boman.common.redis.service.RedisService;
|
|
@@ -9,6 +10,7 @@ import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
+import static com.boman.common.core.utils.obj.ObjectUtils.isEmpty;
|
|
|
import static com.boman.common.core.utils.obj.ObjectUtils.requireNonNull;
|
|
|
|
|
|
/**
|
|
@@ -54,4 +56,14 @@ public class IdUtils {
|
|
|
throw new IllegalArgumentException("获取主键失败");
|
|
|
}
|
|
|
|
|
|
+ public static void putIfNotContains(JSONArray jsonArray, String input) {
|
|
|
+ if (isEmpty(jsonArray)) {
|
|
|
+ jsonArray = new JSONArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!jsonArray.contains(input)) {
|
|
|
+ jsonArray.add(input);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|