Exemplo n.º 1
0
        /// <summary>
        /// 获取多语言分页
        /// </summary>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <param name="name"></param>
        /// <param name="tenancyId">租户id</param>
        /// <returns></returns>
        public async Task <ResultPagedList <Translate> > GetList(int pageNo, int pageSize, string name, long?tenancyId = null)
        {
            if (!string.IsNullOrEmpty(name) && tenancyId != null)
            {
                var(list, total) = await _translateRepositories.GetEntitiesForPaging(pageNo, pageSize, f => f.Name.Equals(name) && f.TenancyId == tenancyId);

                return(ResultPagedList <Translate> .ReSuccess(list, total));
            }
            if (tenancyId != null)
            {
                var(list, total) = await _translateRepositories.GetEntitiesForPaging(pageNo, pageSize, f => f.TenancyId == tenancyId);

                return(ResultPagedList <Translate> .ReSuccess(list, total));
            }
            if (!string.IsNullOrEmpty(name))
            {
                var(list, total) = await _translateRepositories.GetEntitiesForPaging(pageNo, pageSize, f => f.Name.Equals(name));

                return(ResultPagedList <Translate> .ReSuccess(list, total));
            }

            var(data, totalCount) = await _translateRepositories.GetEntitiesForPaging(pageNo, pageSize, f => f.Id != 0);

            return(ResultPagedList <Translate> .ReSuccess(data, totalCount));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取租户列表
        /// </summary>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <param name="name"></param>
        /// <param name="status">租户状态</param>
        /// <returns></returns>
        public async Task <ResultPagedList <Tenancy> > GetList(int pageNo, int pageSize, string name = "", uint?status = null)
        {
            if (!string.IsNullOrEmpty(name) && status != null)
            {
                var(list, total) = await _repository.GetEntitiesForPaging(pageNo, pageSize, f => f.Name.Equals(name) && f.Status == status && (Status)f.IsDeleted == Status.No);

                return(ResultPagedList <Tenancy> .ReSuccess(list, total));
            }

            if (!string.IsNullOrEmpty(name))
            {
                var(list, total) = await _repository.GetEntitiesForPaging(pageNo, pageSize, f => f.Name.Equals(name) && (Status)f.IsDeleted == Status.No);

                return(ResultPagedList <Tenancy> .ReSuccess(list, total));
            }

            if (status != null)
            {
                var(list, total) = await _repository.GetEntitiesForPaging(pageNo, pageSize, f => f.Status == status && (Status)f.IsDeleted == Status.No);

                return(ResultPagedList <Tenancy> .ReSuccess(list, total));
            }

            var(data, totalCount) = await _repository.GetEntitiesForPaging(pageNo, pageSize, f => f.Id != 0 && (Status)f.IsDeleted == Status.No);

            return(ResultPagedList <Tenancy> .ReSuccess(data, totalCount));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取日志分页列表
        /// </summary>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <param name="type"></param>
        /// <param name="accountName"></param>
        /// <returns></returns>
        public async Task <ResultPagedList <LogInfo> > GetList(int pageNo, int pageSize, uint?type = null,
                                                               string accountName = "")
        {
            if (type != null && !string.IsNullOrEmpty(accountName))
            {
                var(list, total) = await _loggingsRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                                  f => f.Type == type && f.AccountName.Equals(accountName));

                return(ResultPagedList <LogInfo> .ReSuccess(list, total));
            }

            if (type != null)
            {
                var(list, total) = await _loggingsRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                                  f => f.Type == type);

                return(ResultPagedList <LogInfo> .ReSuccess(list, total));
            }

            if (!string.IsNullOrEmpty(accountName))
            {
                var(list, total) = await _loggingsRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                                  f => f.AccountName.Equals(accountName));

                return(ResultPagedList <LogInfo> .ReSuccess(list, total));
            }

            var(data, totalCount) = await _loggingsRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                                   f => f.Id != 0);

            return(ResultPagedList <LogInfo> .ReSuccess(data, totalCount));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取字典分页列表
        /// </summary>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <param name="key"></param>
        /// <param name="tenancyId"></param>
        /// <returns></returns>
        public async Task <ResultPagedList <AsfDictionary> > GetList(int pageNo, int pageSize, string key,
                                                                     long?tenancyId = null)
        {
            if (!string.IsNullOrEmpty(key) && tenancyId != null)
            {
                var(list, total) = await _asfDictionaryRepository.GetEntitiesForPaging(pageNo, pageSize, f => f.Key.Equals(key) && f.TenancyId == tenancyId);

                return(ResultPagedList <AsfDictionary> .ReSuccess(list, total));
            }
            if (tenancyId != null)
            {
                var(list, total) = await _asfDictionaryRepository.GetEntitiesForPaging(pageNo, pageSize, f => f.TenancyId == tenancyId);

                return(ResultPagedList <AsfDictionary> .ReSuccess(list, total));
            }
            if (!string.IsNullOrEmpty(key))
            {
                var(list, total) = await _asfDictionaryRepository.GetEntitiesForPaging(pageNo, pageSize, f => f.Key.Equals(key));

                return(ResultPagedList <AsfDictionary> .ReSuccess(list, total));
            }

            var(data, totalCount) = await _asfDictionaryRepository.GetEntitiesForPaging(pageNo, pageSize, f => f.Id != 0);

            return(ResultPagedList <AsfDictionary> .ReSuccess(data, totalCount));
        }
