Merge pull request 'twt_2008-patch-2' (#200) from twt_2008/Admin.NET.Pro:twt_2008-patch-2 into main

Reviewed-on: http://101.43.53.74:3000/Admin.NET/Admin.NET.Pro/pulls/200
This commit is contained in:
zuohuaijun 2024-12-14 15:08:54 +08:00
commit a0f6e595dd

View File

@ -24,6 +24,7 @@ public class SysTenantService : IDynamicApiController, ITransient
private readonly SysRoleMenuService _sysRoleMenuService; private readonly SysRoleMenuService _sysRoleMenuService;
private readonly SysConfigService _sysConfigService; private readonly SysConfigService _sysConfigService;
private readonly SysCacheService _sysCacheService; private readonly SysCacheService _sysCacheService;
private readonly IEventPublisher _eventPublisher;
public SysTenantService(SqlSugarRepository<SysTenant> sysTenantRep, public SysTenantService(SqlSugarRepository<SysTenant> sysTenantRep,
SqlSugarRepository<SysOrg> sysOrgRep, SqlSugarRepository<SysOrg> sysOrgRep,
@ -36,7 +37,8 @@ public class SysTenantService : IDynamicApiController, ITransient
SysUserRoleService sysUserRoleService, SysUserRoleService sysUserRoleService,
SysRoleMenuService sysRoleMenuService, SysRoleMenuService sysRoleMenuService,
SysConfigService sysConfigService, SysConfigService sysConfigService,
SysCacheService sysCacheService) SysCacheService sysCacheService,
IEventPublisher eventPublisher)
{ {
_sysTenantRep = sysTenantRep; _sysTenantRep = sysTenantRep;
_sysOrgRep = sysOrgRep; _sysOrgRep = sysOrgRep;
@ -50,6 +52,7 @@ public class SysTenantService : IDynamicApiController, ITransient
_sysRoleMenuService = sysRoleMenuService; _sysRoleMenuService = sysRoleMenuService;
_sysConfigService = sysConfigService; _sysConfigService = sysConfigService;
_sysCacheService = sysCacheService; _sysCacheService = sysCacheService;
_eventPublisher = eventPublisher;
} }
/// <summary> /// <summary>
@ -254,6 +257,9 @@ public class SysTenantService : IDynamicApiController, ITransient
1310000000801 // 关于项目 1310000000801 // 关于项目
}; };
await _sysRoleMenuService.GrantRoleMenu(new RoleMenuInput() { Id = newRole.Id, MenuIdList = menuIdList }); await _sysRoleMenuService.GrantRoleMenu(new RoleMenuInput() { Id = newRole.Id, MenuIdList = menuIdList });
//发布新增租户事件
await _eventPublisher.PublishAsync(CommonConst.InitTenant, tenant);
} }
/// <summary> /// <summary>
@ -295,6 +301,9 @@ public class SysTenantService : IDynamicApiController, ITransient
await _sysOrgRep.AsDeleteable().Where(u => u.TenantId == input.Id).ExecuteCommandAsync(); await _sysOrgRep.AsDeleteable().Where(u => u.TenantId == input.Id).ExecuteCommandAsync();
await _sysPosRep.AsDeleteable().Where(u => u.TenantId == input.Id).ExecuteCommandAsync(); await _sysPosRep.AsDeleteable().Where(u => u.TenantId == input.Id).ExecuteCommandAsync();
//发布删除租户事件
await _eventPublisher.PublishAsync(CommonConst.DeleteTenant, input);
} }
/// <summary> /// <summary>