|
@@ -990,15 +990,19 @@ namespace GxPress.Repository.Implement
|
|
|
/// <returns></returns>
|
|
|
public async Task<IEnumerable<UserInfoResult>> GetUserInfoNoFriendsResults(string keyword, IEnumerable<int> userIds)
|
|
|
{
|
|
|
- var query = Q.NewQuery();
|
|
|
- if (!string.IsNullOrEmpty(keyword))
|
|
|
- {
|
|
|
- query.OrWhereLike(nameof(User.Name), $"%{keyword}%");
|
|
|
- query.OrWhereLike(nameof(User.Email), $"%{keyword}%");
|
|
|
- query.OrWhereLike(nameof(User.Phone), $"%{keyword}%");
|
|
|
- }
|
|
|
- query.WhereNotIn(nameof(User.Id), userIds);
|
|
|
- return await _repository.GetAllAsync<UserInfoResult>(query);
|
|
|
+ userIds = userIds.Distinct();
|
|
|
+ var sqlStr = "";
|
|
|
+ foreach (var item in userIds)
|
|
|
+ sqlStr += $"{item},";
|
|
|
+ sqlStr = sqlStr.Remove(sqlStr.Length - 1, 1);
|
|
|
+ var sql = $@"select * from tede_user where id not in({sqlStr}) and (Name like '%{keyword}%' or phone like '%{keyword}%' or Email like '%{keyword}%')";
|
|
|
+ var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
|
+ var database = new Database(databaseType, _connectionString);
|
|
|
+ var connection = database.GetConnection();
|
|
|
+ var result = await connection.QueryAsync<UserInfoResult>(sql);
|
|
|
+ foreach (var item in result)
|
|
|
+ item.AvatarUrl = StringUtils.AddDomainMin(item.AvatarUrl);
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|
|
|
}
|