Exemplo n.º 5
0
        public async Task <ResultPagedList <AudioResponseDto> > GetLogList([FromBody] AudioListRequestDto dto)
        {
            var data = await _serviceProvider.GetRequiredService <LoggerService>().GetList(dto.PageNo, dto.PageSize, (uint)LoggingType.Operate, dto.AccountName);

            if (!data.Success)
            {
                return(ResultPagedList <AudioResponseDto> .ReFailure(data.Message, data.Status));
            }
            return(ResultPagedList <AudioResponseDto> .ReSuccess(_mapper.Map <List <AudioResponseDto> >(data.Data),
                                                                 data.TotalCount));
        }
Exemplo n.º 6
0
        public async Task <ResultPagedList <RoleResponseDto> > GetList([FromQuery] RoleListRequestDto dto)
        {
            long?tenancyId = HttpContext.User.IsSuperRole() ? null : Convert.ToInt64(HttpContext.User.TenancyId());
            var  data      = await _serviceProvider.GetRequiredService <RoleService>().GetList(dto.PageNo, dto.PageSize, dto.Name, dto.Enable, tenancyId);

            if (!data.Success)
            {
                return(ResultPagedList <RoleResponseDto> .ReFailure(data.Message, data.Status));
            }
            return(ResultPagedList <RoleResponseDto> .ReSuccess(_mapper.Map <List <RoleResponseDto> >(data.Data),
                                                                data.TotalCount));
        }
Exemplo n.º 7
0
        public async Task <ResultPagedList <ConcatResponseDto> > GetList(
            [FromQuery] PaginationRequestDto dto)
        {
            var data = await _serviceProvider.GetRequiredService <EditorService>().GetConcatList(dto.PageNo, dto.PageSize);

            if (!data.Success)
            {
                return(ResultPagedList <ConcatResponseDto> .ReFailure(data.Message, data.Status));
            }
            return(ResultPagedList <ConcatResponseDto> .ReSuccess(_mapper.Map <List <ConcatResponseDto> >(data.Data),
                                                                  data.TotalCount));
        }
Exemplo n.º 8
0
        /// <summary>
        /// 获取岗位分页
        /// </summary>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <param name="name"></param>
        /// <param name="enable"></param>
        /// <param name="tenancyId"></param>
        /// <returns></returns>
        public async Task <ResultPagedList <Post> > GetList(int pageNo, int pageSize, string name, long?enable = null, long?tenancyId = null)
        {
            if (!string.IsNullOrEmpty(name) && enable != null && tenancyId != null)
            {
                var(list, total) = await _postRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                              f => f.Name.Equals(name) && f.Enabled == enable && f.TenancyId == tenancyId);

                return(ResultPagedList <Post> .ReSuccess(list, total));
            }
            if (!string.IsNullOrEmpty(name) && tenancyId != null)
            {
                var(list, total) = await _postRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                              f => f.Name.Equals(name) && f.TenancyId == tenancyId);

                return(ResultPagedList <Post> .ReSuccess(list, total));
            }
            if (enable != null && tenancyId != null)
            {
                var(list, total) = await _postRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                              f => f.Enabled == enable && f.TenancyId == tenancyId);

                return(ResultPagedList <Post> .ReSuccess(list, total));
            }
            if (tenancyId != null)
            {
                var(list, total) = await _postRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                              f => f.TenancyId == tenancyId);

                return(ResultPagedList <Post> .ReSuccess(list, total));
            }
            if (!string.IsNullOrEmpty(name))
            {
                var(list, total) = await _postRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                              f => f.Name.Equals(name));

                return(ResultPagedList <Post> .ReSuccess(list, total));
            }
            if (enable != null)
            {
                var(list, total) = await _postRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                              f => f.Enabled == enable);

                return(ResultPagedList <Post> .ReSuccess(list, total));
            }

            var(data, totalCount) = await _postRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                               f => f.Id != 0);

            return(ResultPagedList <Post> .ReSuccess(data, totalCount));
        }
