|  | @@ -6,7 +6,6 @@ using Microsoft.Extensions.DependencyInjection;
 | 
	
		
			
				|  |  |  using ZhonTai.Admin.Core.Attributes;
 | 
	
		
			
				|  |  |  using ZhonTai.Admin.Core.Configs;
 | 
	
		
			
				|  |  |  using ZhonTai.Admin.Core.Dto;
 | 
	
		
			
				|  |  | -using ZhonTai.Admin.Core.Repositories;
 | 
	
		
			
				|  |  |  using ZhonTai.Admin.Services.Permission.Dto;
 | 
	
		
			
				|  |  |  using ZhonTai.Admin.Domain.Permission;
 | 
	
		
			
				|  |  |  using ZhonTai.Admin.Domain.RolePermission;
 | 
	
	
		
			
				|  | @@ -18,10 +17,10 @@ using ZhonTai.Admin.Domain.Api;
 | 
	
		
			
				|  |  |  using ZhonTai.Admin.Domain.User;
 | 
	
		
			
				|  |  |  using ZhonTai.DynamicApi;
 | 
	
		
			
				|  |  |  using ZhonTai.DynamicApi.Attributes;
 | 
	
		
			
				|  |  | -using ZhonTai.Admin.Core.Db;
 | 
	
		
			
				|  |  |  using ZhonTai.Admin.Core.Consts;
 | 
	
		
			
				|  |  |  using FreeSql;
 | 
	
		
			
				|  |  |  using ZhonTai.Admin.Domain.Tenant;
 | 
	
		
			
				|  |  | +using MySqlX.XDevAPI.Common;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  namespace ZhonTai.Admin.Services.Permission;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -62,27 +61,15 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    /// <summary>
 | 
	
		
			
				|  |  | -    /// 查询权限
 | 
	
		
			
				|  |  | -    /// </summary>
 | 
	
		
			
				|  |  | -    /// <param name="id"></param>
 | 
	
		
			
				|  |  | -    /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> GetAsync(long id)
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -        var result = await _permissionRepository.GetAsync(id);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok(result);
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
		
			
				|  |  |      /// 查询分组
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <param name="id"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> GetGroupAsync(long id)
 | 
	
		
			
				|  |  | +    public async Task<PermissionGetGroupOutput> GetGroupAsync(long id)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          var result = await _permissionRepository.GetAsync<PermissionGetGroupOutput>(id);
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok(result);
 | 
	
		
			
				|  |  | +        return result;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -90,10 +77,10 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <param name="id"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> GetMenuAsync(long id)
 | 
	
		
			
				|  |  | +    public async Task<PermissionGetMenuOutput> GetMenuAsync(long id)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          var result = await _permissionRepository.GetAsync<PermissionGetMenuOutput>(id);
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok(result);
 | 
	
		
			
				|  |  | +        return result;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -101,10 +88,10 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <param name="id"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> GetApiAsync(long id)
 | 
	
		
			
				|  |  | +    public async Task<PermissionGetApiOutput> GetApiAsync(long id)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          var result = await _permissionRepository.GetAsync<PermissionGetApiOutput>(id);
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok(result);
 | 
	
		
			
				|  |  | +        return result;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -112,14 +99,15 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <param name="id"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> GetDotAsync(long id)
 | 
	
		
			
				|  |  | +    public async Task<PermissionGetDotOutput> GetDotAsync(long id)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          var output = await _permissionRepository.Select
 | 
	
		
			
				|  |  |          .WhereDynamic(id)
 | 
	
		
			
				|  |  |          .IncludeMany(a => a.Apis.Select(b => new ApiEntity { Id = b.Id }))
 | 
	
		
			
				|  |  |          .ToOneAsync();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok(Mapper.Map<PermissionGetDotOutput>(output));
 | 
	
		
			
				|  |  | +        var permissionGetDotOutput= Mapper.Map<PermissionGetDotOutput>(output);
 | 
	
		
			
				|  |  | +        return permissionGetDotOutput;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -129,7 +117,7 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// <param name="start"></param>
 | 
	
		
			
				|  |  |      /// <param name="end"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> GetListAsync(string key, DateTime? start, DateTime? end)
 | 
	
		
			
				|  |  | +    public async Task<List<PermissionListOutput>> GetListAsync(string key, DateTime? start, DateTime? end)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          if (end.HasValue)
 | 
	
		
			
				|  |  |          {
 | 
	
	
		
			
				|  | @@ -143,14 +131,14 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |              .OrderBy(a => a.Sort)
 | 
	
		
			
				|  |  |              .ToListAsync(a=> new PermissionListOutput { ApiPaths = string.Join(";", _permissionApiRepository.Where(b=>b.PermissionId == a.Id).ToList(b => b.Api.Path)) });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok(data);
 | 
	
		
			
				|  |  | +        return data;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
		
			
				|  |  |      /// 查询角色权限-权限列表
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> GetPermissionList()
 | 
	
		
			
				|  |  | +    public async Task<IEnumerable<dynamic>> GetPermissionList()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          var permissions = await _permissionRepository.Select
 | 
	
		
			
				|  |  |              .WhereIf(_appConfig.Tenant && User.TenantType == TenantType.Tenant, a =>
 | 
	
	
		
			
				|  | @@ -170,7 +158,7 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |                  Row = a.Type == PermissionType.Menu
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok(menus);
 | 
	
		
			
				|  |  | +        return menus;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -178,13 +166,13 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <param name="roleId"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> GetRolePermissionList(long roleId = 0)
 | 
	
		
			
				|  |  | +    public async Task<List<long>> GetRolePermissionList(long roleId = 0)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          var permissionIds = await _rolePermissionRepository
 | 
	
		
			
				|  |  |              .Select.Where(d => d.RoleId == roleId)
 | 
	
		
			
				|  |  |              .ToListAsync(a => a.PermissionId);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok(permissionIds);
 | 
	
		
			
				|  |  | +        return permissionIds;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -192,13 +180,13 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <param name="tenantId"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> GetTenantPermissionList(long tenantId)
 | 
	
		
			
				|  |  | +    public async Task<List<long>> GetTenantPermissionList(long tenantId)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          var permissionIds = await _tenantPermissionRepository
 | 
	
		
			
				|  |  |              .Select.Where(d => d.TenantId == tenantId)
 | 
	
		
			
				|  |  |              .ToListAsync(a => a.PermissionId);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok(permissionIds);
 | 
	
		
			
				|  |  | +        return permissionIds;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -206,12 +194,11 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <param name="input"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> AddGroupAsync(PermissionAddGroupInput input)
 | 
	
		
			
				|  |  | +    public async Task<long> AddGroupAsync(PermissionAddGroupInput input)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          var entity = Mapper.Map<PermissionEntity>(input);
 | 
	
		
			
				|  |  | -        var id = (await _permissionRepository.InsertAsync(entity)).Id;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok(id > 0);
 | 
	
		
			
				|  |  | +        await _permissionRepository.InsertAsync(entity);
 | 
	
		
			
				|  |  | +        return entity.Id;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -219,12 +206,12 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <param name="input"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> AddMenuAsync(PermissionAddMenuInput input)
 | 
	
		
			
				|  |  | +    public async Task<long> AddMenuAsync(PermissionAddMenuInput input)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          var entity = Mapper.Map<PermissionEntity>(input);
 | 
	
		
			
				|  |  | -        var id = (await _permissionRepository.InsertAsync(entity)).Id;
 | 
	
		
			
				|  |  | +        await _permissionRepository.InsertAsync(entity);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok(id > 0);
 | 
	
		
			
				|  |  | +        return entity.Id;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -232,12 +219,12 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <param name="input"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> AddApiAsync(PermissionAddApiInput input)
 | 
	
		
			
				|  |  | +    public async Task<long> AddApiAsync(PermissionAddApiInput input)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          var entity = Mapper.Map<PermissionEntity>(input);
 | 
	
		
			
				|  |  | -        var id = (await _permissionRepository.InsertAsync(entity)).Id;
 | 
	
		
			
				|  |  | +        await _permissionRepository.InsertAsync(entity);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok(id > 0);
 | 
	
		
			
				|  |  | +        return entity.Id;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -246,18 +233,18 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// <param name="input"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  |      [AdminTransaction]
 | 
	
		
			
				|  |  | -    public virtual async Task<IResultOutput> AddDotAsync(PermissionAddDotInput input)
 | 
	
		
			
				|  |  | +    public virtual async Task<long> AddDotAsync(PermissionAddDotInput input)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          var entity = Mapper.Map<PermissionEntity>(input);
 | 
	
		
			
				|  |  | -        var id = (await _permissionRepository.InsertAsync(entity)).Id;
 | 
	
		
			
				|  |  | +        await _permissionRepository.InsertAsync(entity);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (input.ApiIds != null && input.ApiIds.Any())
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            var permissionApis = input.ApiIds.Select(a => new PermissionApiEntity { PermissionId = id, ApiId = a });
 | 
	
		
			
				|  |  | +            var permissionApis = input.ApiIds.Select(a => new PermissionApiEntity { PermissionId = entity.Id, ApiId = a });
 | 
	
		
			
				|  |  |              await _permissionApiRepository.InsertAsync(permissionApis);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok(id > 0);
 | 
	
		
			
				|  |  | +        return entity.Id;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -265,17 +252,11 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <param name="input"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> UpdateGroupAsync(PermissionUpdateGroupInput input)
 | 
	
		
			
				|  |  | +    public async Task UpdateGroupAsync(PermissionUpdateGroupInput input)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  | -        var result = false;
 | 
	
		
			
				|  |  | -        if (input != null && input.Id > 0)
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -            var entity = await _permissionRepository.GetAsync(input.Id);
 | 
	
		
			
				|  |  | -            entity = Mapper.Map(input, entity);
 | 
	
		
			
				|  |  | -            result = (await _permissionRepository.UpdateAsync(entity)) > 0;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        return ResultOutput.Result(result);
 | 
	
		
			
				|  |  | +        var entity = await _permissionRepository.GetAsync(input.Id);
 | 
	
		
			
				|  |  | +        entity = Mapper.Map(input, entity);
 | 
	
		
			
				|  |  | +        await _permissionRepository.UpdateAsync(entity);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -283,17 +264,11 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <param name="input"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> UpdateMenuAsync(PermissionUpdateMenuInput input)
 | 
	
		
			
				|  |  | +    public async Task UpdateMenuAsync(PermissionUpdateMenuInput input)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  | -        var result = false;
 | 
	
		
			
				|  |  | -        if (input != null && input.Id > 0)
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -            var entity = await _permissionRepository.GetAsync(input.Id);
 | 
	
		
			
				|  |  | -            entity = Mapper.Map(input, entity);
 | 
	
		
			
				|  |  | -            result = (await _permissionRepository.UpdateAsync(entity)) > 0;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        return ResultOutput.Result(result);
 | 
	
		
			
				|  |  | +        var entity = await _permissionRepository.GetAsync(input.Id);
 | 
	
		
			
				|  |  | +        entity = Mapper.Map(input, entity);
 | 
	
		
			
				|  |  | +        await _permissionRepository.UpdateAsync(entity);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -301,17 +276,11 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <param name="input"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> UpdateApiAsync(PermissionUpdateApiInput input)
 | 
	
		
			
				|  |  | +    public async Task UpdateApiAsync(PermissionUpdateApiInput input)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  | -        var result = false;
 | 
	
		
			
				|  |  | -        if (input != null && input.Id > 0)
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -            var entity = await _permissionRepository.GetAsync(input.Id);
 | 
	
		
			
				|  |  | -            entity = Mapper.Map(input, entity);
 | 
	
		
			
				|  |  | -            result = (await _permissionRepository.UpdateAsync(entity)) > 0;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        return ResultOutput.Result(result);
 | 
	
		
			
				|  |  | +        var entity = await _permissionRepository.GetAsync(input.Id);
 | 
	
		
			
				|  |  | +        entity = Mapper.Map(input, entity);
 | 
	
		
			
				|  |  | +        await _permissionRepository.UpdateAsync(entity);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -320,22 +289,16 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// <param name="input"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  |      [AdminTransaction]
 | 
	
		
			
				|  |  | -    public virtual async Task<IResultOutput> UpdateDotAsync(PermissionUpdateDotInput input)
 | 
	
		
			
				|  |  | +    public virtual async Task UpdateDotAsync(PermissionUpdateDotInput input)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  | -        if (!(input?.Id > 0))
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -            return ResultOutput.NotOk();
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          var entity = await _permissionRepository.GetAsync(input.Id);
 | 
	
		
			
				|  |  |          if (!(entity?.Id > 0))
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            return ResultOutput.NotOk("权限点不存在!");
 | 
	
		
			
				|  |  | +            throw ResultOutput.Exception("权限点不存在!");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          Mapper.Map(input, entity);
 | 
	
		
			
				|  |  |          await _permissionRepository.UpdateAsync(entity);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          await _permissionApiRepository.DeleteAsync(a => a.PermissionId == entity.Id);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (input.ApiIds != null && input.ApiIds.Any())
 | 
	
	
		
			
				|  | @@ -346,8 +309,6 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //清除用户权限缓存
 | 
	
		
			
				|  |  |          await ClearUserPermissionsAsync(new List<long> { entity.Id });
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -356,7 +317,7 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// <param name="id"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  |      [AdminTransaction]
 | 
	
		
			
				|  |  | -    public virtual async Task<IResultOutput> DeleteAsync(long id)
 | 
	
		
			
				|  |  | +    public virtual async Task DeleteAsync(long id)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          //递归查询所有权限点
 | 
	
		
			
				|  |  |          var ids = _permissionRepository.Select
 | 
	
	
		
			
				|  | @@ -372,8 +333,6 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //清除用户权限缓存
 | 
	
		
			
				|  |  |          await ClearUserPermissionsAsync(ids);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -381,7 +340,7 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  |      /// <param name="id"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  | -    public async Task<IResultOutput> SoftDeleteAsync(long id)
 | 
	
		
			
				|  |  | +    public async Task SoftDeleteAsync(long id)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          //递归查询所有权限点
 | 
	
		
			
				|  |  |          var ids = _permissionRepository.Select
 | 
	
	
		
			
				|  | @@ -394,8 +353,6 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //清除用户权限缓存
 | 
	
		
			
				|  |  |          await ClearUserPermissionsAsync(ids);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -404,13 +361,13 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// <param name="input"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  |      [AdminTransaction]
 | 
	
		
			
				|  |  | -    public virtual async Task<IResultOutput> AssignAsync(PermissionAssignInput input)
 | 
	
		
			
				|  |  | +    public virtual async Task AssignAsync(PermissionAssignInput input)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          //分配权限的时候判断角色是否存在
 | 
	
		
			
				|  |  |          var exists = await _roleRepository.Select.DisableGlobalFilter(FilterNames.Tenant).WhereDynamic(input.RoleId).AnyAsync();
 | 
	
		
			
				|  |  |          if (!exists)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            return ResultOutput.NotOk("该角色不存在或已被删除!");
 | 
	
		
			
				|  |  | +            throw ResultOutput.Exception("该角色不存在或已被删除!");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //查询角色权限
 | 
	
	
		
			
				|  | @@ -454,8 +411,6 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  |              await Cache.DelAsync(CacheKeys.UserPermissions + userId);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
	
		
			
				|  | @@ -464,7 +419,7 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |      /// <param name="input"></param>
 | 
	
		
			
				|  |  |      /// <returns></returns>
 | 
	
		
			
				|  |  |      [AdminTransaction]
 | 
	
		
			
				|  |  | -    public virtual async Task<IResultOutput> SaveTenantPermissionsAsync(PermissionSaveTenantPermissionsInput input)
 | 
	
		
			
				|  |  | +    public virtual async Task SaveTenantPermissionsAsync(PermissionSaveTenantPermissionsInput input)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          //查询租户权限
 | 
	
		
			
				|  |  |          var permissionIds = await _tenantPermissionRepository.Select.Where(d => d.TenantId == input.TenantId).ToListAsync(m => m.PermissionId);
 | 
	
	
		
			
				|  | @@ -503,7 +458,5 @@ public class PermissionService : BaseService, IPermissionService, IDynamicApi
 | 
	
		
			
				|  |  |                  await Cache.DelAsync(CacheKeys.UserPermissions + userId);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        return ResultOutput.Ok();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 |