feat: 删除字典值 name 字段.

This commit is contained in:
lijiahang
2023-10-26 19:20:40 +08:00
parent 18de1a2a3a
commit 29e3bde5b6
20 changed files with 214 additions and 198 deletions

View File

@@ -9,16 +9,12 @@ package com.orion.ops.framework.common.constant;
*/
public interface ValidConst {
String CHAR_NUMBER_1_32_PATTERN = "^[a-zA-Z0-9]{1,32}$";
String USERNAME_4_32_PATTERN = "^[a-zA-Z0-9_]{4,32}$";
String CHAR_NUMBER_1_32_MESSAGE = "只能为 1-32 位的数字字母";
String USERNAME_4_32_MESSAGE = "只能为 4-32 位的数字,字母或下滑线";
String CHAR_NUMBER_2_32_PATTERN = "^[a-zA-Z0-9]{2,32}$";
String DICT_1_32_PATTERN = "^[a-zA-Z0-9_]{1,32}$";
String CHAR_NUMBER_2_32_MESSAGE = "只能为 2-32 位的数字字母";
String CHAR_NUMBER_4_32_PATTERN = "^[a-zA-Z0-9]{4,32}$";
String CHAR_NUMBER_4_32_MESSAGE = "只能为 4-32 位的数字或字母";
String DICT_1_32_MESSAGE = "只能为 1-32 位的数字,字母或下滑线";
}

View File

@@ -6,8 +6,10 @@ import com.alibaba.fastjson.JSONObject;
import com.orion.lang.define.cache.CacheKeyDefine;
import com.orion.lang.utils.Strings;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;
/**
* redis string 工具类
@@ -75,6 +77,52 @@ public class RedisStrings extends RedisUtils {
return (T) JSON.parseObject(value, type);
}
/**
* 获取 json 列表
*
* @param keys keys
* @return cache
*/
public static List<JSONObject> getJsonList(List<String> keys) {
List<String> values = redisTemplate.opsForValue().multiGet(keys);
if (values == null) {
return new ArrayList<>();
}
return values.stream()
.map(JSON::parseObject)
.collect(Collectors.toList());
}
/**
* 获取 json 列表
*
* @param keys keys
* @param define define
* @param <T> T
* @return cache
*/
public static <T> List<T> getJsonList(List<String> keys, CacheKeyDefine define) {
return getJsonList(keys, (Class<T>) define.getType());
}
/**
* 获取 json 列表
*
* @param keys keys
* @param type type
* @param <T> T
* @return cache
*/
public static <T> List<T> getJsonList(List<String> keys, Class<T> type) {
List<String> values = redisTemplate.opsForValue().multiGet(keys);
if (values == null) {
return new ArrayList<>();
}
return values.stream()
.map(s -> JSON.parseObject(s, type))
.collect(Collectors.toList());
}
/**
* 获取 json
*
@@ -128,6 +176,52 @@ public class RedisStrings extends RedisUtils {
return JSON.parseArray(value, type);
}
/**
* 获取 jsonArray 列表
*
* @param keys keys
* @return cache
*/
public static List<JSONArray> getJsonArrayList(List<String> keys) {
List<String> values = redisTemplate.opsForValue().multiGet(keys);
if (values == null) {
return new ArrayList<>();
}
return values.stream()
.map(JSON::parseArray)
.collect(Collectors.toList());
}
/**
* 获取 jsonArray 列表
*
* @param keys keys
* @param define define
* @param <T> T
* @return cache
*/
public static <T> List<List<T>> getJsonArrayList(List<String> keys, CacheKeyDefine define) {
return getJsonArrayList(keys, (Class<T>) define.getType());
}
/**
* 获取 jsonArray 列表
*
* @param keys keys
* @param type type
* @param <T> T
* @return cache
*/
public static <T> List<List<T>> getJsonArrayList(List<String> keys, Class<T> type) {
List<String> values = redisTemplate.opsForValue().multiGet(keys);
if (values == null) {
return new ArrayList<>();
}
return values.stream()
.map(s -> JSON.parseArray(s, type))
.collect(Collectors.toList());
}
/**
* 设置 json
*