Exemplo n.º 9
0
        /// <summary>
        /// 获取权限菜单分页列表
        /// </summary>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <param name="permissionId"></param>
        /// <param name="title"></param>
        /// <param name="menuUrl"></param>
        /// <returns></returns>
        public async Task <ResultPagedList <PermissionMenu> > GetList(int pageNo, int pageSize, long?permissionId = null,
                                                                      string title = "", string menuUrl = "")
        {
            // 查找对应权限菜单标题
            if (permissionId != null && !string.IsNullOrEmpty(title))
            {
                var(list, total) = await _menuRepositories.GetEntitiesForPaging(pageNo, pageSize,
                                                                                f => f.PermissionId == permissionId && f.Title.Equals(title));

                return(ResultPagedList <PermissionMenu> .ReSuccess(list, total));
            }
            // 查找对应权限菜单地址
            if (permissionId != null && !string.IsNullOrEmpty(menuUrl))
            {
                var(list, total) = await _menuRepositories.GetEntitiesForPaging(pageNo, pageSize,
                                                                                f => f.PermissionId == permissionId && f.MenuUrl.Equals(menuUrl));

                return(ResultPagedList <PermissionMenu> .ReSuccess(list, total));
            }
            // 查找对应权限
            if (permissionId != null)
            {
                var(list, total) = await _menuRepositories.GetEntitiesForPaging(pageNo, pageSize,
                                                                                f => f.PermissionId == permissionId);

                return(ResultPagedList <PermissionMenu> .ReSuccess(list, total));
            }
            // 查找权限菜单标题
            if (!string.IsNullOrEmpty(title))
            {
                var(list, total) = await _menuRepositories.GetEntitiesForPaging(pageNo, pageSize,
                                                                                f => f.Title.Equals(title));

                return(ResultPagedList <PermissionMenu> .ReSuccess(list, total));
            }
            // 查找权限菜单地址
            if (!string.IsNullOrEmpty(menuUrl))
            {
                var(list, total) = await _menuRepositories.GetEntitiesForPaging(pageNo, pageSize,
                                                                                f => f.MenuUrl.Equals(menuUrl));

                return(ResultPagedList <PermissionMenu> .ReSuccess(list, total));
            }

            var(data, totalCount) = await _menuRepositories.GetEntitiesForPaging(pageNo, pageSize,
                                                                                 f => f.Id != 0);

            return(ResultPagedList <PermissionMenu> .ReSuccess(data, totalCount));
        }
Exemplo n.º 10
0
        public async Task <ResultPagedList <PermissionApiResponseDto> > GetList([FromQuery] PermissionApiListRequestDto dto)
        {
            if (!HttpContext.User.IsSuperRole())
            {
                return(ResultPagedList <PermissionApiResponseDto> .ReFailure(ResultCodes.RoleNotSuperFailed));
            }
            var data = await _serviceProvider.GetRequiredService <ApiService>().GetList(dto.PageNo, dto.PageSize, dto.PermissionId,
                                                                                        dto.Type, dto.Status, dto.Name, dto.HttpMethod, dto.Path);

            if (!data.Success)
            {
                return(ResultPagedList <PermissionApiResponseDto> .ReFailure(data.Message, data.Status));
            }
            return(ResultPagedList <PermissionApiResponseDto> .ReSuccess(_mapper.Map <List <PermissionApiResponseDto> >(data.Data), data.TotalCount));
        }
