public TableData LoadByRole(QueryUserListByRoleReq request) { var users = from userRole in UnitWork.Find <Relevance>(u => u.SecondId == request.roleId && u.Key == Define.USERROLE) join user in UnitWork.Find <User>(null) on userRole.FirstId equals user.Id into temp from c in temp.DefaultIfEmpty() select c; return(new TableData { count = users.Count(), data = users.Skip((request.page - 1) * request.limit).Take(request.limit) }); }
/// <summary> /// 获取指定角色包含的用户列表 /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <TableData> LoadByRole(QueryUserListByRoleReq request) { var users = from userRole in UnitWork.Find <Relevance>(u => u.SecondId == request.roleId && u.Key == Define.USERROLE) join user in UnitWork.Find <User>(null) on userRole.FirstId equals user.Id into temp from c in temp.Where(u => u.Id != null) select c; return(new TableData { count = await users.CountAsync(), data = await users.Skip((request.page - 1) *request.limit).Take(request.limit).ToListAsync() }); }
public async Task <TableData> LoadByRole([FromQuery] QueryUserListByRoleReq request) { return(await _app.LoadByRole(request)); }
public TableData LoadByRole([FromQuery] QueryUserListByRoleReq request) { return(_app.LoadByRole(request)); }