diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml
index 66cf7389..a308095b 100644
--- a/Myshipping.Core/Myshipping.Core.xml
+++ b/Myshipping.Core/Myshipping.Core.xml
@@ -17790,6 +17790,14 @@
默认0 获取当前用户,可不传 传租户id获取当前租户
+
+
+ 根据角色代码获取用户
+
+ 关键字
+ 角色代码
+
+
通过职位获取用户信息
diff --git a/Myshipping.Core/Service/User/SysUserService.cs b/Myshipping.Core/Service/User/SysUserService.cs
index 08222ec8..f53a3ab4 100644
--- a/Myshipping.Core/Service/User/SysUserService.cs
+++ b/Myshipping.Core/Service/User/SysUserService.cs
@@ -648,18 +648,25 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
.OrderBy(x => x.Name).ToListAsync();
}
- [HttpGet("/sysUser/DecryptPassword")]
- public async Task DecryptPassword(long id)
+ ///
+ /// 根据角色代码获取用户
+ ///
+ /// 关键字
+ /// 角色代码
+ ///
+ [HttpGet("/sysUser/GetTenantUserByRole")]
+ public async Task> GetTenantUserByRole(string keyword, string roleCode)
{
- if (UserManager.IsSuperAdmin)
- {
- var user = await _sysUserRep.AsQueryable().Filter(null, false).FirstAsync(u => u.Id == id);
- var keyDES = App.GetOptions().DES;
- var pwdDecrypt = DESCEncryption.Decrypt(user.Password, keyDES);
- return pwdDecrypt;
- }
+ var list = await _sysUserRep.AsQueryable()
+ .InnerJoin((u, ur) => u.Id == ur.SysUserId)
+ .InnerJoin((u, ur, r) => ur.SysRoleId == r.Id)
+ .WhereIF(!string.IsNullOrEmpty(keyword), (u, ur, r) => u.Name.Contains(keyword) || u.UserCode.StartsWith(keyword))
+ .Where((u, ur, r) => r.Code == roleCode && u.Status == CommonStatus.ENABLE)
+ .Select((u, ur, r) => u)
+ .OrderBy(u => u.Name)
+ .ToListAsync();
- throw Oops.Bah("没有权限");
+ return list;
}
///