public async Task <PageResponse> Page(JObject form, bool isRecycle = false) { var req = new SqlServerPageRequest(form); var columnNum = req.GetQueryField("columnNum")?.Value.ToStr(); if (columnNum == null) { return(PageResponse.Error("无效数据")); } var column = await _columnService.GetByNum(columnNum); if (column == null) { return(PageResponse.Error("无效数据")); } var model = await _modelTableService.GetByNum(column.ModelNum); if (model == null) { return(PageResponse.Error("栏目未绑定模型")); } req.Queries.Add(new DefaultQuery(isRecycle, new DefaultQuerySql("IsDel"))); return(await Page(model.SqlTableName, req)); }
public async Task <PageResponse> Page(string tableName, IPageRequest req) { if (!req.ContainsQueryField("columnNum")) { return(PageResponse <ContentData> .Error("无效数据")); } return(await _dapper.Page(tableName, req)); }
public async Task <PageResponse> Page([FromBody] JObject form) { string columnNum = form["columnNum"].ToStr(); if (columnNum.IsEmpty()) { return(PageResponse.Error("请选择栏目")); } return(await _service.GetTreeTableData(columnNum)); }
public async Task <PageResponse> FieldPage([FromBody] JObject form) { var req = new SqlServerPageRequest(form); if (!req.ContainsQueryField("ModelNum")) { return(PageResponse.Error("请选择模型")); } return(await _modelFieldService.Page(req)); }
public async Task <PageResponse> Page([FromBody] JObject form) { var req = new SqlServerPageRequest(form, new Dictionary <string, string> { { "Sort", "DESC" } }); if (!req.ContainsQueryField("columnNum")) { return(PageResponse.Error("请选择栏目")); } return(await _service.Page(req)); }
public async Task <PageResponse <ContentData> > PageByColumn(string columnNum, IPageRequest req) { var cm = await _columnService.GetModelByNum(columnNum); if (cm.Column == null || cm.ModelTable == null) { return(PageResponse <ContentData> .Error("无效数据")); } var res = await _dapper.Page(cm.ModelTable.SqlTableName, req); return(new PageResponse <ContentData>(res.Data.Select(temp => new ContentData(temp)), res.Total)); }
public async Task <PageResponse> GetTreeTableData(string columnNum) { var columnModel = await _columnService.GetModelByNum(columnNum); if (columnModel == null) { return(PageResponse.Error("栏目未绑定模型")); } var data = await _dapper.GetByColumnNum(columnNum, columnModel?.ModelTable.SqlCategoryTableName); var columns = data as Category[] ?? data.ToArray(); return(new PageResponse(await GetTreeTableData(columns.ToList(), ""), columns.Length)); }