feat: 数据别名.
This commit is contained in:
@@ -27,7 +27,7 @@ public class CodeGenerators {
|
||||
// 作者
|
||||
String author = Const.ORION_AUTHOR;
|
||||
// 模块
|
||||
String module = "asset";
|
||||
String module = "infra";
|
||||
// 生成的表
|
||||
Table[] tables = {
|
||||
// Template.create("dict_key", "字典配置项", "dict")
|
||||
@@ -45,17 +45,11 @@ public class CodeGenerators {
|
||||
// .color("blue", "gray", "red", "green", "white")
|
||||
// .valueUseFields()
|
||||
// .build(),
|
||||
Template.create("command_template", "命令模板", "command")
|
||||
Template.create("data_alias", "数据别名", "data")
|
||||
.disableUnitTest()
|
||||
.cache("command:template:list", "命令模板列表")
|
||||
.enableProviderApi()
|
||||
.cache("data:alias:{}:{}", "数据别名 ${userId} ${type}")
|
||||
.expire(1, TimeUnit.DAYS)
|
||||
.vue("asset", "snippet")
|
||||
.enableDrawerForm()
|
||||
.dict("commandTemplateRender", "prepare_render")
|
||||
.comment("是否使用脚本渲染")
|
||||
.fields("UNUSED", "USED")
|
||||
.labels("不使用", "使用")
|
||||
.values(0, 1)
|
||||
.build(),
|
||||
};
|
||||
// jdbc 配置 - 使用配置文件
|
||||
|
||||
@@ -9,7 +9,9 @@ import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.office.excel.writer.exporting.ExcelExport;
|
||||
#end
|
||||
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||
#if($meta.enableExport)
|
||||
import com.orion.ops.framework.common.utils.FileNames;
|
||||
#end
|
||||
import com.orion.ops.framework.common.utils.Valid;
|
||||
#if($meta.enableCache)
|
||||
import com.orion.ops.framework.redis.core.utils.RedisMaps;
|
||||
@@ -21,14 +23,18 @@ import ${pkg}.*;
|
||||
import ${package.Entity}.${entity};
|
||||
import ${package.Mapper}.${table.mapperName};
|
||||
import ${package.Service}.${table.serviceName};
|
||||
#if($meta.enableExport)
|
||||
import com.orion.web.servlet.web.Servlets;
|
||||
#end
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
#if($meta.enableExport)
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
#end
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.orion.ops.framework.redis.core.utils.barrier;
|
||||
|
||||
import com.orion.lang.define.barrier.GenericsAnonymousCollectionBarrier;
|
||||
import com.orion.lang.define.barrier.GenericsAnonymousMapBarrier;
|
||||
import com.orion.lang.define.barrier.GenericsBarrier;
|
||||
import com.orion.lang.define.cache.key.model.LongCacheIdModel;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.ops.framework.common.constant.Const;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
@@ -19,7 +23,9 @@ public class CacheBarriers {
|
||||
private CacheBarriers() {
|
||||
}
|
||||
|
||||
public static final GenericsListBarrier<Long> LONG = GenericsListBarrier.create(Const.NONE_ID);
|
||||
public static final GenericsBarrier<Collection<?>> LIST = GenericsAnonymousCollectionBarrier.create(Const.NONE_ID);
|
||||
|
||||
public static final GenericsBarrier<Map<?, ?>> MAP = GenericsAnonymousMapBarrier.create(Const.NONE_ID, Const.NONE_ID);
|
||||
|
||||
/**
|
||||
* 创建屏障对象 防止穿透
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.orion.ops.framework.redis.core.utils.barrier;
|
||||
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 标准集合屏障
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/11/21 11:46
|
||||
*/
|
||||
public class GenericsListBarrier<T> {
|
||||
|
||||
private final T barrierValue;
|
||||
|
||||
public GenericsListBarrier(T barrierValue) {
|
||||
this.barrierValue = barrierValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建屏障
|
||||
*
|
||||
* @param barrierValue barrierValue
|
||||
* @param <T> T
|
||||
* @return barrier
|
||||
*/
|
||||
public static <T> GenericsListBarrier<T> create(T barrierValue) {
|
||||
return new GenericsListBarrier<>(barrierValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检测是否需要添加屏障对象 防止穿透
|
||||
*
|
||||
* @param list list
|
||||
*/
|
||||
public void check(Collection<T> list) {
|
||||
if (list != null && list.isEmpty()) {
|
||||
// 添加屏障对象
|
||||
list.add(barrierValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除屏障对象
|
||||
*
|
||||
* @param list list
|
||||
*/
|
||||
public void remove(Collection<T> list) {
|
||||
if (!Lists.isEmpty(list)) {
|
||||
list.removeIf(s -> s.equals(barrierValue));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user