修改初始化操作类型逻辑.
This commit is contained in:
@@ -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