mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-04-23 22:52:51 +08:00
parent
cec96390a5
commit
71bfdaafa8
@ -232,17 +232,20 @@ public sealed class UserService(
|
||||
{
|
||||
req.ThrowIfInvalid();
|
||||
var listUserExp = req.GetToListExp<Sys_User>() ?? _listUserExp;
|
||||
var select = await QueryInternalAsync(req, listUserExp == _listUserExp).ConfigureAwait(false);
|
||||
var list = await select.Page(req.Page, req.PageSize)
|
||||
var includeRoles = listUserExp == _listUserExp;
|
||||
var select = await QueryInternalAsync(req, includeRoles).ConfigureAwait(false);
|
||||
IEnumerable<Sys_User> list = await select.Page(req.Page, req.PageSize)
|
||||
#if DBTYPE_SQLSERVER
|
||||
.WithLock(SqlServerLock.NoLock | SqlServerLock.NoWait)
|
||||
#endif
|
||||
.Count(out var total)
|
||||
.ToListAsync(listUserExp)
|
||||
.ConfigureAwait(false);
|
||||
return new PagedQueryRsp<QueryUserRsp>(req.Page, req.PageSize, total
|
||||
, list.Select(x => x with { Roles = x.Roles.OrderBy(y => y.Sort).ThenBy(y => y.Id).ToList() })
|
||||
.Adapt<IEnumerable<QueryUserRsp>>());
|
||||
if (includeRoles) {
|
||||
list = list.Select(x => x with { Roles = x.Roles.OrderBy(y => y.Sort).ThenBy(y => y.Id).ToList() });
|
||||
}
|
||||
|
||||
return new PagedQueryRsp<QueryUserRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QueryUserRsp>>());
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
Loading…
x
Reference in New Issue
Block a user