修改初始化操作类型逻辑.
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
package com.orion.ops.framework.biz.operator.log.core.annotation;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023/10/9 18:44
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Target({ElementType.TYPE})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface Module {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块
|
||||||
|
*/
|
||||||
|
String value();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ import com.orion.ops.framework.biz.operator.log.core.annotation.IgnoreParameter;
|
|||||||
import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog;
|
import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||||
import com.orion.ops.framework.biz.operator.log.core.config.OperatorLogConfig;
|
import com.orion.ops.framework.biz.operator.log.core.config.OperatorLogConfig;
|
||||||
import com.orion.ops.framework.biz.operator.log.core.enums.ReturnType;
|
import com.orion.ops.framework.biz.operator.log.core.enums.ReturnType;
|
||||||
import com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeHolder;
|
import com.orion.ops.framework.biz.operator.log.core.factory.OperatorTypeHolder;
|
||||||
import com.orion.ops.framework.biz.operator.log.core.model.OperatorLogModel;
|
import com.orion.ops.framework.biz.operator.log.core.model.OperatorLogModel;
|
||||||
import com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
import com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
||||||
import com.orion.ops.framework.biz.operator.log.core.service.OperatorLogFrameworkService;
|
import com.orion.ops.framework.biz.operator.log.core.service.OperatorLogFrameworkService;
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.orion.ops.framework.biz.operator.log.core.factory;
|
||||||
|
|
||||||
|
import com.orion.lang.utils.Arrays1;
|
||||||
|
import com.orion.ops.framework.biz.operator.log.core.annotation.Module;
|
||||||
|
import com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型初始化器
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023/10/13 17:45
|
||||||
|
*/
|
||||||
|
public abstract class InitializingOperatorTypes implements OperatorTypeDefinition {
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
// 获取模块注解
|
||||||
|
Module moduleDefinition = this.getClass().getAnnotation(Module.class);
|
||||||
|
if (moduleDefinition == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 获取类型
|
||||||
|
OperatorType[] types = this.types();
|
||||||
|
if (Arrays1.isEmpty(types)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 定义类型
|
||||||
|
String module = moduleDefinition.value();
|
||||||
|
for (OperatorType type : types) {
|
||||||
|
type.setModule(module);
|
||||||
|
OperatorTypeHolder.set(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.orion.ops.framework.biz.operator.log.core.factory;
|
||||||
|
|
||||||
|
import com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型定义
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023/10/13 18:23
|
||||||
|
*/
|
||||||
|
public interface OperatorTypeDefinition {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取操作类型
|
||||||
|
*
|
||||||
|
* @return 操作类型
|
||||||
|
*/
|
||||||
|
OperatorType[] types();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.orion.ops.framework.biz.operator.log.core.holder;
|
package com.orion.ops.framework.biz.operator.log.core.factory;
|
||||||
|
|
||||||
import com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
import com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
||||||
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.orion.ops.framework.biz.operator.log.core.model;
|
package com.orion.ops.framework.biz.operator.log.core.model;
|
||||||
|
|
||||||
import com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel;
|
import com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel;
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,7 +13,6 @@ import lombok.Getter;
|
|||||||
* @since 2023/10/10 10:29
|
* @since 2023/10/10 10:29
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
|
||||||
public class OperatorType {
|
public class OperatorType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,7 +23,7 @@ public class OperatorType {
|
|||||||
/**
|
/**
|
||||||
* 模块
|
* 模块
|
||||||
*/
|
*/
|
||||||
private final String module;
|
private String module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型
|
* 类型
|
||||||
@@ -37,4 +35,19 @@ public class OperatorType {
|
|||||||
*/
|
*/
|
||||||
private final String template;
|
private final String template;
|
||||||
|
|
||||||
|
public OperatorType(OperatorRiskLevel riskLevel, String type, String template) {
|
||||||
|
this(riskLevel, null, type, template);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OperatorType(OperatorRiskLevel riskLevel, String module, String type, String template) {
|
||||||
|
this.riskLevel = riskLevel;
|
||||||
|
this.module = module;
|
||||||
|
this.type = type;
|
||||||
|
this.template = template;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModule(String module) {
|
||||||
|
this.module = module;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -465,6 +465,11 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine {
|
|||||||
Object value = safeGet(safeGet(meta.getValues(), j), i);
|
Object value = safeGet(safeGet(meta.getValues(), j), i);
|
||||||
enumInfo.put(name, field, value);
|
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));
|
enumMap.put(tableField.getPropertyName(), new EnumMeta(meta.getClassName(), meta.getComment(), enumInfo));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ public class EnumsTemplate extends VueTemplate {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加 value
|
* 添加 value
|
||||||
|
* 如果 value 和 name 相同可以省略 (无 value 自动使用 name)
|
||||||
*
|
*
|
||||||
* @param values values
|
* @param values values
|
||||||
* @return this
|
* @return this
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package ${currentPackage};
|
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 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.enums.OperatorRiskLevel.*;
|
||||||
import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeHolder.set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{table.comment} 操作日志类型
|
* $!{table.comment} 操作日志类型
|
||||||
@@ -12,10 +13,9 @@ import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeH
|
|||||||
* @version ${since}
|
* @version ${since}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
|
@Module("${package.ModuleName}:${typeHyphen}")
|
||||||
public class ${type}OperatorType {
|
public class ${type}OperatorType {
|
||||||
|
|
||||||
private static final String MODULE = "${package.ModuleName}:${typeHyphen}";
|
|
||||||
|
|
||||||
public static final String CREATE = "${typeHyphen}:create";
|
public static final String CREATE = "${typeHyphen}:create";
|
||||||
|
|
||||||
public static final String UPDATE = "${typeHyphen}:update";
|
public static final String UPDATE = "${typeHyphen}:update";
|
||||||
@@ -24,11 +24,14 @@ public class ${type}OperatorType {
|
|||||||
|
|
||||||
public static final String EXPORT = "${typeHyphen}:export";
|
public static final String EXPORT = "${typeHyphen}:export";
|
||||||
|
|
||||||
public static void init() {
|
@Override
|
||||||
set(new OperatorType(L, MODULE, CREATE, "创建$!{table.comment}"));
|
public OperatorType[] types() {
|
||||||
set(new OperatorType(M, MODULE, UPDATE, "更新$!{table.comment}"));
|
return new OperatorType[]{
|
||||||
set(new OperatorType(H, MODULE, DELETE, "删除$!{table.comment}"));
|
new OperatorType(L, CREATE, "创建$!{table.comment}"),
|
||||||
set(new OperatorType(L, MODULE, EXPORT, "导出$!{table.comment}"));
|
new OperatorType(M, UPDATE, "更新$!{table.comment}"),
|
||||||
|
new OperatorType(H, DELETE, "删除$!{table.comment}"),
|
||||||
|
new OperatorType(M, EXPORT, "导出$!{table.comment}"),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package com.orion.ops.module.asset.define.operator;
|
package com.orion.ops.module.asset.define.operator;
|
||||||
|
|
||||||
|
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 com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
||||||
|
|
||||||
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.H;
|
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.H;
|
||||||
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.L;
|
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.L;
|
||||||
import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeHolder.set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主机身份 操作日志类型
|
* 主机身份 操作日志类型
|
||||||
@@ -13,9 +14,8 @@ import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeH
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/10/10 17:30
|
* @since 2023/10/10 17:30
|
||||||
*/
|
*/
|
||||||
public class HostIdentityOperatorType {
|
@Module("asset:host-identity")
|
||||||
|
public class HostIdentityOperatorType extends InitializingOperatorTypes {
|
||||||
private static final String MODULE = "asset:host-identity";
|
|
||||||
|
|
||||||
public static final String CREATE = "host-identity:create";
|
public static final String CREATE = "host-identity:create";
|
||||||
|
|
||||||
@@ -23,10 +23,13 @@ public class HostIdentityOperatorType {
|
|||||||
|
|
||||||
public static final String DELETE = "host-identity:delete";
|
public static final String DELETE = "host-identity:delete";
|
||||||
|
|
||||||
public static void init() {
|
@Override
|
||||||
set(new OperatorType(L, MODULE, CREATE, "创建主机身份 <sb>${name}</sb>"));
|
public OperatorType[] types() {
|
||||||
set(new OperatorType(L, MODULE, UPDATE, "修改主机身份 <sb>${name}</sb>"));
|
return new OperatorType[]{
|
||||||
set(new OperatorType(H, MODULE, DELETE, "删除主机身份 <sb>${name}</sb>"));
|
new OperatorType(L, CREATE, "创建主机身份 <sb>${name}</sb>"),
|
||||||
|
new OperatorType(L, UPDATE, "修改主机身份 <sb>${name}</sb>"),
|
||||||
|
new OperatorType(H, DELETE, "删除主机身份 <sb>${name}</sb>"),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package com.orion.ops.module.asset.define.operator;
|
package com.orion.ops.module.asset.define.operator;
|
||||||
|
|
||||||
|
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 com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
||||||
|
|
||||||
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.H;
|
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.H;
|
||||||
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.L;
|
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.L;
|
||||||
import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeHolder.set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主机秘钥 操作日志类型
|
* 主机秘钥 操作日志类型
|
||||||
@@ -13,9 +14,8 @@ import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeH
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/10/10 17:30
|
* @since 2023/10/10 17:30
|
||||||
*/
|
*/
|
||||||
public class HostKeyOperatorType {
|
@Module("asset:host-key")
|
||||||
|
public class HostKeyOperatorType extends InitializingOperatorTypes {
|
||||||
private static final String MODULE = "asset:host-key";
|
|
||||||
|
|
||||||
public static final String CREATE = "host-key:create";
|
public static final String CREATE = "host-key:create";
|
||||||
|
|
||||||
@@ -23,10 +23,13 @@ public class HostKeyOperatorType {
|
|||||||
|
|
||||||
public static final String DELETE = "host-key:delete";
|
public static final String DELETE = "host-key:delete";
|
||||||
|
|
||||||
public static void init() {
|
@Override
|
||||||
set(new OperatorType(L, MODULE, CREATE, "创建主机秘钥 <sb>${name}</sb>"));
|
public OperatorType[] types() {
|
||||||
set(new OperatorType(L, MODULE, UPDATE, "修改主机秘钥 <sb>${name}</sb>"));
|
return new OperatorType[]{
|
||||||
set(new OperatorType(H, MODULE, DELETE, "删除主机秘钥 <sb>${name}</sb>"));
|
new OperatorType(L, CREATE, "创建主机秘钥 <sb>${name}</sb>"),
|
||||||
|
new OperatorType(L, UPDATE, "修改主机秘钥 <sb>${name}</sb>"),
|
||||||
|
new OperatorType(H, DELETE, "删除主机秘钥 <sb>${name}</sb>"),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.orion.ops.module.asset.define.operator;
|
package com.orion.ops.module.asset.define.operator;
|
||||||
|
|
||||||
|
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 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.enums.OperatorRiskLevel.*;
|
||||||
import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeHolder.set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主机 操作日志类型
|
* 主机 操作日志类型
|
||||||
@@ -12,9 +13,8 @@ import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeH
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/10/10 17:30
|
* @since 2023/10/10 17:30
|
||||||
*/
|
*/
|
||||||
public class HostOperatorType {
|
@Module("asset:host")
|
||||||
|
public class HostOperatorType extends InitializingOperatorTypes {
|
||||||
private static final String MODULE = "asset:host";
|
|
||||||
|
|
||||||
public static final String CREATE = "host:create";
|
public static final String CREATE = "host:create";
|
||||||
|
|
||||||
@@ -26,12 +26,15 @@ public class HostOperatorType {
|
|||||||
|
|
||||||
public static final String UPDATE_CONFIG_STATUS = "host:update-config-status";
|
public static final String UPDATE_CONFIG_STATUS = "host:update-config-status";
|
||||||
|
|
||||||
public static void init() {
|
@Override
|
||||||
set(new OperatorType(L, MODULE, CREATE, "创建主机 <sb>${name}</sb>"));
|
public OperatorType[] types() {
|
||||||
set(new OperatorType(L, MODULE, UPDATE, "修改主机 <sb>${name}</sb>"));
|
return new OperatorType[]{
|
||||||
set(new OperatorType(H, MODULE, DELETE, "删除主机 <sb>${name}</sb>"));
|
new OperatorType(L, CREATE, "创建主机 <sb>${name}</sb>"),
|
||||||
set(new OperatorType(M, MODULE, UPDATE_CONFIG, "修改主机配置 <sb>${name}</sb> | <sb>${type}</sb>"));
|
new OperatorType(L, UPDATE, "修改主机 <sb>${name}</sb>"),
|
||||||
set(new OperatorType(M, MODULE, UPDATE_CONFIG_STATUS, "修改主机配置状态 <sb>${name}</sb> | <sb>${type}</sb> - <sb>${statusName}</sb>"));
|
new OperatorType(H, DELETE, "删除主机 <sb>${name}</sb>"),
|
||||||
|
new OperatorType(M, UPDATE_CONFIG, "修改主机配置 <sb>${name}</sb> | <sb>${type}</sb>"),
|
||||||
|
new OperatorType(M, UPDATE_CONFIG_STATUS, "修改主机配置状态 <sb>${name}</sb> | <sb>${type}</sb> - <sb>${statusName}</sb>"),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
package com.orion.ops.module.asset.runner;
|
|
||||||
|
|
||||||
import com.orion.ops.module.asset.define.operator.HostIdentityOperatorType;
|
|
||||||
import com.orion.ops.module.asset.define.operator.HostKeyOperatorType;
|
|
||||||
import com.orion.ops.module.asset.define.operator.HostOperatorType;
|
|
||||||
import org.springframework.boot.CommandLineRunner;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 资产模块 操作类型初始化
|
|
||||||
*
|
|
||||||
* @author Jiahang Li
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 2023/10/10 18:03
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class AssetOperatorTypeRunner implements CommandLineRunner {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(String... args) {
|
|
||||||
HostOperatorType.init();
|
|
||||||
HostKeyOperatorType.init();
|
|
||||||
HostIdentityOperatorType.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.orion.ops.module.infra.dao;
|
package com.orion.ops.module.infra.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||||
import com.orion.ops.module.infra.entity.domain.OperatorLogDO;
|
import com.orion.ops.module.infra.entity.domain.OperatorLogDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@@ -14,4 +15,16 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface OperatorLogDAO extends IMapper<OperatorLogDO> {
|
public interface OperatorLogDAO extends IMapper<OperatorLogDO> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过 userId 删除
|
||||||
|
*
|
||||||
|
* @param userId userId
|
||||||
|
* @return effect
|
||||||
|
*/
|
||||||
|
default int deleteByUserId(Long userId) {
|
||||||
|
LambdaQueryWrapper<OperatorLogDO> wrapper = this.wrapper()
|
||||||
|
.eq(OperatorLogDO::getUserId, userId);
|
||||||
|
return this.delete(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.orion.ops.module.infra.define.operator;
|
package com.orion.ops.module.infra.define.operator;
|
||||||
|
|
||||||
|
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 com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
||||||
|
|
||||||
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.L;
|
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.L;
|
||||||
import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeHolder.set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 认证服务 操作日志类型
|
* 认证服务 操作日志类型
|
||||||
@@ -12,9 +13,8 @@ import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeH
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023-10-10 19:06
|
* @since 2023-10-10 19:06
|
||||||
*/
|
*/
|
||||||
public class AuthenticationOperatorType {
|
@Module("infra:authentication")
|
||||||
|
public class AuthenticationOperatorType extends InitializingOperatorTypes {
|
||||||
private static final String MODULE = "infra:authentication";
|
|
||||||
|
|
||||||
public static final String LOGIN = "authentication:login";
|
public static final String LOGIN = "authentication:login";
|
||||||
|
|
||||||
@@ -22,10 +22,13 @@ public class AuthenticationOperatorType {
|
|||||||
|
|
||||||
public static final String UPDATE_PASSWORD = "authentication:update-password";
|
public static final String UPDATE_PASSWORD = "authentication:update-password";
|
||||||
|
|
||||||
public static void init() {
|
@Override
|
||||||
set(new OperatorType(L, MODULE, LOGIN, "登陆系统"));
|
public OperatorType[] types() {
|
||||||
set(new OperatorType(L, MODULE, LOGOUT, "登出系统"));
|
return new OperatorType[]{
|
||||||
set(new OperatorType(L, MODULE, UPDATE_PASSWORD, "修改密码"));
|
new OperatorType(L, LOGIN, "登陆系统"),
|
||||||
|
new OperatorType(L, LOGOUT, "登出系统"),
|
||||||
|
new OperatorType(L, UPDATE_PASSWORD, "修改密码"),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.orion.ops.module.infra.define.operator;
|
package com.orion.ops.module.infra.define.operator;
|
||||||
|
|
||||||
|
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 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.enums.OperatorRiskLevel.*;
|
||||||
import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeHolder.set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统菜单 操作日志类型
|
* 系统菜单 操作日志类型
|
||||||
@@ -12,9 +13,8 @@ import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeH
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/10/10 17:30
|
* @since 2023/10/10 17:30
|
||||||
*/
|
*/
|
||||||
public class SystemMenuOperatorType {
|
@Module("infra:system-menu")
|
||||||
|
public class SystemMenuOperatorType extends InitializingOperatorTypes {
|
||||||
private static final String MODULE = "infra:system-menu";
|
|
||||||
|
|
||||||
public static final String CREATE = "system-menu:create";
|
public static final String CREATE = "system-menu:create";
|
||||||
|
|
||||||
@@ -24,11 +24,14 @@ public class SystemMenuOperatorType {
|
|||||||
|
|
||||||
public static final String DELETE = "system-menu:delete";
|
public static final String DELETE = "system-menu:delete";
|
||||||
|
|
||||||
public static void init() {
|
@Override
|
||||||
set(new OperatorType(L, MODULE, CREATE, "创建菜单 <sb>${name}</sb>"));
|
public OperatorType[] types() {
|
||||||
set(new OperatorType(L, MODULE, UPDATE, "修改菜单 <sb>${name}</sb>"));
|
return new OperatorType[]{
|
||||||
set(new OperatorType(M, MODULE, UPDATE_STATUS, "修改菜单状态 <sb>${name}</sb> - <sb>${label}</sb>"));
|
new OperatorType(L, CREATE, "创建菜单 <sb>${name}</sb>"),
|
||||||
set(new OperatorType(H, MODULE, DELETE, "删除菜单 <sb>${name}</sb>"));
|
new OperatorType(L, UPDATE, "修改菜单 <sb>${name}</sb>"),
|
||||||
|
new OperatorType(M, UPDATE_STATUS, "修改菜单状态 <sb>${name}</sb> - <sb>${label}</sb>"),
|
||||||
|
new OperatorType(H, DELETE, "删除菜单 <sb>${name}</sb>"),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.orion.ops.module.infra.define.operator;
|
package com.orion.ops.module.infra.define.operator;
|
||||||
|
|
||||||
|
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 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.enums.OperatorRiskLevel.*;
|
||||||
import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeHolder.set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统角色 操作日志类型
|
* 系统角色 操作日志类型
|
||||||
@@ -12,9 +13,8 @@ import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeH
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/10/10 17:30
|
* @since 2023/10/10 17:30
|
||||||
*/
|
*/
|
||||||
public class SystemRoleOperatorType {
|
@Module("infra:system-role")
|
||||||
|
public class SystemRoleOperatorType extends InitializingOperatorTypes {
|
||||||
private static final String MODULE = "infra:system-role";
|
|
||||||
|
|
||||||
public static final String CREATE = "system-role:create";
|
public static final String CREATE = "system-role:create";
|
||||||
|
|
||||||
@@ -26,12 +26,15 @@ public class SystemRoleOperatorType {
|
|||||||
|
|
||||||
public static final String GRANT_MENU = "system-role:grant-menu";
|
public static final String GRANT_MENU = "system-role:grant-menu";
|
||||||
|
|
||||||
public static void init() {
|
@Override
|
||||||
set(new OperatorType(L, MODULE, CREATE, "创建角色 <sb>${name}(${code})</sb>"));
|
public OperatorType[] types() {
|
||||||
set(new OperatorType(M, MODULE, UPDATE, "修改角色 <sb>${name}(${code})</sb>"));
|
return new OperatorType[]{
|
||||||
set(new OperatorType(M, MODULE, UPDATE_STATUS, "修改角色状态 <sb>${name}(${code})</sb> - <sb>${statusName}</sb>"));
|
new OperatorType(L, CREATE, "创建角色 <sb>${name}(${code})</sb>"),
|
||||||
set(new OperatorType(H, MODULE, DELETE, "删除角色 <sb>${name}(${code})</sb>"));
|
new OperatorType(M, UPDATE, "修改角色 <sb>${name}(${code})</sb>"),
|
||||||
set(new OperatorType(M, MODULE, GRANT_MENU, "分配角色菜单 <sb>${name}(${code})</sb>"));
|
new OperatorType(M, UPDATE_STATUS, "修改角色状态 <sb>${name}(${code})</sb> - <sb>${statusName}</sb>"),
|
||||||
|
new OperatorType(H, DELETE, "删除角色 <sb>${name}(${code})</sb>"),
|
||||||
|
new OperatorType(M, GRANT_MENU, "分配角色菜单 <sb>${name}(${code})</sb>"),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.orion.ops.module.infra.define.operator;
|
package com.orion.ops.module.infra.define.operator;
|
||||||
|
|
||||||
|
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 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.enums.OperatorRiskLevel.*;
|
||||||
import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeHolder.set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统用户 操作日志类型
|
* 系统用户 操作日志类型
|
||||||
@@ -12,9 +13,8 @@ import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeH
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/10/10 17:30
|
* @since 2023/10/10 17:30
|
||||||
*/
|
*/
|
||||||
public class SystemUserOperatorType {
|
@Module("infra:system-user")
|
||||||
|
public class SystemUserOperatorType extends InitializingOperatorTypes {
|
||||||
private static final String MODULE = "infra:system-user";
|
|
||||||
|
|
||||||
public static final String CREATE = "system-user:create";
|
public static final String CREATE = "system-user:create";
|
||||||
|
|
||||||
@@ -28,13 +28,16 @@ public class SystemUserOperatorType {
|
|||||||
|
|
||||||
public static final String DELETE = "system-user:delete";
|
public static final String DELETE = "system-user:delete";
|
||||||
|
|
||||||
public static void init() {
|
@Override
|
||||||
set(new OperatorType(L, MODULE, CREATE, "创建用户 <sb>${username}</sb>"));
|
public OperatorType[] types() {
|
||||||
set(new OperatorType(M, MODULE, UPDATE, "修改用户 <sb>${username}</sb>"));
|
return new OperatorType[]{
|
||||||
set(new OperatorType(M, MODULE, UPDATE_STATUS, "修改用户状态 <sb>${username}</sb> - <sb>${statusName}</sb>"));
|
new OperatorType(L, CREATE, "创建用户 <sb>${username}</sb>"),
|
||||||
set(new OperatorType(M, MODULE, GRANT_ROLE, "用户分配角色 <sb>${username}</sb>"));
|
new OperatorType(M, UPDATE, "修改用户 <sb>${username}</sb>"),
|
||||||
set(new OperatorType(H, MODULE, RESET_PASSWORD, "重置用户密码 <sb>${username}</sb>"));
|
new OperatorType(M, UPDATE_STATUS, "修改用户状态 <sb>${username}</sb> - <sb>${statusName}</sb>"),
|
||||||
set(new OperatorType(H, MODULE, DELETE, "删除用户 <sb>${username}</sb>"));
|
new OperatorType(M, GRANT_ROLE, "用户分配角色 <sb>${username}</sb>"),
|
||||||
|
new OperatorType(H, RESET_PASSWORD, "重置用户密码 <sb>${username}</sb>"),
|
||||||
|
new OperatorType(H, DELETE, "删除用户 <sb>${username}</sb>"),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,8 +112,4 @@ public class OperatorLogDO extends BaseDO {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String updater;
|
private String updater;
|
||||||
|
|
||||||
@Schema(description = "是否删除 0未删除 1已删除")
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Boolean deleted;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
package com.orion.ops.module.infra.runner;
|
|
||||||
|
|
||||||
import com.orion.ops.module.infra.define.operator.AuthenticationOperatorType;
|
|
||||||
import com.orion.ops.module.infra.define.operator.SystemMenuOperatorType;
|
|
||||||
import com.orion.ops.module.infra.define.operator.SystemRoleOperatorType;
|
|
||||||
import com.orion.ops.module.infra.define.operator.SystemUserOperatorType;
|
|
||||||
import org.springframework.boot.CommandLineRunner;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 基建模块 操作类型初始化
|
|
||||||
*
|
|
||||||
* @author Jiahang Li
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 2023/10/10 18:03
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class InfraOperatorTypeRunner implements CommandLineRunner {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(String... args) {
|
|
||||||
AuthenticationOperatorType.init();
|
|
||||||
SystemMenuOperatorType.init();
|
|
||||||
SystemRoleOperatorType.init();
|
|
||||||
SystemUserOperatorType.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -23,11 +23,12 @@
|
|||||||
<result column="start_time" property="startTime"/>
|
<result column="start_time" property="startTime"/>
|
||||||
<result column="end_time" property="endTime"/>
|
<result column="end_time" property="endTime"/>
|
||||||
<result column="create_time" property="createTime"/>
|
<result column="create_time" property="createTime"/>
|
||||||
|
<result column="deleted" property="deleted"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, user_id, username, trace_id, address, location, user_agent, risk_level, module, type, log_info, extra, result, error_message, return_value, duration, start_time, end_time, create_time
|
id, user_id, username, trace_id, address, location, user_agent, risk_level, module, type, log_info, extra, result, error_message, return_value, duration, start_time, end_time, create_time, deleted
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user