using TakeoutSaaS.Domain.Identity.Entities; namespace TakeoutSaaS.Domain.Identity.Repositories; /// /// 权限仓储。 /// public interface IPermissionRepository { /// /// 根据 ID 查询权限。 /// /// 权限 ID。 /// 租户 ID。 /// 取消标记。 /// 权限实体或 null。 Task FindByIdAsync(long permissionId, long tenantId, CancellationToken cancellationToken = default); /// /// 根据编码查询权限。 /// /// 权限编码。 /// 租户 ID。 /// 取消标记。 /// 权限实体或 null。 Task FindByCodeAsync(string code, long tenantId, CancellationToken cancellationToken = default); /// /// 根据编码集合查询权限列表。 /// /// 租户 ID。 /// 权限编码集合。 /// 取消标记。 /// 权限集合。 Task> GetByCodesAsync(long tenantId, IEnumerable codes, CancellationToken cancellationToken = default); /// /// 根据 ID 集合查询权限列表。 /// /// 租户 ID。 /// 权限 ID 集合。 /// 取消标记。 /// 权限集合。 Task> GetByIdsAsync(long tenantId, IEnumerable permissionIds, CancellationToken cancellationToken = default); /// /// 按关键字搜索权限。 /// /// 租户 ID。 /// 关键字。 /// 取消标记。 /// 权限集合。 Task> SearchAsync(long tenantId, string? keyword, CancellationToken cancellationToken = default); /// /// 新增权限。 /// /// 权限实体。 /// 取消标记。 /// 异步操作任务。 Task AddAsync(Permission permission, CancellationToken cancellationToken = default); /// /// 更新权限。 /// /// 权限实体。 /// 取消标记。 /// 异步操作任务。 Task UpdateAsync(Permission permission, CancellationToken cancellationToken = default); /// /// 删除权限。 /// /// 权限 ID。 /// 租户 ID。 /// 取消标记。 /// 异步操作任务。 Task DeleteAsync(long permissionId, long tenantId, CancellationToken cancellationToken = default); /// /// 保存仓储变更。 /// /// 取消标记。 /// 异步操作任务。 Task SaveChangesAsync(CancellationToken cancellationToken = default); }