diff --git a/dao/src/main/java/greencity/repository/UserRepo.java b/dao/src/main/java/greencity/repository/UserRepo.java index f5bd2a43f8..1ccf6653b8 100644 --- a/dao/src/main/java/greencity/repository/UserRepo.java +++ b/dao/src/main/java/greencity/repository/UserRepo.java @@ -284,7 +284,8 @@ public interface UserRepo extends JpaRepository, JpaSpecificationExe + " SELECT user_id AS id FROM users_friends WHERE friend_id = :userId AND status = 'FRIEND' " + " UNION " + " SELECT friend_id AS id FROM users_friends WHERE user_id = :userId AND status = 'FRIEND' " - + ") AND LOWER(u.name) LIKE LOWER(CONCAT('%', :filteringName, '%')) ") + + ") AND LOWER(u.name) LIKE LOWER(CONCAT('%', REPLACE(REPLACE(REPLACE(REPLACE(:filteringName, '&', '\\&'), " + + "'%', '\\%'), '_', '\\_'), '#', '\\#'), '%')) ") Page getAllUsersExceptMainUserAndFriends(Long userId, String filteringName, Pageable pageable); /** @@ -316,4 +317,4 @@ public interface UserRepo extends JpaRepository, JpaSpecificationExe + " SELECT friend_id AS id FROM users_friends WHERE user_id = :userId AND status = 'FRIEND' " + ") AND LOWER(u.name) LIKE LOWER(CONCAT('%', :filteringName, '%'))") Page findAllFriendsOfUser(Long userId, String filteringName, Pageable pageable); -} \ No newline at end of file +}