Security/Yuebon.Security.Services/RoleAuthorizeService.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
namespace Yuebon.Security.Services;
/// <summary>
///
/// </summary>
public class RoleAuthorizeService: BaseService<RoleAuthorize, RoleAuthorizeOutputDto>, IRoleAuthorizeService
{
private readonly IRoleAuthorizeRepository _repository;
private readonly IMenuRepository menuRepository;
private readonly ISystemTypeRepository systemTypeRepository;
/// <summary>
///
/// </summary>
/// <param name="repository"></param>
/// <param name="_menuRepository"></param>
/// <param name="_systemTypeRepository"></param>
public RoleAuthorizeService(IRoleAuthorizeRepository roleAuthorizeRepository, IMenuRepository _menuRepository, ISystemTypeRepository _systemTypeRepository)
{
repository = roleAuthorizeRepository;
_repository = roleAuthorizeRepository;
menuRepository = _menuRepository;
systemTypeRepository = _systemTypeRepository;
}
/// <summary>
/// 根据角色和项目类型查询权限
/// </summary>
/// <param name="roleIds">角色Id</param>
/// <param name="itemType"></param>
/// <returns></returns>
public IEnumerable<RoleAuthorize> GetListRoleAuthorizeByRoleId(string roleIds, string itemType)
{
IEnumerable<RoleAuthorize> list = _repository.GetListWhere(string.Format("ItemType in({0}) and ObjectId in ({1}) and ObjectType=1", itemType, roleIds));
return list;
}
/// <summary>
/// 获取功能菜单适用于Vue Tree树形
/// </summary>
/// <returns></returns>
public async Task<List<ModuleFunctionOutputDto>> GetAllFunctionTree()
{
string where = "1=1";
List<ModuleFunctionOutputDto> reslist = new List<ModuleFunctionOutputDto>();
IEnumerable<SystemType> listSystemType = await systemTypeRepository.GetListWhereAsync(where);
foreach (SystemType systemType in listSystemType)
{
ModuleFunctionOutputDto menuTreeTableOutputDto = new ModuleFunctionOutputDto();
menuTreeTableOutputDto.Id = systemType.Id;
menuTreeTableOutputDto.FullName = systemType.FullName;
menuTreeTableOutputDto.FunctionTag =0;
menuTreeTableOutputDto.IsShow = true;
IEnumerable<Menu> elist = await menuRepository.GetListWhereAsync("SystemTypeId='" + systemType.Id + "'");
if (elist.Count() > 0)
{
List<Menu> list = elist.OrderBy(t => t.SortCode).ToList();
后面还有 50 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。