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

This commit is contained in:
Argo-MacBookPro 2018-11-05 17:50:51 +08:00
parent 7adfa472a1
commit 15d7e31c8f
2 changed files with 4 additions and 4 deletions

View File

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

View File

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