mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-29 18:51:53 +08:00
perf: final方法改为大写命名
This commit is contained in:
parent
e1b8ae09c9
commit
e5bd517829
@ -27,7 +27,7 @@ public class DictFrameworkUtils {
|
|||||||
/**
|
/**
|
||||||
* 针对 {@link #getDictDataLabel(String, String)} 的缓存
|
* 针对 {@link #getDictDataLabel(String, String)} 的缓存
|
||||||
*/
|
*/
|
||||||
private static final LoadingCache<KeyValue<String, String>, DictDataRespDTO> getDictDataCache = CacheUtils.buildAsyncReloadingCache(
|
private static final LoadingCache<KeyValue<String, String>, DictDataRespDTO> GET_DICT_DATA_CACHE = CacheUtils.buildAsyncReloadingCache(
|
||||||
Duration.ofMinutes(1L), // 过期时间 1 分钟
|
Duration.ofMinutes(1L), // 过期时间 1 分钟
|
||||||
new CacheLoader<KeyValue<String, String>, DictDataRespDTO>() {
|
new CacheLoader<KeyValue<String, String>, DictDataRespDTO>() {
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ public class DictFrameworkUtils {
|
|||||||
/**
|
/**
|
||||||
* 针对 {@link #parseDictDataValue(String, String)} 的缓存
|
* 针对 {@link #parseDictDataValue(String, String)} 的缓存
|
||||||
*/
|
*/
|
||||||
private static final LoadingCache<KeyValue<String, String>, DictDataRespDTO> parseDictDataCache = CacheUtils.buildAsyncReloadingCache(
|
private static final LoadingCache<KeyValue<String, String>, DictDataRespDTO> PARSE_DICT_DATA_CACHE = CacheUtils.buildAsyncReloadingCache(
|
||||||
Duration.ofMinutes(1L), // 过期时间 1 分钟
|
Duration.ofMinutes(1L), // 过期时间 1 分钟
|
||||||
new CacheLoader<KeyValue<String, String>, DictDataRespDTO>() {
|
new CacheLoader<KeyValue<String, String>, DictDataRespDTO>() {
|
||||||
|
|
||||||
@ -59,12 +59,12 @@ public class DictFrameworkUtils {
|
|||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public static String getDictDataLabel(String dictType, String value) {
|
public static String getDictDataLabel(String dictType, String value) {
|
||||||
return getDictDataCache.get(new KeyValue<>(dictType, value)).getLabel();
|
return GET_DICT_DATA_CACHE.get(new KeyValue<>(dictType, value)).getLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public static String parseDictDataValue(String dictType, String label) {
|
public static String parseDictDataValue(String dictType, String label) {
|
||||||
return parseDictDataCache.get(new KeyValue<>(dictType, label)).getValue();
|
return PARSE_DICT_DATA_CACHE.get(new KeyValue<>(dictType, label)).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,11 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class JsonLongSetTypeHandler extends AbstractJsonTypeHandler<Object> {
|
public class JsonLongSetTypeHandler extends AbstractJsonTypeHandler<Object> {
|
||||||
|
|
||||||
private static final TypeReference<Set<Long>> typeReference = new TypeReference<Set<Long>>(){};
|
private static final TypeReference<Set<Long>> TYPE_REFERENCE = new TypeReference<Set<Long>>(){};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object parse(String json) {
|
protected Object parse(String json) {
|
||||||
return JsonUtils.parseObject(json, typeReference);
|
return JsonUtils.parseObject(json, TYPE_REFERENCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,18 +11,18 @@ public class RedisKeyRegistry {
|
|||||||
/**
|
/**
|
||||||
* Redis RedisKeyDefine 数组
|
* Redis RedisKeyDefine 数组
|
||||||
*/
|
*/
|
||||||
private static final List<RedisKeyDefine> defines = new ArrayList<>();
|
private static final List<RedisKeyDefine> DEFINES = new ArrayList<>();
|
||||||
|
|
||||||
public static void add(RedisKeyDefine define) {
|
public static void add(RedisKeyDefine define) {
|
||||||
defines.add(define);
|
DEFINES.add(define);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<RedisKeyDefine> list() {
|
public static List<RedisKeyDefine> list() {
|
||||||
return defines;
|
return DEFINES;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int size() {
|
public static int size() {
|
||||||
return defines.size();
|
return DEFINES.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,19 +17,19 @@ public class TransmittableThreadLocalSecurityContextHolderStrategy implements Se
|
|||||||
/**
|
/**
|
||||||
* 使用 TransmittableThreadLocal 作为上下文
|
* 使用 TransmittableThreadLocal 作为上下文
|
||||||
*/
|
*/
|
||||||
private static final ThreadLocal<SecurityContext> contextHolder = new TransmittableThreadLocal<>();
|
private static final ThreadLocal<SecurityContext> CONTEXT_HOLDER = new TransmittableThreadLocal<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearContext() {
|
public void clearContext() {
|
||||||
contextHolder.remove();
|
CONTEXT_HOLDER.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SecurityContext getContext() {
|
public SecurityContext getContext() {
|
||||||
SecurityContext ctx = contextHolder.get();
|
SecurityContext ctx = CONTEXT_HOLDER.get();
|
||||||
if (ctx == null) {
|
if (ctx == null) {
|
||||||
ctx = createEmptyContext();
|
ctx = createEmptyContext();
|
||||||
contextHolder.set(ctx);
|
CONTEXT_HOLDER.set(ctx);
|
||||||
}
|
}
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ public class TransmittableThreadLocalSecurityContextHolderStrategy implements Se
|
|||||||
@Override
|
@Override
|
||||||
public void setContext(SecurityContext context) {
|
public void setContext(SecurityContext context) {
|
||||||
Assert.notNull(context, "Only non-null SecurityContext instances are permitted");
|
Assert.notNull(context, "Only non-null SecurityContext instances are permitted");
|
||||||
contextHolder.set(context);
|
CONTEXT_HOLDER.set(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -31,7 +31,7 @@ public class CodegenBuilder {
|
|||||||
* 字段名与 {@link CodegenColumnListConditionEnum} 的默认映射
|
* 字段名与 {@link CodegenColumnListConditionEnum} 的默认映射
|
||||||
* 注意,字段的匹配以后缀的方式
|
* 注意,字段的匹配以后缀的方式
|
||||||
*/
|
*/
|
||||||
private static final Map<String, CodegenColumnListConditionEnum> columnListOperationConditionMappings =
|
private static final Map<String, CodegenColumnListConditionEnum> COLUMN_LIST_OPERATION_CONDITION_MAPPINGS =
|
||||||
MapUtil.<String, CodegenColumnListConditionEnum>builder()
|
MapUtil.<String, CodegenColumnListConditionEnum>builder()
|
||||||
.put("name", CodegenColumnListConditionEnum.LIKE)
|
.put("name", CodegenColumnListConditionEnum.LIKE)
|
||||||
.put("time", CodegenColumnListConditionEnum.BETWEEN)
|
.put("time", CodegenColumnListConditionEnum.BETWEEN)
|
||||||
@ -42,7 +42,7 @@ public class CodegenBuilder {
|
|||||||
* 字段名与 {@link CodegenColumnHtmlTypeEnum} 的默认映射
|
* 字段名与 {@link CodegenColumnHtmlTypeEnum} 的默认映射
|
||||||
* 注意,字段的匹配以后缀的方式
|
* 注意,字段的匹配以后缀的方式
|
||||||
*/
|
*/
|
||||||
private static final Map<String, CodegenColumnHtmlTypeEnum> columnHtmlTypeMappings =
|
private static final Map<String, CodegenColumnHtmlTypeEnum> COLUMN_HTML_TYPE_MAPPINGS =
|
||||||
MapUtil.<String, CodegenColumnHtmlTypeEnum>builder()
|
MapUtil.<String, CodegenColumnHtmlTypeEnum>builder()
|
||||||
.put("status", CodegenColumnHtmlTypeEnum.RADIO)
|
.put("status", CodegenColumnHtmlTypeEnum.RADIO)
|
||||||
.put("sex", CodegenColumnHtmlTypeEnum.RADIO)
|
.put("sex", CodegenColumnHtmlTypeEnum.RADIO)
|
||||||
@ -143,7 +143,7 @@ public class CodegenBuilder {
|
|||||||
column.setListOperation(!LIST_OPERATION_EXCLUDE_COLUMN.contains(column.getJavaField())
|
column.setListOperation(!LIST_OPERATION_EXCLUDE_COLUMN.contains(column.getJavaField())
|
||||||
&& !column.getPrimaryKey()); // 对于主键,列表过滤不需要传递
|
&& !column.getPrimaryKey()); // 对于主键,列表过滤不需要传递
|
||||||
// 处理 listOperationCondition 字段
|
// 处理 listOperationCondition 字段
|
||||||
columnListOperationConditionMappings.entrySet().stream()
|
COLUMN_LIST_OPERATION_CONDITION_MAPPINGS.entrySet().stream()
|
||||||
.filter(entry -> StrUtil.endWithIgnoreCase(column.getJavaField(), entry.getKey()))
|
.filter(entry -> StrUtil.endWithIgnoreCase(column.getJavaField(), entry.getKey()))
|
||||||
.findFirst().ifPresent(entry -> column.setListOperationCondition(entry.getValue().getCondition()));
|
.findFirst().ifPresent(entry -> column.setListOperationCondition(entry.getValue().getCondition()));
|
||||||
if (column.getListOperationCondition() == null) {
|
if (column.getListOperationCondition() == null) {
|
||||||
@ -155,7 +155,7 @@ public class CodegenBuilder {
|
|||||||
|
|
||||||
private void processColumnUI(CodegenColumnDO column) {
|
private void processColumnUI(CodegenColumnDO column) {
|
||||||
// 基于后缀进行匹配
|
// 基于后缀进行匹配
|
||||||
columnHtmlTypeMappings.entrySet().stream()
|
COLUMN_HTML_TYPE_MAPPINGS.entrySet().stream()
|
||||||
.filter(entry -> StrUtil.endWithIgnoreCase(column.getJavaField(), entry.getKey()))
|
.filter(entry -> StrUtil.endWithIgnoreCase(column.getJavaField(), entry.getKey()))
|
||||||
.findFirst().ifPresent(entry -> column.setHtmlType(entry.getValue().getType()));
|
.findFirst().ifPresent(entry -> column.setHtmlType(entry.getValue().getType()));
|
||||||
// 如果是 Boolean 类型时,设置为 radio 类型.
|
// 如果是 Boolean 类型时,设置为 radio 类型.
|
||||||
|
Loading…
Reference in New Issue
Block a user