Skip to content

Commit

Permalink
#2474 Update SQL calls
Browse files Browse the repository at this point in the history
  • Loading branch information
dwalizer committed Nov 27, 2023
1 parent c174762 commit cb8374c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ interface UserPointsRepo extends CrudRepository<UserPoints, Integer> {
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)
Expand Down Expand Up @@ -661,8 +661,8 @@ interface UserPointsRepo extends CrudRepository<UserPoints, Integer> {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ interface UserRoleRepo extends CrudRepository<UserRole, Integer> {
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<UserRoleWithAttrs> findRoleWithAttrsByProjectIdAndRoleNameAndUserIdLike(String projectId, RoleName roleName, String userIdQuery, PageRequest pageRequest)

Expand All @@ -76,7 +77,8 @@ interface UserRoleRepo extends CrudRepository<UserRole, Integer> {
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)

Expand Down

0 comments on commit cb8374c

Please sign in to comment.