diff --git a/Admin.NET/Admin.NET.Core/Service/Role/SysRoleService.cs b/Admin.NET/Admin.NET.Core/Service/Role/SysRoleService.cs index c7b5e43e..e98265df 100644 --- a/Admin.NET/Admin.NET.Core/Service/Role/SysRoleService.cs +++ b/Admin.NET/Admin.NET.Core/Service/Role/SysRoleService.cs @@ -94,7 +94,13 @@ public class SysRoleService : IDynamicApiController, ITransient if (await _sysRoleRep.IsAnyAsync(u => u.Name == input.Name && u.Code == input.Code)) throw Oops.Oh(ErrorCodeEnum.D1006); - await _sysRoleRep.InsertAsync(input.Adapt()); + var roleId = await _sysRoleRep.AsInsertable(input.Adapt()).ExecuteReturnSnowflakeIdAsync(); + + // 授权角色基础菜单集合 + var menuIdList = new List { 1300000000111,1300000000121, // 工作台 + 1310000000161,1310000000162,1310000000163,1310000000164,1310000000165, // 个人中心 + }; + await _sysRoleMenuService.GrantRoleMenu(new RoleMenuInput() { Id = roleId, MenuIdList = menuIdList }); } /// @@ -311,10 +317,10 @@ public class SysRoleService : IDynamicApiController, ITransient // 当前账号所有角色集合 var roleIds = await _sysUserRoleService.GetUserRoleIdList(_userManager.UserId); - // 已有按钮权限集合 + // 已勾选按钮权限集合 apiList[0] = await GetRoleButtonList(roleIds); - // 未有按钮权限集合 + // 未勾选按钮权限集合(放到接口黑名单里面) var allButtonList = await GetButtonList(new()); apiList[1] = allButtonList.Except(apiList[0]).ToList(); // 差集