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