mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-10-20 07:01:31 +08:00
chore: 增加测试用户数据
This commit is contained in:
@@ -33,6 +33,9 @@ import top.continew.admin.system.mapper.user.UserSocialMapper;
|
||||
import top.continew.admin.system.model.entity.*;
|
||||
import top.continew.admin.system.model.entity.user.UserDO;
|
||||
import top.continew.admin.system.model.entity.user.UserSocialDO;
|
||||
import top.continew.admin.tenant.mapper.PackageMapper;
|
||||
import top.continew.admin.tenant.mapper.PackageMenuMapper;
|
||||
import top.continew.admin.tenant.mapper.TenantMapper;
|
||||
import top.continew.starter.cache.redisson.util.RedisUtils;
|
||||
import top.continew.starter.core.constant.StringConstants;
|
||||
import top.continew.starter.extension.tenant.annotation.TenantIgnore;
|
||||
@@ -65,14 +68,18 @@ public class DemoEnvironmentJob {
|
||||
private final RoleMenuMapper roleMenuMapper;
|
||||
private final MenuMapper menuMapper;
|
||||
private final DeptMapper deptMapper;
|
||||
|
||||
private final AppMapper appMapper;
|
||||
private final ClientMapper clientsMapper;
|
||||
private final TenantMapper tenantMapper;
|
||||
private final PackageMapper packageMapper;
|
||||
private final PackageMenuMapper packageMenuMapper;
|
||||
|
||||
private static final Long DELETE_FLAG = 10000L;
|
||||
private static final Long MESSAGE_FLAG = 0L;
|
||||
private static final List<Long> USER_FLAG = List
|
||||
.of(1L, 547889293968801822L, 547889293968801823L, 547889293968801824L, 547889293968801825L, 547889293968801826L, 547889293968801827L, 547889293968801828L, 547889293968801829L, 547889293968801830L, 547889293968801831L);
|
||||
.of(1L, 547889293968801822L, 547889293968801823L, 547889293968801824L, 547889293968801825L,
|
||||
547889293968801826L, 547889293968801827L, 547889293968801828L, 547889293968801829L,
|
||||
547889293968801830L, 547889293968801831L, 547889293968801832L, 547889293968801833L, 547889293968801834L);
|
||||
private static final List<Long> ROLE_FLAG = List.of(1L, 2L, 547888897925840927L, 547888897925840928L);
|
||||
private static final Long DEPT_FLAG = 547887852587843611L;
|
||||
|
||||
@@ -109,6 +116,10 @@ public class DemoEnvironmentJob {
|
||||
this.log(appCount, "应用");
|
||||
Long clientCount = clientsMapper.lambdaQuery().gt(ClientDO::getId, DELETE_FLAG).count();
|
||||
this.log(clientCount, "客户端");
|
||||
Long tenantCount = tenantMapper.lambdaQuery().count();
|
||||
this.log(tenantCount, "租户");
|
||||
Long packageCount = packageMapper.lambdaQuery().count();
|
||||
this.log(packageCount, "套餐");
|
||||
InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().blockAttack(true).build());
|
||||
SnailJobLog.REMOTE.info("演示环境待清理数据项检测完成,开始执行清理。");
|
||||
// 清理关联数据
|
||||
@@ -119,6 +130,7 @@ public class DemoEnvironmentJob {
|
||||
roleDeptMapper.lambdaUpdate().notIn(RoleDeptDO::getRoleId, ROLE_FLAG).remove();
|
||||
roleMenuMapper.lambdaUpdate().notIn(RoleMenuDO::getRoleId, ROLE_FLAG).remove();
|
||||
userSocialMapper.lambdaUpdate().notIn(UserSocialDO::getUserId, USER_FLAG).remove();
|
||||
packageMenuMapper.lambdaUpdate().remove();
|
||||
// 清理具体数据
|
||||
this.clean(dictItemCount, "字典项", null, () -> dictItemMapper.lambdaUpdate()
|
||||
.gt(DictItemDO::getId, DELETE_FLAG)
|
||||
@@ -145,6 +157,8 @@ public class DemoEnvironmentJob {
|
||||
this.clean(clientCount, "客户端", null, () -> clientsMapper.lambdaUpdate()
|
||||
.gt(ClientDO::getId, DEPT_FLAG)
|
||||
.remove());
|
||||
this.clean(tenantCount, "租户", null, () -> tenantMapper.lambdaUpdate().remove());
|
||||
this.clean(packageCount, "套餐", null, () -> packageMapper.lambdaUpdate().remove());
|
||||
SnailJobLog.REMOTE.info("演示环境数据已清理完成。");
|
||||
SnailJobLog.REMOTE.info("定时任务 [重置演示环境数据] 执行结束。");
|
||||
} finally {
|
||||
|
Reference in New Issue
Block a user