重构代码:部门管理页面数据返回值移除check列减少传输量

This commit is contained in:
Argo-MacBookPro 2018-11-05 17:53:01 +08:00
parent 15d7e31c8f
commit b81c9252cb
2 changed files with 4 additions and 4 deletions

View File

@ -19,7 +19,7 @@ namespace Bootstrap.Admin.Controllers.Api
/// <param name="value"></param>
/// <returns></returns>
[HttpGet]
public QueryData<Group> Get(QueryGroupOption value)
public QueryData<object> Get(QueryGroupOption value)
{
return value.RetrieveData();
}

View File

@ -21,7 +21,7 @@ namespace Bootstrap.Admin.Query
///
/// </summary>
/// <returns></returns>
public QueryData<Group> RetrieveData()
public QueryData<object> RetrieveData()
{
// int limit, int offset, string name, string price, string sort, string order
var data = GroupHelper.RetrieveGroups();
@ -33,10 +33,10 @@ namespace Bootstrap.Admin.Query
{
data = data.Where(t => t.Description.Contains(Description));
}
var ret = new QueryData<Group>();
var ret = new QueryData<object>();
ret.total = data.Count();
data = Order == "asc" ? data.OrderBy(t => t.GroupName) : data.OrderByDescending(t => t.GroupName);
ret.rows = data.Skip(Offset).Take(Limit);
ret.rows = data.Skip(Offset).Take(Limit).Select(g => new { g.Id, g.GroupName, g.Description });
return ret;
}
}