-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix : 윈도우에서 makeGitHooksExecutable 에러 fix * build(queryDSL): queryDSL 의존성 추가 * feat: queryDSl configuration 추가 * feat: QueryDSL 샘플 코드 추가 * docs: swagger 수정 * docs: editorconfig 설정에서 indent 4space로 조정 --------- Co-authored-by: wjdwnsdnjs13 <67488973+wjdwnsdnjs13@users.noreply.github.com>
- Loading branch information
1 parent
f088444
commit 4dd7bfb
Showing
10 changed files
with
101 additions
and
2 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
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
20 changes: 20 additions & 0 deletions
20
infrastructure/jpa/src/main/java/org/depromeet/spot/jpa/config/QueryDslConfig.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,20 @@ | ||
package org.depromeet.spot.jpa.config; | ||
|
||
import jakarta.persistence.EntityManager; | ||
import jakarta.persistence.PersistenceContext; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
|
||
@Configuration | ||
public class QueryDslConfig { | ||
|
||
@PersistenceContext private EntityManager entityManager; | ||
|
||
@Bean | ||
public JPAQueryFactory queryFactory() { | ||
return new JPAQueryFactory(entityManager); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...re/jpa/src/main/java/org/depromeet/spot/jpa/member/repository/MemberCustomRepository.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,31 @@ | ||
package org.depromeet.spot.jpa.member.repository; | ||
|
||
import static org.depromeet.spot.jpa.member.entity.QMemberEntity.memberEntity; | ||
|
||
import java.util.List; | ||
|
||
import org.depromeet.spot.jpa.member.entity.MemberEntity; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import com.querydsl.core.types.dsl.BooleanExpression; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class MemberCustomRepository { | ||
|
||
private final JPAQueryFactory queryFactory; | ||
|
||
public List<MemberEntity> findByName(final String name) { | ||
return queryFactory.selectFrom(memberEntity).where(eqMemberName(name)).fetch(); | ||
} | ||
|
||
private BooleanExpression eqMemberName(final String name) { | ||
if (name == null) { | ||
return null; | ||
} | ||
return memberEntity.name.eq(name); | ||
} | ||
} |
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
4 changes: 4 additions & 0 deletions
4
usecase/src/main/java/org/depromeet/spot/usecase/port/in/MemberUsecase.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 |
---|---|---|
@@ -1,8 +1,12 @@ | ||
package org.depromeet.spot.usecase.port.in; | ||
|
||
import java.util.List; | ||
|
||
import org.depromeet.spot.domain.member.Member; | ||
|
||
public interface MemberUsecase { | ||
|
||
Member create(String name); | ||
|
||
List<Member> findByName(String name); | ||
} |
4 changes: 4 additions & 0 deletions
4
usecase/src/main/java/org/depromeet/spot/usecase/port/out/MemberRepository.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 |
---|---|---|
@@ -1,8 +1,12 @@ | ||
package org.depromeet.spot.usecase.port.out; | ||
|
||
import java.util.List; | ||
|
||
import org.depromeet.spot.domain.member.Member; | ||
|
||
public interface MemberRepository { | ||
|
||
Member save(Member member); | ||
|
||
List<Member> findByName(String name); | ||
} |
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