修改初始化操作类型逻辑.

This commit is contained in:
lijiahang
2023-10-13 19:14:38 +08:00
parent 95f17bc527
commit c5abb5d573
21 changed files with 219 additions and 136 deletions

View File

@@ -465,6 +465,11 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine {
Object value = safeGet(safeGet(meta.getValues(), j), i);
enumInfo.put(name, field, value);
}
// 检查是否有 value
if (!meta.getFields().contains("value")) {
// 没有 value 用 name
enumInfo.put(name, "value", name);
}
}
enumMap.put(tableField.getPropertyName(), new EnumMeta(meta.getClassName(), meta.getComment(), enumInfo));
}

View File

@@ -118,6 +118,7 @@ public class EnumsTemplate extends VueTemplate {
/**
* 添加 value
* 如果 value 和 name 相同可以省略 (无 value 自动使用 name)
*
* @param values values
* @return this

View File

@@ -1,9 +1,10 @@
package ${currentPackage};
import com.orion.ops.framework.biz.operator.log.core.annotation.Module;
import com.orion.ops.framework.biz.operator.log.core.factory.InitializingOperatorTypes;
import com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.*;
import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeHolder.set;
/**
* $!{table.comment} 操作日志类型
@@ -12,10 +13,9 @@ import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeH
* @version ${since}
* @since ${date}
*/
@Module("${package.ModuleName}:${typeHyphen}")
public class ${type}OperatorType {
private static final String MODULE = "${package.ModuleName}:${typeHyphen}";
public static final String CREATE = "${typeHyphen}:create";
public static final String UPDATE = "${typeHyphen}:update";
@@ -24,11 +24,14 @@ public class ${type}OperatorType {
public static final String EXPORT = "${typeHyphen}:export";
public static void init() {
set(new OperatorType(L, MODULE, CREATE, "创建$!{table.comment}"));
set(new OperatorType(M, MODULE, UPDATE, "更新$!{table.comment}"));
set(new OperatorType(H, MODULE, DELETE, "删除$!{table.comment}"));
set(new OperatorType(L, MODULE, EXPORT, "导出$!{table.comment}"));
@Override
public OperatorType[] types() {
return new OperatorType[]{
new OperatorType(L, CREATE, "创建$!{table.comment}"),
new OperatorType(M, UPDATE, "更新$!{table.comment}"),
new OperatorType(H, DELETE, "删除$!{table.comment}"),
new OperatorType(M, EXPORT, "导出$!{table.comment}"),
};
}
}