From e66732f51b2dab3a8c8e5824eca7d4463e3816a0 Mon Sep 17 00:00:00 2001 From: eckrin Date: Sat, 28 Oct 2023 20:23:05 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20erd=20=EC=B6=94=EA=B0=80=20init?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related to: Issue #7 --- .gitignore | 3 ++ .../java/com/kusitms/jipbap/food/Cart.java | 33 +++++++++++++++ .../com/kusitms/jipbap/food/Category.java | 26 ++++++++++++ .../java/com/kusitms/jipbap/food/Food.java | 38 +++++++++++++++++ .../jipbap/notifiication/Notification.java | 41 +++++++++++++++++++ .../java/com/kusitms/jipbap/post/Post.java | 41 +++++++++++++++++++ .../java/com/kusitms/jipbap/store/Store.java | 41 +++++++++++++++++++ .../kusitms/jipbap/store/StoreBookmark.java | 35 ++++++++++++++++ src/main/resources/application.yml | 2 +- 9 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/kusitms/jipbap/food/Cart.java create mode 100644 src/main/java/com/kusitms/jipbap/food/Category.java create mode 100644 src/main/java/com/kusitms/jipbap/food/Food.java create mode 100644 src/main/java/com/kusitms/jipbap/notifiication/Notification.java create mode 100644 src/main/java/com/kusitms/jipbap/post/Post.java create mode 100644 src/main/java/com/kusitms/jipbap/store/Store.java create mode 100644 src/main/java/com/kusitms/jipbap/store/StoreBookmark.java diff --git a/.gitignore b/.gitignore index c2065bc..46f0e00 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,6 @@ out/ ### VS Code ### .vscode/ + +### JRebel ### +rebel.xml \ No newline at end of file diff --git a/src/main/java/com/kusitms/jipbap/food/Cart.java b/src/main/java/com/kusitms/jipbap/food/Cart.java new file mode 100644 index 0000000..572f43f --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/food/Cart.java @@ -0,0 +1,33 @@ +package com.kusitms.jipbap.food; + +import com.kusitms.jipbap.common.entity.DateEntity; +import com.kusitms.jipbap.store.Store; +import com.kusitms.jipbap.user.User; +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Entity +@Table(name = "tb_cart") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class Cart extends DateEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name ="cart_id") + private Long id; //고유 pk + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn + private User user; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn + private Food food; + +} \ No newline at end of file diff --git a/src/main/java/com/kusitms/jipbap/food/Category.java b/src/main/java/com/kusitms/jipbap/food/Category.java new file mode 100644 index 0000000..6558bd7 --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/food/Category.java @@ -0,0 +1,26 @@ +package com.kusitms.jipbap.food; + +import com.kusitms.jipbap.common.entity.DateEntity; +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Entity +@Table(name = "tb_category") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class Category extends DateEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name ="category_id") + private Long id; //고유 pk + + private String name; + private String image; + +} \ No newline at end of file diff --git a/src/main/java/com/kusitms/jipbap/food/Food.java b/src/main/java/com/kusitms/jipbap/food/Food.java new file mode 100644 index 0000000..0a5163b --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/food/Food.java @@ -0,0 +1,38 @@ +package com.kusitms.jipbap.food; + +import com.kusitms.jipbap.common.entity.DateEntity; +import com.kusitms.jipbap.store.Store; +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.annotations.ColumnDefault; + +@Entity +@Table(name = "tb_food") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class Food extends DateEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name ="food_id") + private Long id; //고유 pk + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn + private Store store; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn + private Category category; + + private String name; + private Long price; + private String description; + private Long recommendCount; + +} \ No newline at end of file diff --git a/src/main/java/com/kusitms/jipbap/notifiication/Notification.java b/src/main/java/com/kusitms/jipbap/notifiication/Notification.java new file mode 100644 index 0000000..201d1e2 --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/notifiication/Notification.java @@ -0,0 +1,41 @@ +package com.kusitms.jipbap.notifiication; + +import com.kusitms.jipbap.common.entity.DateEntity; +import com.kusitms.jipbap.user.User; +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.annotations.ColumnDefault; + +@Entity +@Table(name = "tb_notification") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class Notification extends DateEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name ="notification_id") + private Long id; //고유 pk + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "user_id") + private User user; + + @Enumerated(EnumType.STRING) + private NotificationType notificationType; + + private String message; + + @ColumnDefault("false") + @Column(columnDefinition = "TINYINT(1)") + private Boolean readYn; + + public enum NotificationType { + OFFER, CHAT, REVIEW, WISHLIST + } +} \ No newline at end of file diff --git a/src/main/java/com/kusitms/jipbap/post/Post.java b/src/main/java/com/kusitms/jipbap/post/Post.java new file mode 100644 index 0000000..2e19842 --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/post/Post.java @@ -0,0 +1,41 @@ +package com.kusitms.jipbap.post; + +import com.kusitms.jipbap.common.entity.DateEntity; +import com.kusitms.jipbap.user.Role; +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import java.time.LocalDateTime; + +@Entity +@Table(name = "tb_post") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class Post extends DateEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name ="post_id") + private Long id; //고유 pk + + @Enumerated(EnumType.STRING) + private PostType postType; + + private String title; + private String content; + private Long hit; + + private LocalDateTime createdBy; + private LocalDateTime updatedBy; + + + public enum PostType { + STANDBY, APPROVE, SUSPEND + } +} \ No newline at end of file diff --git a/src/main/java/com/kusitms/jipbap/store/Store.java b/src/main/java/com/kusitms/jipbap/store/Store.java new file mode 100644 index 0000000..0cc3378 --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/store/Store.java @@ -0,0 +1,41 @@ +package com.kusitms.jipbap.store; + +import com.kusitms.jipbap.common.entity.DateEntity; +import com.kusitms.jipbap.user.User; +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.annotations.ColumnDefault; + +@Entity +@Table(name = "tb_store") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class Store extends DateEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name ="store_id") + private Long id; //고유 pk + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn + private User owner; + + //TODO("읍면동 지역 id?") + + private String name; + private String description; + + @ColumnDefault("false") + @Column(columnDefinition = "TINYINT(1)") + private Boolean koreanYn; + + private Double avgRate; + + private String image; +} \ No newline at end of file diff --git a/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java b/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java new file mode 100644 index 0000000..b924e0b --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java @@ -0,0 +1,35 @@ +package com.kusitms.jipbap.store; + +import com.kusitms.jipbap.common.entity.DateEntity; +import com.kusitms.jipbap.user.User; +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.annotations.ColumnDefault; + +@Entity +@Table(name = "tb_store_bookmark") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class StoreBookmark extends DateEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name ="store_bookmark_id") + private Long id; //고유 pk + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn + private User owner; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn + private Store store; + + + +} \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index cbddd6e..b9948b3 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -22,7 +22,7 @@ spring: jpa: open-in-view: true hibernate: - ddl-auto: update + ddl-auto: create show-sql: true properties: hibernate: