/// <summary> /// 得到查询条件的所有数据 /// </summary> /// <param name="req">DTO查询对象</param> /// <returns></returns> public async Task <IResponseEntity> GetAllAsync(DictionaryEntryFilterRequest req) { var key = req?.Key; var headerId = req?.DictionaryHeaderId; var headerCode = req?.DictionaryHeaderCode; var withDisable = req != null ? req.WithDisable : false; var list = await _dictionaryEntryRepository.Select .WhereIf(headerId.IsNotNull(), a => a.DictionaryHeaderId == headerId) .WhereIf(headerCode.IsNotNull(), a => a.Dictionary.Code == headerCode) .WhereIf(key.IsNotNull(), a => (a.Title.Contains(key) || a.Code.Contains(key) || a.Description.Contains(key))) .WhereIf(!withDisable, a => a.IsDisabled == false) .OrderBy(true, a => a.OrderIndex) .ToListAsync(); var result = _mapper.Map <List <DictionaryEntryForListResponse> >(list); return(ResponseEntity.Ok(result)); }
public async Task <IResponseEntity> GetAll(DictionaryEntryFilterRequest req) { return(await _dictionaryDetailService.GetAllAsync(req)); }