-
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 #48 from Central-MakeUs/dev
feat: 실DB 연동, expect 구매인증 에러 수정
- Loading branch information
Showing
9 changed files
with
320 additions
and
172 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
23 changes: 10 additions & 13 deletions
23
core/core-domain/src/main/java/com/mm/coredomain/domain/Groups.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,23 +1,20 @@ | ||
package com.mm.coredomain.domain; | ||
|
||
import java.util.List; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.OneToMany; | ||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@Entity | ||
@Table(name = "member_groups") | ||
public class Groups extends BaseEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String name; | ||
private String name; | ||
|
||
@OneToMany(mappedBy = "groups") | ||
private List<GroupPermission> groupPermissions; | ||
@OneToMany(mappedBy = "groups") | ||
private List<GroupPermission> groupPermissions; | ||
} |
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
63 changes: 31 additions & 32 deletions
63
...ore-infra-qdsl/src/main/java/com/mm/coreinfraqdsl/repository/BuyCustomRepositoryImpl.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,43 +1,42 @@ | ||
package com.mm.coreinfraqdsl.repository; | ||
|
||
import static com.mm.coredomain.domain.QBuy.*; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.stereotype.Repository; | ||
|
||
import com.mm.coredomain.domain.Buy; | ||
import com.mm.coredomain.domain.Member; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
import static com.mm.coredomain.domain.QBuy.buy; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class BuyCustomRepositoryImpl implements BuyCustomRepository { | ||
private final JPAQueryFactory jpaQueryFactory; | ||
|
||
private static final Long PAGE_OFFSET = 10L; | ||
private static final Long PAGE_OFFSET_ME = 9L; | ||
|
||
@Override | ||
public List<Buy> getBuysMeByMember(Integer page, Member member) { | ||
return jpaQueryFactory.selectFrom(buy) | ||
.where(buy.member.eq(member)) | ||
.offset((page - 1) * PAGE_OFFSET_ME) | ||
.limit(PAGE_OFFSET_ME) | ||
.fetch(); | ||
} | ||
|
||
@Override | ||
public Long getBuysMePageNum(Member member) { | ||
Long count = jpaQueryFactory.select(buy.count()) | ||
.from(buy) | ||
.where(buy.member.eq(member)) | ||
.fetchOne(); | ||
if (count % PAGE_OFFSET_ME != 0) { | ||
return count / PAGE_OFFSET_ME + 1; | ||
} | ||
return count / PAGE_OFFSET_ME; | ||
} | ||
private final JPAQueryFactory jpaQueryFactory; | ||
|
||
private static final Long PAGE_OFFSET = 10L; | ||
private static final Long PAGE_OFFSET_ME = 9L; | ||
|
||
@Override | ||
public List<Buy> getBuysMeByMember(Integer page, Member member) { | ||
return jpaQueryFactory.selectFrom(buy) | ||
.where(buy.member.eq(member)) | ||
.orderBy(buy.id.desc()) | ||
.offset((page - 1) * PAGE_OFFSET_ME) | ||
.limit(PAGE_OFFSET_ME) | ||
.fetch(); | ||
} | ||
|
||
@Override | ||
public Long getBuysMePageNum(Member member) { | ||
Long count = jpaQueryFactory.select(buy.count()) | ||
.from(buy) | ||
.where(buy.member.eq(member)) | ||
.fetchOne(); | ||
if (count % PAGE_OFFSET_ME != 0) { | ||
return count / PAGE_OFFSET_ME + 1; | ||
} | ||
return count / PAGE_OFFSET_ME; | ||
} | ||
} |
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.