修改初始化操作类型逻辑.
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.config.OperatorLogConfig;
|
||||
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.OperatorType;
|
||||
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;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.orion.ops.framework.biz.operator.log.core.model;
|
||||
|
||||
import com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
@@ -14,7 +13,6 @@ import lombok.Getter;
|
||||
* @since 2023/10/10 10:29
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
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;
|
||||
|
||||
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);
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@ public class EnumsTemplate extends VueTemplate {
|
||||
|
||||
/**
|
||||
* 添加 value
|
||||
* 如果 value 和 name 相同可以省略 (无 value 自动使用 name)
|
||||
*
|
||||
* @param values values
|
||||
* @return this
|
||||
|
||||
@@ -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}"),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
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 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.holder.OperatorTypeHolder.set;
|
||||
|
||||
/**
|
||||
* 主机身份 操作日志类型
|
||||
@@ -13,9 +14,8 @@ import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeH
|
||||
* @version 1.0.0
|
||||
* @since 2023/10/10 17:30
|
||||
*/
|
||||
public class HostIdentityOperatorType {
|
||||
|
||||
private static final String MODULE = "asset:host-identity";
|
||||
@Module("asset:host-identity")
|
||||
public class HostIdentityOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
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 void init() {
|
||||
set(new OperatorType(L, MODULE, CREATE, "创建主机身份 <sb>${name}</sb>"));
|
||||
set(new OperatorType(L, MODULE, UPDATE, "修改主机身份 <sb>${name}</sb>"));
|
||||
set(new OperatorType(H, MODULE, DELETE, "删除主机身份 <sb>${name}</sb>"));
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
return new OperatorType[]{
|
||||
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;
|
||||
|
||||
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.H;
|
||||
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
|
||||
* @since 2023/10/10 17:30
|
||||
*/
|
||||
public class HostKeyOperatorType {
|
||||
|
||||
private static final String MODULE = "asset:host-key";
|
||||
@Module("asset:host-key")
|
||||
public class HostKeyOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
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 void init() {
|
||||
set(new OperatorType(L, MODULE, CREATE, "创建主机秘钥 <sb>${name}</sb>"));
|
||||
set(new OperatorType(L, MODULE, UPDATE, "修改主机秘钥 <sb>${name}</sb>"));
|
||||
set(new OperatorType(H, MODULE, DELETE, "删除主机秘钥 <sb>${name}</sb>"));
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
return new OperatorType[]{
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 主机 操作日志类型
|
||||
@@ -12,9 +13,8 @@ import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeH
|
||||
* @version 1.0.0
|
||||
* @since 2023/10/10 17:30
|
||||
*/
|
||||
public class HostOperatorType {
|
||||
|
||||
private static final String MODULE = "asset:host";
|
||||
@Module("asset:host")
|
||||
public class HostOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
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 void init() {
|
||||
set(new OperatorType(L, MODULE, CREATE, "创建主机 <sb>${name}</sb>"));
|
||||
set(new OperatorType(L, MODULE, UPDATE, "修改主机 <sb>${name}</sb>"));
|
||||
set(new OperatorType(H, MODULE, DELETE, "删除主机 <sb>${name}</sb>"));
|
||||
set(new OperatorType(M, MODULE, UPDATE_CONFIG, "修改主机配置 <sb>${name}</sb> | <sb>${type}</sb>"));
|
||||
set(new OperatorType(M, MODULE, UPDATE_CONFIG_STATUS, "修改主机配置状态 <sb>${name}</sb> | <sb>${type}</sb> - <sb>${statusName}</sb>"));
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
return new OperatorType[]{
|
||||
new OperatorType(L, CREATE, "创建主机 <sb>${name}</sb>"),
|
||||
new OperatorType(L, UPDATE, "修改主机 <sb>${name}</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;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.ops.module.infra.entity.domain.OperatorLogDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -14,4 +15,16 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
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;
|
||||
|
||||
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.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
|
||||
* @since 2023-10-10 19:06
|
||||
*/
|
||||
public class AuthenticationOperatorType {
|
||||
|
||||
private static final String MODULE = "infra:authentication";
|
||||
@Module("infra:authentication")
|
||||
public class AuthenticationOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
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 void init() {
|
||||
set(new OperatorType(L, MODULE, LOGIN, "登陆系统"));
|
||||
set(new OperatorType(L, MODULE, LOGOUT, "登出系统"));
|
||||
set(new OperatorType(L, MODULE, UPDATE_PASSWORD, "修改密码"));
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
return new OperatorType[]{
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 系统菜单 操作日志类型
|
||||
@@ -12,9 +13,8 @@ import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeH
|
||||
* @version 1.0.0
|
||||
* @since 2023/10/10 17:30
|
||||
*/
|
||||
public class SystemMenuOperatorType {
|
||||
|
||||
private static final String MODULE = "infra:system-menu";
|
||||
@Module("infra:system-menu")
|
||||
public class SystemMenuOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
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 void init() {
|
||||
set(new OperatorType(L, MODULE, CREATE, "创建菜单 <sb>${name}</sb>"));
|
||||
set(new OperatorType(L, MODULE, UPDATE, "修改菜单 <sb>${name}</sb>"));
|
||||
set(new OperatorType(M, MODULE, UPDATE_STATUS, "修改菜单状态 <sb>${name}</sb> - <sb>${label}</sb>"));
|
||||
set(new OperatorType(H, MODULE, DELETE, "删除菜单 <sb>${name}</sb>"));
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
return new OperatorType[]{
|
||||
new OperatorType(L, CREATE, "创建菜单 <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;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 系统角色 操作日志类型
|
||||
@@ -12,9 +13,8 @@ import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeH
|
||||
* @version 1.0.0
|
||||
* @since 2023/10/10 17:30
|
||||
*/
|
||||
public class SystemRoleOperatorType {
|
||||
|
||||
private static final String MODULE = "infra:system-role";
|
||||
@Module("infra:system-role")
|
||||
public class SystemRoleOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
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 void init() {
|
||||
set(new OperatorType(L, MODULE, CREATE, "创建角色 <sb>${name}(${code})</sb>"));
|
||||
set(new OperatorType(M, MODULE, UPDATE, "修改角色 <sb>${name}(${code})</sb>"));
|
||||
set(new OperatorType(M, MODULE, UPDATE_STATUS, "修改角色状态 <sb>${name}(${code})</sb> - <sb>${statusName}</sb>"));
|
||||
set(new OperatorType(H, MODULE, DELETE, "删除角色 <sb>${name}(${code})</sb>"));
|
||||
set(new OperatorType(M, MODULE, GRANT_MENU, "分配角色菜单 <sb>${name}(${code})</sb>"));
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
return new OperatorType[]{
|
||||
new OperatorType(L, CREATE, "创建角色 <sb>${name}(${code})</sb>"),
|
||||
new OperatorType(M, UPDATE, "修改角色 <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;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 系统用户 操作日志类型
|
||||
@@ -12,9 +13,8 @@ import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeH
|
||||
* @version 1.0.0
|
||||
* @since 2023/10/10 17:30
|
||||
*/
|
||||
public class SystemUserOperatorType {
|
||||
|
||||
private static final String MODULE = "infra:system-user";
|
||||
@Module("infra:system-user")
|
||||
public class SystemUserOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
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 void init() {
|
||||
set(new OperatorType(L, MODULE, CREATE, "创建用户 <sb>${username}</sb>"));
|
||||
set(new OperatorType(M, MODULE, UPDATE, "修改用户 <sb>${username}</sb>"));
|
||||
set(new OperatorType(M, MODULE, UPDATE_STATUS, "修改用户状态 <sb>${username}</sb> - <sb>${statusName}</sb>"));
|
||||
set(new OperatorType(M, MODULE, GRANT_ROLE, "用户分配角色 <sb>${username}</sb>"));
|
||||
set(new OperatorType(H, MODULE, RESET_PASSWORD, "重置用户密码 <sb>${username}</sb>"));
|
||||
set(new OperatorType(H, MODULE, DELETE, "删除用户 <sb>${username}</sb>"));
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
return new OperatorType[]{
|
||||
new OperatorType(L, CREATE, "创建用户 <sb>${username}</sb>"),
|
||||
new OperatorType(M, UPDATE, "修改用户 <sb>${username}</sb>"),
|
||||
new OperatorType(M, UPDATE_STATUS, "修改用户状态 <sb>${username}</sb> - <sb>${statusName}</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)
|
||||
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="end_time" property="endTime"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<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>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user