-
Notifications
You must be signed in to change notification settings - Fork 2
Refactor: 팔로워 목록 로직 수정, query 없는 경우 추가 #183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -39,15 +39,32 @@ Slice<User> searchAccountInAll(@Param("query") String query, | |||||||||||||
| JOIN UserFollow uf ON u.id = uf.targetUser.id | ||||||||||||||
| WHERE uf.user.id = :loginUserId | ||||||||||||||
| AND (:cursor IS NULL OR u.id > :cursor) | ||||||||||||||
| AND (LOWER(u.nameId) LIKE LOWER(CONCAT(:query, '%')) | ||||||||||||||
| OR LOWER(u.nickname) LIKE LOWER(CONCAT(:query, '%'))) | ||||||||||||||
| AND (:query IS NULL OR | ||||||||||||||
| LOWER(u.nameId) LIKE LOWER(CONCAT(:query, '%')) | ||||||||||||||
| OR LOWER(u.nickname) LIKE LOWER(CONCAT(:query, '%'))) | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JPQL 쿼리에서
Suggested change
|
||||||||||||||
| ORDER BY u.id ASC | ||||||||||||||
| """) | ||||||||||||||
| Slice<User> searchAccountInFollow(@Param("query") String query, | ||||||||||||||
| @Param("cursor") Long cursor, | ||||||||||||||
| Pageable pageable, | ||||||||||||||
| @Param("loginUserId") Long userId); | ||||||||||||||
|
|
||||||||||||||
| @Query(""" | ||||||||||||||
| SELECT u | ||||||||||||||
| FROM User u | ||||||||||||||
| JOIN UserFollow uf ON u.id = uf.user.id | ||||||||||||||
| WHERE uf.targetUser.id = :loginUserId | ||||||||||||||
| AND (:cursor IS NULL OR u.id > :cursor) | ||||||||||||||
| AND (:query IS NULL OR | ||||||||||||||
| LOWER(u.nameId) LIKE LOWER(CONCAT(:query, '%')) | ||||||||||||||
| OR LOWER(u.nickname) LIKE LOWER(CONCAT(:query, '%'))) | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
| ORDER BY u.id ASC | ||||||||||||||
| """) | ||||||||||||||
| Slice<User> searchAccountInFollower(@Param("query") String query, | ||||||||||||||
| @Param("cursor") Long cursor, | ||||||||||||||
| Pageable pageable, | ||||||||||||||
| @Param("loginUserId") Long userId); | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| // @Query(""" | ||||||||||||||
| // SELECT u FROM User u | ||||||||||||||
|
|
@@ -74,19 +91,5 @@ Slice<User> searchAccountInFollow(@Param("query") String query, | |||||||||||||
| // @Param("loginUserId") Long userId); | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| @Query(""" | ||||||||||||||
| SELECT u | ||||||||||||||
| FROM User u | ||||||||||||||
| WHERE u.id NOT IN ( | ||||||||||||||
| SELECT uf.targetUser.id | ||||||||||||||
| FROM UserFollow uf | ||||||||||||||
| WHERE uf.user.id = :loginUserId | ||||||||||||||
| ) | ||||||||||||||
| AND (:cursor IS NULL OR u.id > :cursor) | ||||||||||||||
| AND u.nickname LIKE %:query% | ||||||||||||||
| ORDER BY u.id ASC | ||||||||||||||
| """) | ||||||||||||||
| Slice<User> searchAccountNotInFollow(@Param("query") String query, | ||||||||||||||
| @Param("cursor") Long cursor, Pageable pageable, @Param("loginUserId") Long userId); | ||||||||||||||
|
|
||||||||||||||
| } | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이
if(query == null)블록은 비어 있어 아무런 동작도 하지 않습니다. 불필요한 코드이므로 제거하는 것이 좋습니다.