public Task <BasePagedListModel <Content2StatusNameEntity> > GetListAsync(ContentSearchParam param) { if (param == null) { throw new ArgumentNullException(nameof(param)); } return(contentRepository.GetListAsync(param)); }
public async Task <IActionResult> GetGridJson(ContentSearchParam param) { BasePagedListModel <Content2StatusNameEntity> pageDataModel = await contentService.GetListAsync(param); var data = new { total = pageDataModel.Total, rows = pageDataModel.Data }; return(Json(data)); }
public async Task <BasePagedListModel <Content2StatusNameEntity> > GetListAsync(ContentSearchParam param) { BasePagedListModel <Content2StatusNameEntity> list = new BasePagedListModel <Content2StatusNameEntity>(); try { #region 条件与排序 StringBuilder condition = new StringBuilder("1=1"); condition.AppendFormat(" AND CAT_ID={0}", param.CId); if (param.Steps > -1) { condition.AppendFormat(" AND C_STATUS={0}", param.Steps); } if (param.Title.IsNotNullOrEmpty()) { condition.AppendFormat(" AND C_TITLE like '%{0}%'", param.Title.FilterSql()); } if (param.SubTitle.IsNotNullOrEmpty()) { condition.AppendFormat(" AND C_SUBTITLE like '%{0}%'", param.SubTitle.FilterSql()); } if (param.Summary.IsNotNullOrEmpty()) { condition.AppendFormat(" AND C_SUMMARY like '%{0}%'", param.Summary.FilterSql()); } #endregion PageCriteriaModel criteria = new PageCriteriaModel(); criteria.Condition = condition.ToString(); criteria.PageIndex = param.PageIndex; criteria.Fields = "*"; criteria.PageSize = param.PageSize; criteria.TableName = "vw_C_CONTENT"; criteria.PrimaryKey = "C_ID"; if (param.SortName.IsNotNullOrEmpty() && param.SortOrder.IsNotNullOrEmpty()) { criteria.Sort = $"{param.SortName.FilterSql()} {param.SortOrder.FilterSql()}"; } list = await pageListRepository.GetPageDataAsync <Content2StatusNameEntity>(connectionProvider, criteria); } catch (ArgumentNullException ex) { logger.LogError("调用方法GetListAsync(ContentSearchParam param)发生ArgumentNullException,异常信息:{0}", ex); } catch (SqlException ex) { logger.LogError("调用方法GetListAsync(ContentSearchParam param)发生SqlException,异常信息:{0}", ex); } catch (Exception ex) { logger.LogError("调用方法GetListAsync(ContentSearchParam param)发生Exception,异常信息:{0}", ex); } return(list); }