Exemplo n.º 1
0
        /// <summary>
        /// 分页列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <BasePageQueryOutput <QueryRoleDto> > GetPageList(QueryRolesInput input)
        {
            var list        = new List <Role>();
            var totalNumber = 0;
            var query       = await _dbContext.Queryable <Role>()
                              .WhereIF(input.DeptId.HasValue, o => o.DeptId == input.DeptId.Value)
                              .ToPageListAsync(input.Page, input.PageSize, totalNumber);

            list        = query.Key;
            totalNumber = query.Value;
            var result = new List <QueryRoleDto>();

            if (list != null && list.Count > 0)
            {
                list.ForEach(o =>
                {
                    var parent = _dbContext.Queryable <Organize>().First(it => it.KeyId == o.DeptId);
                    result.Add(new QueryRoleDto
                    {
                        DeptName   = parent?.Name,
                        KeyId      = o.KeyId,
                        CreateTime = o.CreateTime,
                        DeptId     = o.DeptId,
                        Name       = o.Name,
                        Codes      = o.Codes,
                        CreateId   = o.CreateId
                    });
                });
            }
            return(new BasePageQueryOutput <QueryRoleDto> {
                Page = input.Page, Rows = result, Total = totalNumber
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// 查询列表
        /// </summary>
        public async Task <IEnumerable <Permissions> > GetListByUserTypeAsync(Guid userId, int type = 2)
        {
            var query = await _dbContext.Queryable <Permissions>()
                        .Where(o => o.UserId == userId)
                        .Where(o => o.Types == type)
                        .ToListAsync();

            return(query);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 分页列表
        /// </summary>
        public async Task <BasePageOutput <ConfigReRoutes> > GetPageList(PageInput input)
        {
            var list        = new List <ConfigReRoutes>();
            var totalNumber = 0;
            var query       = await _dbContext.Queryable <ConfigReRoutes>()
                              .ToPageListAsync(input.Page, input.PageSize, totalNumber);

            list        = query.Key;
            totalNumber = query.Value;
            return(new BasePageOutput <ConfigReRoutes> {
                Page = input.Page, Rows = list, Total = totalNumber
            });
        }
Exemplo n.º 4
0
        /// <summary>
        /// 分页列表
        /// </summary>
        public async Task <BasePageOutput <ApiResource> > GetPageList(PageInput input)
        {
            var list        = new List <ApiResource>();
            var totalNumber = 0;
            var query       = await _dbContext.Queryable <ApiResource>()
                              .WhereIF(!input.Name.IsNullOrEmpty(), o => o.Name.Contains(input.Name))
                              .ToPageListAsync(input.Page, input.PageSize, totalNumber);

            list        = query.Key;
            totalNumber = query.Value;
            return(new BasePageOutput <ApiResource> {
                Page = input.Page, Rows = list, Total = totalNumber
            });
        }
Exemplo n.º 5
0
        /// <summary>
        /// 分页列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <BasePageQueryOutput <QueryUserDto> > GetPageList(QueryUsersInput input)
        {
            var list        = new List <User>();
            var totalNumber = 0;
            var query       = await _dbContext.Queryable <User>()
                              .WhereIF(input.DeptId.HasValue, o => o.DeptId == input.DeptId.Value)
                              .WhereIF(input.Account.IsNotNullAndWhiteSpace(), o => o.Account == input.Account)
                              .WhereIF(input.RealName.IsNotNullAndWhiteSpace(), o => o.RealName == input.RealName)
                              .WhereIF(input.Mobile.IsNotNullAndWhiteSpace(), o => o.Mobile == input.Mobile)
                              .WhereIF(input.Email.IsNotNullAndWhiteSpace(), o => o.Email == input.Email)
                              .WhereIF(input.Status.HasValue, o => o.Status == input.Status.Value)
                              .ToPageListAsync(input.Page, input.PageSize, totalNumber);

            list        = query.Key;
            totalNumber = query.Value;
            var result = new List <QueryUserDto>();

            if (list != null && list.Count > 0)
            {
                list.ForEach(o =>
                {
                    var parent = _dbContext.Queryable <Organize>().First(it => it.KeyId == o.DeptId);
                    result.Add(new QueryUserDto
                    {
                        DeptName    = parent?.Name,
                        KeyId       = o.KeyId,
                        Account     = o.Account,
                        CreateTime  = o.CreateTime,
                        DeptId      = o.DeptId,
                        Email       = o.Email,
                        HeadPic     = o.HeadPic,
                        Mobile      = o.Mobile,
                        NickName    = o.NickName,
                        RealName    = o.RealName,
                        Sex         = o.Sex,
                        Status      = o.Status,
                        UpLoginDate = o.UpLoginDate,
                        StatusText  = o.Status ? "启用" : "停用"
                    });
                });
            }
            return(new BasePageQueryOutput <QueryUserDto> {
                Page = input.Page, Rows = result, Total = totalNumber
            });
        }
Exemplo n.º 6
0
        /// <summary>
        /// 分页列表
        /// </summary>
        public async Task <BasePageOutput <ClientsDto> > GetPageList(PageInput input)
        {
            var list        = new List <Clients>();
            var totalNumber = 0;
            var query       = await _dbContext.Queryable <Clients>()
                              .WhereIF(!input.Name.IsNullOrEmpty(), o => o.ClientId.Contains(input.Name))
                              .ToPageListAsync(input.Page, input.PageSize, totalNumber);

            list        = query.Key;
            totalNumber = query.Value;
            var result = new List <ClientsDto>();

            if (list != null && list.Count > 0)
            {
                foreach (var o in list)
                {
                    var grantTypes = await _dbContext.Queryable <ClientGrantType>()
                                     .Where(t => t.ClientId == o.Id).Select(t => t.GrantType).ToListAsync();

                    var scopes = await _dbContext.Queryable <ClientScope>()
                                 .Where(t => t.ClientId == o.Id).Select(t => t.Scope).ToListAsync();

                    result.Add(new ClientsDto
                    {
                        ClientId          = o.ClientId,
                        ClientName        = o.ClientName,
                        Description       = o.Description,
                        Enabled           = o.Enabled,
                        AllowedGrantTypes = grantTypes,
                        AllowedScopes     = scopes,
                        Id = o.Id
                    });
                }
                ;
            }
            return(new BasePageOutput <ClientsDto> {
                Page = input.Page, Rows = result, Total = totalNumber
            });
        }
Exemplo n.º 7
0
        /// <summary>
        /// 分页列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <BasePageQueryOutput <LogDto> > GetPageList(QueryLogsInput input)
        {
            var list        = new List <LogDto>();
            var totalNumber = 0;
            var query       = await _dbContext.Queryable <Log>()
                              .WhereIF(input.Level.IsNotNullAndWhiteSpace(), o => o.Level == input.Level)
                              .Select(o => new LogDto
            {
                Id           = o.Id,
                Application  = o.Application,
                BusinessId   = o.BusinessId,
                BusinessType = o.BusinessType,
                Level        = o.Level,
                Message      = o.Message,
                TimeStamp    = o.TimeStamp
            })
                              .ToPageListAsync(input.Page, input.PageSize, totalNumber);

            list        = query.Key;
            totalNumber = query.Value;
            return(new BasePageQueryOutput <LogDto> {
                Page = input.Page, Rows = list, Total = totalNumber
            });
        }
Exemplo n.º 8
0
        /// <summary>
        /// 分页列表
        /// </summary>
        public async Task <BasePageOutput <ReRoute> > GetPageList(ReRoutePageInput input)
        {
            var list        = new List <ReRoute>();
            var totalNumber = 0;
            var query       = await _dbContext.Queryable <ReRoute>()
                              .WhereIF(!input.Name.IsNullOrEmpty(), o => o.UpstreamPathTemplate.Contains(input.Name))
                              .WhereIF(input.ItemId.HasValue, o => o.ItemId == input.ItemId.Value)
                              .ToPageListAsync(input.Page, input.PageSize, totalNumber);

            list        = query.Key;
            totalNumber = query.Value;
            return(new BasePageOutput <ReRoute> {
                Page = input.Page, Rows = list, Total = totalNumber
            });
        }