Exemplo n.º 11
0
        public async Task <ResultPagedList <LoggerInfoDetailsResponseDto> > GetList([FromBody] LoggerListPagedRequestDto dto)
        {
            //验证请求数据合法性
            var result = dto.Valid();

            if (!result.Success)
            {
                return(ResultPagedList <LoggerInfoDetailsResponseDto> .ReFailure(result));
            }

            var logList = await _loggingRepository.GetList(dto);

            var logings = Mapper.Map <IList <LoggerInfoDetailsResponseDto> >(logList.Loggings);

            return(ResultPagedList <LoggerInfoDetailsResponseDto> .ReSuccess(logings, logList.TotalCount));
        }
Exemplo n.º 12
0
        public async Task <ResultPagedList <PermissionMenuResponseDto> > GetList(
            [FromQuery] PermissionMenuListRequestDto dto)
        {
            if (!HttpContext.User.IsSuperRole())
            {
                return(ResultPagedList <PermissionMenuResponseDto> .ReFailure(ResultCodes.RoleNotSuperFailed));
            }
            var result = await _serviceProvider.GetRequiredService <MenuService>()
                         .GetList(dto.PageNo, dto.PageSize, dto.PermissionId, dto.Title, dto.MenuUrl);

            if (!result.Success)
            {
                return(ResultPagedList <PermissionMenuResponseDto> .ReFailure(result.Message, result.Status));
            }
            return(ResultPagedList <PermissionMenuResponseDto> .ReSuccess(_mapper.Map <List <PermissionMenuResponseDto> >(result.Data), result.TotalCount));
        }
Exemplo n.º 13
0
        public virtual async Task <ResultPagedList <jobdto> > GetJobItems(JobListPagedRequestDto listPagedRequestDto)
        {
            var joblist    = new List <jobdto>();
            var totalcount = 0;

            using (var connection = JobStorage.Current.GetConnection())
            {
                var RecurringJob = StorageConnectionExtensions.GetRecurringJobs(connection);
                if (RecurringJob != null)
                {
                    RecurringJob.ForEach(job =>
                    {
                        var jobitem            = JsonConvert.DeserializeObject <RecurringJobItem>(job.Job.Args.FirstOrDefault().ToString());
                        var jobmodel           = new jobdto();
                        jobmodel.BasicPassword = jobitem.BasicPassword;
                        jobmodel.BasicUserName = jobitem.BasicUserName;
                        jobmodel.ContentType   = jobitem.ContentType;
                        jobmodel.Corn          = jobitem.Corn;
                        jobmodel.CreatedAt     = job.CreatedAt;
                        jobmodel.Data          = jobitem.Data;
                        jobmodel.IsRetry       = jobitem.IsRetry;
                        jobmodel.JobName       = jobitem.JobName;
                        jobmodel.LastExecution = job.LastExecution;
                        jobmodel.LastJobState  = job.LastJobState;
                        jobmodel.NextExecution = job.NextExecution;
                        jobmodel.QueueName     = jobitem.QueueName;
                        jobmodel.Removed       = job.Removed;
                        jobmodel.Timeout       = jobitem.Timeout;
                        jobmodel.LastJobId     = job.LastJobId;
                        jobmodel.Method        = jobitem.Method;
                        jobmodel.Url           = jobitem.Url;
                        joblist.Add(jobmodel);
                    });
                    totalcount = joblist.Count();
                    if (!string.IsNullOrEmpty(listPagedRequestDto.Vague))
                    {
                        joblist    = joblist.Where(p => p.JobName.Contains(listPagedRequestDto.Vague) || p.QueueName.Contains(listPagedRequestDto.Vague) || (p.Method == listPagedRequestDto.Vague)).ToList();
                        totalcount = joblist.Count();
                    }
                    var jobreslut = joblist.OrderByDescending(p => p.QueueName);
                    joblist = jobreslut.Skip((listPagedRequestDto.SkipPage - 1) * listPagedRequestDto.PagedCount).Take(listPagedRequestDto.PagedCount).ToList();
                    return(ResultPagedList <jobdto> .ReSuccess(joblist, totalcount));
                }
            }
            return(new ResultPagedList <jobdto>());
        }
Exemplo n.º 14
0
        public async Task <ResultPagedList <RoleInfoBaseResponseDto> > GetList([FromBody] RoleListPagedRequestDto dto)
        {
            //验证请求数据合法性
            var result = dto.Valid();

            if (!result.Success)
            {
                return(ResultPagedList <RoleInfoBaseResponseDto> .ReFailure(result));
            }

            //获取角色
            var roelResult = await this._roleRepository.GetList(dto);

            var roles = Mapper.Map <IList <RoleInfoBaseResponseDto> >(roelResult.Roles);

            return(ResultPagedList <RoleInfoBaseResponseDto> .ReSuccess(roles, roelResult.TotalCount));
        }
