/// <summary> /// 判断登录名是否存在 /// </summary> /// <param name="userId">当前用户id</param> /// <param name="loginName">登录名</param> /// <returns></returns> public Task <bool> CheckLoginNameExists(int userId, string loginName) { if (userId > 0) { if (_sysUserRepository.Exists(p => p.UserId != userId && p.LoginName == loginName)) { return(Task.FromResult(true)); } } else { if (_sysUserRepository.Exists(p => p.LoginName == loginName)) { return(Task.FromResult(true)); } } return(Task.FromResult(false)); }