Пример #1
0
        /// <summary>
        /// 根据查询条件获取模块表分页列表
        /// </summary>
        public async Task <PagedResultDto <ModuleListDto> > GetPagedModulesAsync(GetModuleInput input)
        {
            var query = _moduleRepositoryAsNoTrack;

            //TODO:根据传入的参数添加过滤条件
            query = query.WhereIf(!input.ModuleCode.IsNullOrEmpty(), m => m.ModuleCode == input.ModuleCode)
                    .WhereIf(!input.Name.IsNullOrEmpty(), m => m.Name == input.Name)
                    .WhereIf(input.IsActive.HasValue, m => m.IsActive == input.IsActive.Value);

            var moduleCount = await query.CountAsync();

            var modules = await query
                          .OrderBy(input.Sorting)
                          .PageBy(input)
                          .ToListAsync();

            var moduleListDtos = modules.MapTo <List <ModuleListDto> >();

            return(new PagedResultDto <ModuleListDto>(
                       moduleCount,
                       moduleListDtos
                       ));
        }
Пример #2
0
        public async Task <CommandResult> SuperAdminGet([FromServices] GetModuleCommand _getModuleCommand, [FromBody] GetModuleInput getModuleInput)
        {
            var userInput = new UserInput <GetModuleInput>
            {
                UserId = User.GetUserId(),
                Data   = getModuleInput
            };

            var result = await
                         Business.InvokeAsync <GetModuleCommand, UserInput <GetModuleInput>, CommandResult <Item> >(
                _getModuleCommand, userInput);

            return(result);
        }