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

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

            if (list != null && list.Count > 0)
            {
                list.ForEach(o =>
                {
                    var parent = _dbContext.Queryable <Organize>().First(it => it.KeyId == o.ParentId);
                    result.Add(new QueryOrganizeDto
                    {
                        ParentName = parent?.Name,
                        KeyId      = o.KeyId,
                        CreateTime = o.CreateTime,
                        ParentId   = o.ParentId,
                        Name       = o.Name,
                        BizCode    = o.BizCode,
                        Sort       = o.Sort,
                        Status     = o.Status,
                        CreateId   = o.CreateId,
                        StatusText = o.Status ? "启用" : "停用"
                    });
                });
            }
            return(new BasePageQueryOutput <QueryOrganizeDto> {
                Page = input.Page, Rows = result, Total = totalNumber
            });
        }
Esempio n. 2
0
 public async Task <BasePageQueryOutput <QueryOrganizeDto> > GetPageListAsync([FromQuery] QueryOrganizesInput input)
 {
     return(await _business.GetPageList(input));
 }