|
|
|
@ -648,18 +648,25 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
|
|
|
|
|
.OrderBy(x => x.Name).ToListAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet("/sysUser/DecryptPassword")]
|
|
|
|
|
public async Task<string> DecryptPassword(long id)
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据角色代码获取用户
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="keyword">关键字</param>
|
|
|
|
|
/// <param name="roleCode">角色代码</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/sysUser/GetTenantUserByRole")]
|
|
|
|
|
public async Task<List<SysUser>> 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<EncryptKeyOptions>().DES;
|
|
|
|
|
var pwdDecrypt = DESCEncryption.Decrypt(user.Password, keyDES);
|
|
|
|
|
return pwdDecrypt;
|
|
|
|
|
}
|
|
|
|
|
var list = await _sysUserRep.AsQueryable()
|
|
|
|
|
.InnerJoin<SysUserRole>((u, ur) => u.Id == ur.SysUserId)
|
|
|
|
|
.InnerJoin<SysRole>((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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|