/// <summary> /// 根据分类 获取数据类型 /// </summary> /// <returns></returns> public async Task <PagedListResult <DataTypeOutput> > GetDataTypesByClass(DataTypeSearchInput input) { var tempList = _dataTypeRepository.Table .AsNoTracking() .WhereIf(input.ClassId.HasValue, c => c.DataTypeClassification.Id == input.ClassId.Value) .WhereIf(!string.IsNullOrEmpty(input.DataTypeName), c => c.Name.Contains(input.DataTypeName)) .OrderByDescending(c => c.CreateDateTime); var list = await tempList.Select(c => new DataTypeOutput() { Id = c.Id, Name = c.Name, Value = c.Value, Remark = c.Remark, CreateDateTime = c.CreateDateTime.ToString("yyyy-MM-dd HH:mm") }) .PageBy(input.PageIndex, input.PageSize) .ToListAsync(); int count = tempList.Count(); return(new PagedListResult <DataTypeOutput>() { Data = list, Count = count, Code = 0 }); }
/// <summary> /// 获取分页数据类型信息 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <IActionResult> GetPagedDataTypes(DataTypeSearchInput input) { var result = await _dataTypeService.GetDataTypesByClass(input); return(Json(result)); }