123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using BLL.Dto.AuthDto;
- using DAL.Services;
- using Helper;
- using HZY.Framework.DependencyInjection;
- using Mapster;
- using Model;
- namespace BLL.Manager
- {
- public class AuthManager:IScopedSelfDependency
- {
- private readonly AuthService _authService;
- public AuthManager(AuthService authService)
- {
- _authService = authService;
- }
- public async Task<BaseResult> UpdateAuthAsync(UpdateAuthDto request)
- {
- var entity = request.Adapt<AuthEntity>();
- var res = await _authService.UpdateAsync(entity);
- if (res)
- {
- return new BaseResult() { Result = SystemEnums.Result.Success };
- }
- return new BaseResult() { Result = SystemEnums.Result.Fail, Msg = "更新权限失败" };
- }
- public async Task<BaseResult<QueryAuthResultDto>> GetAuthAsync(QueryAuthDto request)
- {
- var res = await _authService.GetByOneAsync(c => c.Role == request.Role);
- return new BaseResult<QueryAuthResultDto>() { Result = SystemEnums.Result.Success, Data = new List<QueryAuthResultDto>() { res.Adapt<QueryAuthResultDto>() } };
- }
- }
- }
|