public async Task <List <MenuJsTreeAuthorizeDto> > GetMenuJsTreeAuthorizeAsync(NullableIdDto <int> input) { if (!input.Id.HasValue) { throw new UserFriendlyException("Key不能为空!"); } var entity = await _roleManage.GetRoleByIdAsync( input.Id.Value, new List <string> { "Menus", "MenuAppAuthorizes" }); Expression <Func <Menu, bool> > where = w => w.IsMenu && w.IsValid; var menuIdList = entity.Menus? .Select(x => x.Id).ToList(); var menuAppAuthorizeIdList = entity.MenuAppAuthorizes? .Select(x => x.Id).ToList(); var menus = await _menuManage.GetMenuChildrenListAuthorizeAsync( where, AprilSession.BelongUserId, menuAppAuthorizeIdList, menuIdList); return(menus.MapTo <List <MenuJsTreeAuthorizeDto> >()); }
public async Task <RoleEditDto> GetRoleByIdAsync(NullableIdDto <long> input) { RoleEditDto edit; if (input.Id.HasValue) { var entity = await _roleManage.GetRoleByIdAsync(input.Id.Value); edit = entity.MapTo <RoleEditDto>(); } else { edit = new RoleEditDto(); } return(edit); }