Exemplo n.º 15
0
        /// <summary>
        /// 获取权限分页列表
        /// </summary>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <param name="code"></param>
        /// <param name="name"></param>
        /// <param name="type"></param>
        /// <param name="isSys"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public async Task <ResultPagedList <Permission> > GetList(int pageNo, int pageSize, string code = "", string name = "", uint?type = null, uint?isSys = null, uint?status = null)
        {
            if (!string.IsNullOrEmpty(code))
            {
                var(list, total) =
                    await _permissionsRepository.GetEntitiesForPaging(pageNo, pageSize, f => f.Code.Equals(code));

                return(ResultPagedList <Permission> .ReSuccess(list, total));
            }

            if (!string.IsNullOrEmpty(name))
            {
                var(list, total) =
                    await _permissionsRepository.GetEntitiesForPaging(pageNo, pageSize, f => f.Name.Equals(code));

                return(ResultPagedList <Permission> .ReSuccess(list, total));
            }

            if (type != null)
            {
                var(list, total) =
                    await _permissionsRepository.GetEntitiesForPaging(pageNo, pageSize, f => f.Type == type);

                return(ResultPagedList <Permission> .ReSuccess(list, total));
            }

            if (isSys != null)
            {
                var(list, total) =
                    await _permissionsRepository.GetEntitiesForPaging(pageNo, pageSize, f => f.IsSystem == isSys);

                return(ResultPagedList <Permission> .ReSuccess(list, total));
            }
            if (status != null)
            {
                var(list, total) =
                    await _permissionsRepository.GetEntitiesForPaging(pageNo, pageSize, f => f.Enable == status);

                return(ResultPagedList <Permission> .ReSuccess(list, total));
            }

            var(data, totalCount) =
                await _permissionsRepository.GetEntitiesForPaging(pageNo, pageSize, f => f.Id != 0);

            return(ResultPagedList <Permission> .ReSuccess(data, totalCount));
        }
Exemplo n.º 16
0
        public async Task <ResultPagedList <PermissionResponseDto> > GetList(
            [FromQuery] PermissionListRequestDto dto)
        {
            if (!HttpContext.User.IsSuperRole())
            {
                return(ResultPagedList <PermissionResponseDto> .ReFailure(ResultCodes.RoleNotSuperFailed));
            }
            var result = await _serviceProvider.GetRequiredService <PermissionService>().GetList(dto.PageNo, dto.PageSize, dto.Code,
                                                                                                 dto.Name, dto.Type, dto.IsSys, dto.Status);

            if (!result.Success)
            {
                return(ResultPagedList <PermissionResponseDto> .ReFailure(result.Message, result.Status));
            }
            IEnumerable <PermissionResponseDto> list = _mapper.Map <IEnumerable <PermissionResponseDto> >(result.Data);

            return(ResultPagedList <PermissionResponseDto> .ReSuccess(TreeSortMultiLevelFormat(list).ToList(), result.TotalCount));
        }
Exemplo n.º 17
0
        public async Task <ResultPagedList <AccountInfoBaseResponseDto> > GetList([FromBody] AccountListPagedRequestDto dto)
        {
            //验证请求数据合法性
            var result = dto.Valid();

            if (!result.Success)
            {
                return(ResultPagedList <AccountInfoBaseResponseDto> .ReFailure(result));
            }

            //获取用户数据
            var accountsResult = await _accountRepository.GetList(dto);

            var accounts = accountsResult.Accounts;

            if (accounts.Count == 0)
            {
                return(ResultPagedList <AccountInfoBaseResponseDto> .ReSuccess());
            }

            //获取角色数据
            var rids = new List <int>();

            accounts
            .Select(f => f.Roles.ToList()).ToList()
            .ForEach(p =>
            {
                rids.AddRange(p);
            });
            var roles = await this._serviceProvider.GetRequiredService <IRoleRepository>().GetList(rids);

            //组装响应数据
            var accountInfos = Mapper.Map <List <AccountInfoBaseResponseDto> >(accounts);

            accountInfos.ForEach(ainfo =>
            {
                var account = accounts.FirstOrDefault(a => a.Id == ainfo.Id);
                ainfo.Roles = roles
                              .Where(r => r.IsNormal() && account.Roles.Contains(r.Id))
                              .Select(r => r.Name)
                              .ToList();
            });
            return(ResultPagedList <AccountInfoBaseResponseDto> .ReSuccess(accountInfos, accountsResult.TotalCount));
        }
