diff --git a/service/src/main/java/skills/storage/repos/UserPointsRepo.groovy b/service/src/main/java/skills/storage/repos/UserPointsRepo.groovy index f33de98a03..87686dc4e6 100644 --- a/service/src/main/java/skills/storage/repos/UserPointsRepo.groovy +++ b/service/src/main/java/skills/storage/repos/UserPointsRepo.groovy @@ -598,7 +598,7 @@ interface UserPointsRepo extends CrudRepository { usr.skill_id is null and usr.points >= ?3 and (lower(CONCAT(usattr.first_name, ' ', usattr.last_name, ' (', usattr.user_id_for_display, ')')) like lower(CONCAT('%', ?2, '%')) OR - (lower(CONCAT(usattr.user_id_for_display, ' (', usattr.last_name, ', ', usattr.first_name, ')')) like lower(CONCAT(\'%\', ?2, \'%\'))) OR + (lower(CONCAT(usattr.user_id_for_display, ' (', usattr.last_name, ', ', usattr.first_name, ')')) like lower(CONCAT('%', ?2, '%'))) OR lower(usattr.user_id_for_display) like lower(CONCAT('%', ?2, '%')))) AS temp''', nativeQuery = true) @@ -661,8 +661,8 @@ interface UserPointsRepo extends CrudRepository { LEFT JOIN (SELECT ut.user_id, max(ut.value) AS value FROM user_tags ut WHERE ut.key = ?2 group by ut.user_id) ut ON ut.user_id=ua.user_id WHERE up.project_id=?1 and - (lower(CONCAT(ua.first_name, ' ', ua.last_name, ' (', ua.user_id_for_display, ')')) like lower(CONCAT(\'%\', ?3, \'%\')) OR - (lower(CONCAT(ua.user_id_for_display, ' (', ua.last_name, ', ', ua.first_name, ')')) like lower(CONCAT(\'%\', ?3, \'%\'))) OR + (lower(CONCAT(ua.first_name, ' ', ua.last_name, ' (', ua.user_id_for_display, ')')) like lower(CONCAT('%', ?3, '%')) OR + (lower(CONCAT(ua.user_id_for_display, ' (', ua.last_name, ', ', ua.first_name, ')')) like lower(CONCAT('%', ?3, '%'))) OR lower(ua.user_id_for_display) like lower(CONCAT('%', ?3, '%')) ) and up.skill_id is null and diff --git a/service/src/main/java/skills/storage/repos/UserRoleRepo.groovy b/service/src/main/java/skills/storage/repos/UserRoleRepo.groovy index f9dfede1e6..a44c82f2e9 100644 --- a/service/src/main/java/skills/storage/repos/UserRoleRepo.groovy +++ b/service/src/main/java/skills/storage/repos/UserRoleRepo.groovy @@ -67,7 +67,8 @@ interface UserRoleRepo extends CrudRepository { ur.userId = ua.userId and ur.projectId = ?1 and ur.roleName = ?2 and - (lower(CONCAT(ua.userIdForDisplay, ' (', ua.lastName, ', ', ua.firstName, ')')) like lower(CONCAT(\'%\', ?3, \'%\'))) + (ur.userId like lower(CONCAT('%', ?3, '%')) or + (lower(CONCAT(ua.userIdForDisplay, ' (', ua.lastName, ', ', ua.firstName, ')')) like lower(CONCAT('%', ?3, '%')))) ''') List findRoleWithAttrsByProjectIdAndRoleNameAndUserIdLike(String projectId, RoleName roleName, String userIdQuery, PageRequest pageRequest) @@ -76,7 +77,8 @@ interface UserRoleRepo extends CrudRepository { ur.userId = ua.userId and ur.projectId = ?1 and ur.roleName = ?2 and - (lower(CONCAT(ua.userIdForDisplay, ' (', ua.lastName, ', ', ua.firstName, ')')) like lower(CONCAT(\'%\', ?3, \'%\'))) + (ur.userId like lower(CONCAT('%', ?3, '%')) or + (lower(CONCAT(ua.userIdForDisplay, ' (', ua.lastName, ', ', ua.firstName, ')')) like lower(CONCAT('%', ?3, '%')))) ''') Integer countRoleWithAttrsByProjectIdAndRoleNameAndUserIdLike(String projectId, RoleName roleName, String userIdQuery)