-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
699 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/javalab/umc7th_mission/domain/FoodCategory.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 javalab.umc7th_mission.domain; | ||
import jakarta.persistence.*; | ||
import javalab.umc7th_mission.domain.common.BaseEntity; | ||
import javalab.umc7th_mission.domain.mapping.StoreCategory; | ||
import lombok.*; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Builder | ||
public class FoodCategory extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false, unique = true, length = 20) | ||
private String name; | ||
|
||
@Column(length = 255) | ||
private String description; | ||
|
||
//Store간의 관계 1:N | ||
@OneToMany(mappedBy = "foodCategory", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | ||
private List<StoreCategory> storeCategoryList = new ArrayList<>(); | ||
} |
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,68 @@ | ||
package javalab.umc7th_mission.domain; | ||
import jakarta.persistence.*; | ||
import javalab.umc7th_mission.domain.common.BaseEntity; | ||
import javalab.umc7th_mission.domain.enums.Gender; | ||
import javalab.umc7th_mission.domain.enums.MemberStatus; | ||
import javalab.umc7th_mission.domain.mapping.MemberAddress; | ||
import javalab.umc7th_mission.domain.mapping.MemberAgree; | ||
import javalab.umc7th_mission.domain.mapping.MemberMission; | ||
import javalab.umc7th_mission.domain.mapping.MemberPrefer; | ||
import lombok.*; | ||
import org.hibernate.annotations.ColumnDefault; | ||
import org.hibernate.annotations.Columns; | ||
|
||
import java.time.LocalDate; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@Builder | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
public class Member extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false, length = 20) | ||
private String name; | ||
|
||
@Column(nullable = false, length = 20) | ||
private String nickname; | ||
|
||
@Column(nullable = false, length = 20) | ||
private String phoneNumber; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(columnDefinition = "VARCHAR(10)") | ||
private Gender gender; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(columnDefinition = "VARCHAR(15) DEFAULT 'ACTIVE'") | ||
private MemberStatus status; | ||
|
||
private LocalDate inactiveDate; | ||
|
||
@Column(nullable = false, unique = true, length = 50) | ||
private String email; | ||
|
||
@Column(nullable = false) | ||
private Integer point = 0; | ||
|
||
@OneToMany(mappedBy = "member", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | ||
private List<MemberAddress> addressList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "member", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | ||
private List<MemberAgree> memberAgreeList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "member", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | ||
private List<MemberPrefer> memberPreferList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "member", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | ||
private List<Review> reviewList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "member", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | ||
private List<MemberMission> memberMissionList = new ArrayList<>(); | ||
} |
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,52 @@ | ||
package javalab.umc7th_mission.domain; | ||
import jakarta.persistence.*; | ||
import javalab.umc7th_mission.domain.common.BaseEntity; | ||
import javalab.umc7th_mission.domain.mapping.MemberMission; | ||
import lombok.*; | ||
|
||
import java.time.LocalDate; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@Builder | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
public class Mission extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false, length = 100) | ||
private String name; | ||
|
||
@Column(length = 500) | ||
private String description; | ||
|
||
@Column(nullable = false) | ||
private LocalDate startDate; | ||
|
||
@Column(nullable = false) | ||
private LocalDate endDate; | ||
|
||
@Column(nullable = false) | ||
private boolean isActive; | ||
|
||
@Column(nullable = false) | ||
private Integer reward; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
/* | ||
FetchType.LAZY의 장단점 | ||
1. 성능 최적화: 필요할 때만 연관 데이터를 로딩 -> 불필요한 쿼리 실행수 줄일 수 있음 | ||
2. 메모리 효율성: 여러개의 ManyToOne 관계를 가진 엔티티에서, 지연로딩을 통해 메모리 최소화 | ||
3. 순환 참조 방지: 지연 로딩을 통해 방지 | ||
*/ | ||
@JoinColumn(name = "store_id", referencedColumnName = "id", nullable = false) | ||
private Store store; | ||
|
||
@OneToMany(mappedBy = "mission", cascade = CascadeType.ALL) | ||
private List<MemberMission> memberMissionList = new ArrayList<>(); | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/javalab/umc7th_mission/domain/Notification.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 javalab.umc7th_mission.domain; | ||
import jakarta.persistence.*; | ||
import javalab.umc7th_mission.domain.common.BaseEntity; | ||
import javalab.umc7th_mission.domain.mapping.MemberNotification; | ||
import lombok.*; | ||
|
||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Builder | ||
public class Notification extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false, length = 255) | ||
private String message; | ||
|
||
@Column(nullable = false, length = 50) | ||
private String type; | ||
|
||
@OneToMany(mappedBy = "notification", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true) | ||
private List<MemberNotification> memberNotificationList = new ArrayList<>(); | ||
} |
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,33 @@ | ||
package javalab.umc7th_mission.domain; | ||
import jakarta.persistence.*; | ||
import javalab.umc7th_mission.domain.common.BaseEntity; | ||
import lombok.*; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Builder | ||
public class Question extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false, length = 500) | ||
private String content; | ||
|
||
@Column(nullable = false) | ||
private boolean isAnswered; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "member_id", referencedColumnName = "id") | ||
private Member member; | ||
|
||
@OneToMany(mappedBy = "question", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | ||
private List<QuestionImage> questionImageList = new ArrayList<>(); | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/javalab/umc7th_mission/domain/QuestionImage.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,29 @@ | ||
package javalab.umc7th_mission.domain; | ||
import jakarta.persistence.*; | ||
import javalab.umc7th_mission.domain.common.BaseEntity; | ||
import lombok.*; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Builder | ||
public class QuestionImage extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false) | ||
private String imageUrl; | ||
|
||
@Column(nullable = false) | ||
private String fileName; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "question_id") | ||
private Question question; | ||
} |
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,37 @@ | ||
package javalab.umc7th_mission.domain; | ||
import jakarta.persistence.*; | ||
import javalab.umc7th_mission.domain.common.BaseEntity; | ||
import javalab.umc7th_mission.domain.mapping.MemberAddress; | ||
import javalab.umc7th_mission.domain.mapping.StoreAddress; | ||
import lombok.*; | ||
|
||
import java.time.LocalDate; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Builder | ||
public class Region extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false, length = 50) | ||
private String name; | ||
|
||
/* | ||
@Column(length = 200) | ||
private String description; | ||
*/ | ||
|
||
@OneToMany(mappedBy = "region", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | ||
private List<MemberAddress> memberAddressList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "region", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | ||
private List<StoreAddress> storeAddressList = new ArrayList<>(); | ||
} |
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,44 @@ | ||
package javalab.umc7th_mission.domain; | ||
|
||
import jakarta.persistence.*; | ||
import javalab.umc7th_mission.domain.common.BaseEntity; | ||
import lombok.*; | ||
|
||
import java.math.BigDecimal; | ||
import java.time.LocalDate; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Builder | ||
public class Review extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false, length = 500) | ||
private String content; | ||
|
||
//기존 Erd와 변경부분 정수형 -> 실수형 첫자리 까지 받는걸로 변경 | ||
@Column(nullable = false, precision = 5, scale = 1) | ||
private BigDecimal rating; | ||
|
||
//Member와 연관관계 | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "member_id", referencedColumnName = "id") | ||
private Member member; | ||
|
||
//Store와의 연관 관계 | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "store_id", referencedColumnName = "id") | ||
private Store store; | ||
|
||
@OneToMany(mappedBy = "review", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | ||
private List<ReviewImage> reviewImageList = new ArrayList<>(); | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/javalab/umc7th_mission/domain/ReviewImage.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,30 @@ | ||
package javalab.umc7th_mission.domain; | ||
|
||
import jakarta.persistence.*; | ||
import javalab.umc7th_mission.domain.common.BaseEntity; | ||
import lombok.*; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Builder | ||
public class ReviewImage extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false) | ||
private String imageUrl; | ||
|
||
@Column(nullable = false) | ||
private String fileName; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "review_id") | ||
private Review review; | ||
} |
Oops, something went wrong.