optimize
wet 2 years ago
parent caae87321a
commit 52a237a71a

@ -77,7 +77,7 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
o.Pids.Contains(pid.Trim()))
.WhereIF(Enum.IsDefined(typeof(CommonStatus), input.SearchStatus), (u, e, o) => u.Status == input.SearchStatus)
.Where((u, e, o) => u.AdminType == AdminType.None)
.Select<UserOutput>("u.*,t.Name As TenantName ").ToDataFilter("u", "Id", FilterType.User).OrderByDescending(u=>u.Name).
.Select<UserOutput>("u.*,t.Name As TenantName ").ToDataFilter("u", "Id", FilterType.User).OrderByDescending(u => u.Name).
ToPagedListAsync(input.PageNo, input.PageSize);
var empInfos = await _sysEmpService.GetEmpInfo(users.Items.Select(m => long.Parse(m.Id)).ToList());
@ -104,7 +104,7 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
// 数据范围检查
CheckDataScope(input.SysEmpParam == null || string.IsNullOrEmpty(input.SysEmpParam.OrgId) ? 0 : long.Parse(input.SysEmpParam.OrgId));
var isExist = await _sysUserRep.AsQueryable().Filter(null, true).AnyAsync(u => u.Account == input.Account&&u.IsDeleted==false);
var isExist = await _sysUserRep.AsQueryable().Filter(null, true).AnyAsync(u => u.Account == input.Account && u.IsDeleted == false);
if (isExist) throw Oops.Oh(ErrorCode.D1003);
var keyDES = App.GetOptions<EncryptKeyOptions>().DES;
@ -578,14 +578,15 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
/// 获取租户下的用户
/// </summary>
/// <param name="name"></param>
/// <param name="TenantId">默认0 获取当前用户,可不传 传租户id获取当前租户</param>
/// <param name="tenantId">默认0 获取当前用户,可不传 传租户id获取当前租户</param>
/// <returns></returns>
[HttpGet("/sysUser/GetTenantUser")]
public Task<List<SysUser>> GetTenantUser(string name, long? tenantId = 0)
public async Task<List<SysUser>> GetTenantUser(string name, long? tenantId = 0)
{
return _sysUserRep.AsQueryable().Filter(null, true).WhereIF(tenantId == 0, x => x.TenantId == Convert.ToInt64(UserManager.TENANT_ID)&&x.Status== CommonStatus.ENABLE)
return await _sysUserRep.AsQueryable().Filter(null, true).WhereIF(tenantId == 0, x => x.TenantId == Convert.ToInt64(UserManager.TENANT_ID) && x.Status == CommonStatus.ENABLE)
.WhereIF(tenantId != 0, x => x.TenantId == tenantId)
.WhereIF(!string.IsNullOrWhiteSpace(name), x => x.Name.Contains(name)).ToListAsync();
.WhereIF(!string.IsNullOrWhiteSpace(name), x => x.Name.Contains(name))
.OrderBy(x => x.Name).ToListAsync();
}
[HttpGet("/sysUser/DecryptPassword")]

Loading…
Cancel
Save