-
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.
Merge pull request #324 from Team-Ampersand/develop
Develop
- Loading branch information
Showing
32 changed files
with
269 additions
and
239 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
10 changes: 10 additions & 0 deletions
10
src/main/java/com/server/Dotori/domain/board/repository/BoardRepositoryCustom.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.server.Dotori.domain.board.repository; | ||
|
||
import com.server.Dotori.domain.board.Board; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
|
||
public interface BoardRepositoryCustom { | ||
|
||
Page<Board> getAllBoardCreateDateDesc(Pageable pageable); | ||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/com/server/Dotori/domain/board/repository/BoardRepositoryImpl.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,38 @@ | ||
package com.server.Dotori.domain.board.repository; | ||
|
||
import com.querydsl.core.QueryResults; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import com.server.Dotori.domain.board.Board; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.PageImpl; | ||
import org.springframework.data.domain.Pageable; | ||
|
||
import java.util.List; | ||
|
||
import static com.server.Dotori.domain.board.QBoard.board; | ||
import static com.server.Dotori.domain.member.QMember.member; | ||
|
||
@RequiredArgsConstructor | ||
public class BoardRepositoryImpl implements BoardRepositoryCustom { | ||
|
||
private final JPAQueryFactory queryFactory; | ||
|
||
@Override | ||
public Page<Board> getAllBoardCreateDateDesc(Pageable pageable) { | ||
QueryResults<Board> boardQueryResults = queryFactory | ||
.select(board) | ||
.from(board) | ||
.innerJoin(board.member, member) | ||
.offset(pageable.getOffset()) | ||
.limit(pageable.getPageSize()) | ||
.orderBy(board.createdDate.desc()) | ||
.fetchResults(); | ||
|
||
List<Board> content = boardQueryResults.getResults(); | ||
|
||
long total = boardQueryResults.getTotal(); | ||
|
||
return new PageImpl<>(content, pageable, total); | ||
} | ||
} |
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
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,10 +1,7 @@ | ||
package com.server.Dotori.domain.member.dto; | ||
|
||
import com.server.Dotori.domain.member.Member; | ||
import com.server.Dotori.domain.member.enumType.Massage; | ||
import com.server.Dotori.domain.member.enumType.Music; | ||
import com.server.Dotori.domain.member.enumType.Role; | ||
import com.server.Dotori.domain.member.enumType.SelfStudy; | ||
import com.server.Dotori.domain.member.enumType.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
@@ -36,6 +33,8 @@ public class MemberDto { | |
@Pattern(regexp = "^[a-zA-Z0-9][email protected]$") | ||
private String email; | ||
|
||
private Gender gender; | ||
|
||
public Member toEntity(String encodePassword){ | ||
return Member.builder() | ||
.memberName(memberName) | ||
|
@@ -48,6 +47,7 @@ public Member toEntity(String encodePassword){ | |
.music(Music.CAN) | ||
.selfStudy(SelfStudy.CAN) | ||
.point(0L) | ||
.gender(gender) | ||
.build(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/server/Dotori/domain/member/dto/SetGenderDto.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.server.Dotori.domain.member.dto; | ||
|
||
import com.server.Dotori.domain.member.enumType.Gender; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class SetGenderDto { | ||
private Long memberId; | ||
private Gender gender; | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/server/Dotori/domain/member/enumType/Gender.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,5 @@ | ||
package com.server.Dotori.domain.member.enumType; | ||
|
||
public enum Gender { | ||
MAN,WOMAN,PENDING | ||
} |
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
Oops, something went wrong.