Exemplo n.º 18
0
        /// <summary>
        /// 获取账户分页列表
        /// </summary>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <param name="username"></param>
        /// <param name="telPhone"></param>
        /// <param name="email"></param>
        /// <param name="sex"></param>
        /// <param name="status"></param>
        /// <param name="tenancyId"></param>
        /// <returns></returns>
        public async Task <ResultPagedList <Account> > GetList(int pageNo, int pageSize, string username, string telPhone, string email, int?sex, uint?status, long?tenancyId = null)
        {
            if (tenancyId != null)
            {
                if (!string.IsNullOrEmpty(username) || !string.IsNullOrEmpty(telPhone) || !string.IsNullOrEmpty(email) ||
                    sex != null || status != null)
                {
                    var(list, total) =
                        await _accountsRepository.GetEntitiesForPaging(pageNo, pageSize, f => f.TenancyId == tenancyId && (f.Username.Equals(username) || f.TelPhone.Equals(telPhone) || f.Email.Equals(email) || f.Sex == sex || f.Status == status));

                    return(ResultPagedList <Account> .ReSuccess(list, total));
                }
                else
                {
                    var(list, total) =
                        await _accountsRepository.GetEntitiesForPaging(pageNo, pageSize, f => f.TenancyId == tenancyId);

                    return(ResultPagedList <Account> .ReSuccess(list, total));
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(username) || !string.IsNullOrEmpty(telPhone) || !string.IsNullOrEmpty(email) ||
                    sex != null || status != null)
                {
                    var(list, total) =
                        await _accountsRepository.GetEntitiesForPaging(pageNo, pageSize, f => f.Username.Equals(username) || f.TelPhone.Equals(telPhone) || f.Email.Equals(email) || f.Sex == sex || f.Status == status);

                    return(ResultPagedList <Account> .ReSuccess(list, total));
                }
                else
                {
                    var(list, total) =
                        await _accountsRepository.GetEntitiesForPaging(pageNo, pageSize, f => f.Id != 0);

                    return(ResultPagedList <Account> .ReSuccess(list, total));
                }
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// 获取咨询列表
        /// </summary>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public async Task <ResultPagedList <Concat> > GetConcatList(int pageNo, int pageSize)
        {
            var(data, totalCount) = await _concatRepositories.GetEntitiesForPaging(pageNo, pageSize, f => f.Id != 0);

            return(ResultPagedList <Concat> .ReSuccess(data, totalCount));
        }
Exemplo n.º 20
0
        /// <summary>
        /// 获取 部门分页列表
        /// </summary>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <param name="name"></param>
        /// <param name="status"></param>
        /// <param name="tenancyId">租户id</param>
        /// <returns></returns>
        public async Task <ResultPagedList <Department> > GetList(int pageNo, int pageSize, string name = "",
                                                                  uint?status = null, long?tenancyId = null)
        {
            if (!string.IsNullOrEmpty(name) && status != null && tenancyId != null)
            {
                var(list, total) =
                    await _departmentRepositories.GetEntitiesForPaging(pageNo, pageSize,
                                                                       f => f.Name.Equals(name) && f.Enabled == status && f.TenancyId == tenancyId);

                return(ResultPagedList <Department> .ReSuccess(list, total));
            }

            if (!string.IsNullOrEmpty(name) && tenancyId != null)
            {
                var(list, total) =
                    await _departmentRepositories.GetEntitiesForPaging(pageNo, pageSize,
                                                                       f => f.Name.Equals(name) && f.TenancyId == tenancyId);

                return(ResultPagedList <Department> .ReSuccess(list, total));
            }

            if (status != null && tenancyId != null)
            {
                var(list, total) =
                    await _departmentRepositories.GetEntitiesForPaging(pageNo, pageSize,
                                                                       f => f.Enabled == status && f.TenancyId == tenancyId);

                return(ResultPagedList <Department> .ReSuccess(list, total));
            }

            if (tenancyId != null)
            {
                var(list, total) =
                    await _departmentRepositories.GetEntitiesForPaging(pageNo, pageSize,
                                                                       f => f.TenancyId == tenancyId);

                return(ResultPagedList <Department> .ReSuccess(list, total));
            }

            if (!string.IsNullOrEmpty(name))
            {
                var(list, total) =
                    await _departmentRepositories.GetEntitiesForPaging(pageNo, pageSize,
                                                                       f => f.Name.Equals(name));

                return(ResultPagedList <Department> .ReSuccess(list, total));
            }

            if (status != null)
            {
                var(list, total) =
                    await _departmentRepositories.GetEntitiesForPaging(pageNo, pageSize,
                                                                       f => f.Enabled == status);

                return(ResultPagedList <Department> .ReSuccess(list, total));
            }

            var(data, totalCount) =
                await _departmentRepositories.GetEntitiesForPaging(pageNo, pageSize,
                                                                   f => f.Id != 0);

            return(ResultPagedList <Department> .ReSuccess(data, totalCount));
        }
Exemplo n.º 21
0
        /// <summary>
        /// api 分页
        /// </summary>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <param name="permissionId"></param>
        /// <param name="type"></param>
        /// <param name="status"></param>
        /// <param name="name"></param>
        /// <param name="httpMethod"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        public async Task <ResultPagedList <Api> > GetList(int pageNo, int pageSize, long?permissionId = null,
                                                           uint?type = null, uint?status = null, string name = "", string httpMethod = "", string path = "")
        {
            // 搜索对应类型的权限api
            if (permissionId != null && type != null)
            {
                var(list, count) = await _apiRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                             f => f.PermissionId == permissionId && f.Type == type);

                return(ResultPagedList <Api> .ReSuccess(list, count));
            }
            // 搜索对应状态的权限api
            if (permissionId != null && status != null)
            {
                var(list, count) = await _apiRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                             f => f.PermissionId == permissionId && f.Status == status);

                return(ResultPagedList <Api> .ReSuccess(list, count));
            }
            // 搜索对应api名权限api
            if (permissionId != null && !string.IsNullOrEmpty(name))
            {
                var(list, count) = await _apiRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                             f => f.PermissionId == permissionId && f.Name.Equals(name));

                return(ResultPagedList <Api> .ReSuccess(list, count));
            }
            // 搜索对应请求权限api
            if (permissionId != null && !string.IsNullOrEmpty(httpMethod))
            {
                var(list, count) = await _apiRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                             f => f.PermissionId == permissionId && f.HttpMethods.Contains(name));

                return(ResultPagedList <Api> .ReSuccess(list, count));
            }
            // 搜索对应路径地址权限api
            if (permissionId != null && !string.IsNullOrEmpty(path))
            {
                var(list, count) = await _apiRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                             f => f.PermissionId == permissionId && f.Path.Equals(path));

                return(ResultPagedList <Api> .ReSuccess(list, count));
            }

            // 搜索对权限api
            if (permissionId != null)
            {
                var(list, count) = await _apiRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                             f => f.PermissionId == permissionId);

                return(ResultPagedList <Api> .ReSuccess(list, count));
            }

            // 搜索类型
            if (type != null)
            {
                var(list, count) = await _apiRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                             f => f.Type == type);

                return(ResultPagedList <Api> .ReSuccess(list, count));
            }
            // 搜索状态
            if (status != null)
            {
                var(list, count) = await _apiRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                             f => f.Status == status);

                return(ResultPagedList <Api> .ReSuccess(list, count));
            }
            // 搜索api名称
            if (!string.IsNullOrEmpty(name))
            {
                var(list, count) = await _apiRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                             f => f.Name.Equals(name));

                return(ResultPagedList <Api> .ReSuccess(list, count));
            }
            // 搜索请求方法
            if (!string.IsNullOrEmpty(httpMethod))
            {
                var(list, count) = await _apiRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                             f => f.HttpMethods.Contains(name));

                return(ResultPagedList <Api> .ReSuccess(list, count));
            }
            //搜索请求路径
            if (!string.IsNullOrEmpty(path))
            {
                var(list, count) = await _apiRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                             f => f.PermissionId == permissionId && f.Path.Equals(path));

                return(ResultPagedList <Api> .ReSuccess(list, count));
            }

            var(data, apiCount) = await _apiRepository.GetEntitiesForPaging(pageNo, pageSize,
                                                                            f => f.Id != 0);

            return(ResultPagedList <Api> .ReSuccess(data, apiCount));
        }