-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature/Inhabas#298] 동아리활동 게시글 수정시 text변경안되는 문제 해결 및 정렬 기 추가능
- Loading branch information
1 parent
440169c
commit 289548d
Showing
8 changed files
with
87 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...er/src/main/java/com/inhabas/api/domain/club/repository/ClubActivityRepositoryCustom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.inhabas.api.domain.club.repository; | ||
|
||
import java.util.List; | ||
|
||
import com.inhabas.api.domain.club.dto.ClubActivityDto; | ||
|
||
public interface ClubActivityRepositoryCustom { | ||
|
||
List<ClubActivityDto> findAllAndSearch(String search); | ||
} |
48 changes: 48 additions & 0 deletions
48
...rver/src/main/java/com/inhabas/api/domain/club/repository/ClubActivityRepositoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.inhabas.api.domain.club.repository; | ||
|
||
import static com.inhabas.api.domain.board.domain.QAlbumBoard.albumBoard; | ||
|
||
import java.util.List; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
import com.inhabas.api.domain.club.dto.ClubActivityDto; | ||
import com.querydsl.core.types.Projections; | ||
import com.querydsl.core.types.dsl.BooleanExpression; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
|
||
@RequiredArgsConstructor | ||
public class ClubActivityRepositoryImpl implements ClubActivityRepositoryCustom { | ||
|
||
private final JPAQueryFactory queryFactory; | ||
|
||
@Override | ||
public List<ClubActivityDto> findAllAndSearch(String search) { | ||
return queryFactory | ||
.select( | ||
Projections.constructor( | ||
ClubActivityDto.class, | ||
albumBoard.id, | ||
albumBoard.title.value, | ||
albumBoard.writer.id, | ||
albumBoard.writer.name.value, | ||
albumBoard.dateCreated, | ||
albumBoard.dateUpdated)) | ||
.from(albumBoard) | ||
.where(likeTitle(search).or(likeContent(search)).or(likeWriterName(search))) | ||
.orderBy(albumBoard.dateCreated.desc()) | ||
.fetch(); | ||
} | ||
|
||
private BooleanExpression likeTitle(String search) { | ||
return albumBoard.title.value.like("%" + search + "%"); | ||
} | ||
|
||
private BooleanExpression likeContent(String search) { | ||
return albumBoard.content.value.like("%" + search + "%"); | ||
} | ||
|
||
private BooleanExpression likeWriterName(String search) { | ||
return albumBoard.writer.name.value.like("%" + search + "%"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters