From ccb6ebf6937d214fdd1a678458e186371093fc70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A2=93=E5=BD=AD?= Date: Wed, 25 Mar 2026 23:03:06 +0800 Subject: [PATCH] bug --- YD_Event.Application/User/Dtos/SysUserPageOutput.cs | 5 +++++ YD_Event.Application/User/SysUserService.cs | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/YD_Event.Application/User/Dtos/SysUserPageOutput.cs b/YD_Event.Application/User/Dtos/SysUserPageOutput.cs index b94034e..bf3e9d1 100644 --- a/YD_Event.Application/User/Dtos/SysUserPageOutput.cs +++ b/YD_Event.Application/User/Dtos/SysUserPageOutput.cs @@ -15,6 +15,11 @@ public class SysUserPageOutput : KeyDto /// public string Account { get; set; } + /// + /// 关联角色Id列表(逗号分隔) + /// + public string RoleIds { get; set; } + /// /// 关联角色名称(逗号分隔) /// diff --git a/YD_Event.Application/User/SysUserService.cs b/YD_Event.Application/User/SysUserService.cs index 1e9538e..7e36154 100644 --- a/YD_Event.Application/User/SysUserService.cs +++ b/YD_Event.Application/User/SysUserService.cs @@ -71,7 +71,7 @@ public class SysUserService : BaseService, ITransient var userRoles = await _userRoleRepository.AsQueryable() .InnerJoin((ur, r) => ur.RoleId == r.Id) .Where((ur, r) => userIds.Contains(ur.UserId)) - .Select((ur, r) => new { ur.UserId, RoleName = r.Name }) + .Select((ur, r) => new { ur.UserId,r.Id, RoleName = r.Name }) .ToListAsync(); foreach (var user in entityList.Rows) @@ -79,6 +79,8 @@ public class SysUserService : BaseService, ITransient var output = user.Adapt(); var roles = userRoles.Where(x => x.UserId == user.Id).Select(x => x.RoleName).ToList(); output.RoleNames = string.Join(",", roles); + var roleIds = userRoles.Where(x => x.UserId == user.Id).Select(x => x.Id).ToList(); + output.RoleIds = string.Join(",", roleIds); resultList.Add(output); }