From 19fe5e494856209d23d4e86d84ad17ff7eb075be Mon Sep 17 00:00:00 2001 From: jainefer Date: Mon, 18 Nov 2024 15:54:36 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20posts=EA=B4=80=EB=A0=A8=20=EB=8F=84?= =?UTF-8?q?=EB=A9=94=EC=9D=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/enums/items/PriceStandard.java | 7 +++ .../model/post/ItemsBorrowJpaEntity.java | 44 +++++++++++++++++++ .../model/post/ItemsCategoryJpaEntity.java | 27 ++++++++++++ .../model/post/ItemsExchangeJpaEntity.java | 28 ++++++++++++ .../apiserver/model/post/ItemsJpaEntity.java | 43 ++++++++++++++++++ .../model/post/ItemsLocationJpaEntity.java | 40 +++++++++++++++++ .../model/post/ItemsReviewJpaEntity.java | 34 ++++++++++++++ .../model/post/emebeded/ItemsLikeId.java | 22 ++++++++++ .../model/post/itemsLikeJpaEntity.java | 39 ++++++++++++++++ 9 files changed, 284 insertions(+) create mode 100644 src/main/java/site/billbill/apiserver/common/enums/items/PriceStandard.java create mode 100644 src/main/java/site/billbill/apiserver/model/post/ItemsBorrowJpaEntity.java create mode 100644 src/main/java/site/billbill/apiserver/model/post/ItemsCategoryJpaEntity.java create mode 100644 src/main/java/site/billbill/apiserver/model/post/ItemsExchangeJpaEntity.java create mode 100644 src/main/java/site/billbill/apiserver/model/post/ItemsJpaEntity.java create mode 100644 src/main/java/site/billbill/apiserver/model/post/ItemsLocationJpaEntity.java create mode 100644 src/main/java/site/billbill/apiserver/model/post/ItemsReviewJpaEntity.java create mode 100644 src/main/java/site/billbill/apiserver/model/post/emebeded/ItemsLikeId.java create mode 100644 src/main/java/site/billbill/apiserver/model/post/itemsLikeJpaEntity.java diff --git a/src/main/java/site/billbill/apiserver/common/enums/items/PriceStandard.java b/src/main/java/site/billbill/apiserver/common/enums/items/PriceStandard.java new file mode 100644 index 0000000..49c302b --- /dev/null +++ b/src/main/java/site/billbill/apiserver/common/enums/items/PriceStandard.java @@ -0,0 +1,7 @@ +package site.billbill.apiserver.common.enums.items; + +public enum PriceStandard { + DAY, + MONTH, + YEAR +} diff --git a/src/main/java/site/billbill/apiserver/model/post/ItemsBorrowJpaEntity.java b/src/main/java/site/billbill/apiserver/model/post/ItemsBorrowJpaEntity.java new file mode 100644 index 0000000..ae8a6b8 --- /dev/null +++ b/src/main/java/site/billbill/apiserver/model/post/ItemsBorrowJpaEntity.java @@ -0,0 +1,44 @@ +package site.billbill.apiserver.model.post; + +import jakarta.persistence.*; +import lombok.*; +import org.hibernate.annotations.DynamicUpdate; +import site.billbill.apiserver.common.converter.BooleanConverter; +import site.billbill.apiserver.common.converter.StringListConverter; +import site.billbill.apiserver.common.enums.items.PriceStandard; +import site.billbill.apiserver.common.enums.user.DeviceType; +import site.billbill.apiserver.model.BaseTime; +import site.billbill.apiserver.model.user.UserJpaEntity; + +import java.time.LocalDate; +import java.util.List; + +@DynamicUpdate +@Entity +@Builder +@Table(name = "items_borrow") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class ItemsBorrowJpaEntity extends BaseTime { + @Id + @Column(name = "item_id", nullable = false) + private String id; + @OneToOne + @MapsId + private ItemsJpaEntity items; + @Enumerated(EnumType.STRING) + @Column(name = "price_standard") + private PriceStandard priceStandard; + @Column(name = "price", nullable = false) + private int price; + @Column(name="deposit",nullable = false) + private int deposit; + @Column(name="start_date",nullable = false) + private LocalDate startDate; + @Column(name = "end_date", nullable = false) + private LocalDate endDate; + @Column(name ="borrow_satus_code") + private String borrowStatusCode; +} diff --git a/src/main/java/site/billbill/apiserver/model/post/ItemsCategoryJpaEntity.java b/src/main/java/site/billbill/apiserver/model/post/ItemsCategoryJpaEntity.java new file mode 100644 index 0000000..56f17b5 --- /dev/null +++ b/src/main/java/site/billbill/apiserver/model/post/ItemsCategoryJpaEntity.java @@ -0,0 +1,27 @@ +package site.billbill.apiserver.model.post; + +import jakarta.persistence.*; +import lombok.*; +import org.hibernate.annotations.DynamicUpdate; + +@DynamicUpdate +@Entity +@Builder +@Table(name = "items_category") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class ItemsCategoryJpaEntity { + + @Id + @Column(name ="category_id") + private String id; + + @ManyToOne + @JoinColumn(name="upper_cat_id",nullable = false) + private ItemsCategoryJpaEntity upperCategory; + + @Column(name="name") + private String name; +} diff --git a/src/main/java/site/billbill/apiserver/model/post/ItemsExchangeJpaEntity.java b/src/main/java/site/billbill/apiserver/model/post/ItemsExchangeJpaEntity.java new file mode 100644 index 0000000..77e4c48 --- /dev/null +++ b/src/main/java/site/billbill/apiserver/model/post/ItemsExchangeJpaEntity.java @@ -0,0 +1,28 @@ +package site.billbill.apiserver.model.post; + +import jakarta.persistence.*; +import lombok.*; +import org.hibernate.annotations.DynamicUpdate; +import site.billbill.apiserver.common.converter.StringListConverter; +import site.billbill.apiserver.model.BaseTime; + +@DynamicUpdate +@Entity +@Builder +@Table(name = "items_exchange") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class ItemsExchangeJpaEntity extends BaseTime { + @Id + @Column(name="item_id") + private String item_id; + + @ManyToOne + @MapsId + private ItemsJpaEntity items; + @Convert(converter = StringListConverter.class) + @JoinColumn(name="wisiList",nullable = false) + String wishList; +} diff --git a/src/main/java/site/billbill/apiserver/model/post/ItemsJpaEntity.java b/src/main/java/site/billbill/apiserver/model/post/ItemsJpaEntity.java new file mode 100644 index 0000000..efda4de --- /dev/null +++ b/src/main/java/site/billbill/apiserver/model/post/ItemsJpaEntity.java @@ -0,0 +1,43 @@ +package site.billbill.apiserver.model.post; + +import io.micrometer.core.annotation.Counted; +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import site.billbill.apiserver.common.converter.BooleanConverter; +import site.billbill.apiserver.common.converter.StringListConverter; +import site.billbill.apiserver.model.BaseTime; +import site.billbill.apiserver.model.user.UserJpaEntity; + +import java.time.LocalDate; +import java.util.List; + +@Entity +@Table(name = "items") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class ItemsJpaEntity extends BaseTime { + @Id + @Column(name = "item_id", nullable = false) + private String id; + @ManyToOne + @JoinColumn(name="owner_id") + private UserJpaEntity owner; + @Convert(converter = StringListConverter.class) + @Column(name = "images", nullable = true) + private List images; + @Column(name = "title", nullable = false) + private String title; + @Column(name="content",nullable = false) + private String content; + @Column(name="like_count",nullable = false) + private int viewCount; + @Column(name = "del_yn", nullable = false) + @Convert(converter = BooleanConverter.class) + private boolean delYn; + +} diff --git a/src/main/java/site/billbill/apiserver/model/post/ItemsLocationJpaEntity.java b/src/main/java/site/billbill/apiserver/model/post/ItemsLocationJpaEntity.java new file mode 100644 index 0000000..34bc234 --- /dev/null +++ b/src/main/java/site/billbill/apiserver/model/post/ItemsLocationJpaEntity.java @@ -0,0 +1,40 @@ +package site.billbill.apiserver.model.post; + +import jakarta.persistence.*; +import lombok.*; +import org.hibernate.annotations.DynamicUpdate; +import site.billbill.apiserver.model.BaseTime; + +import java.awt.*; + +@DynamicUpdate +@Entity +@Builder +@Table(name = "items_location") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class ItemsLocationJpaEntity extends BaseTime { + @Id + @Column(name="item_id") + private String id; + + @MapsId + @ManyToOne + private ItemsJpaEntity items; + + @Column(name="address",nullable = false) + private String address; + + @Column(name="coordinates",nullable = false) + private Point coordinates; + + @Column(name = "latitude", nullable = true) + private Double latitude; + @Column(name = "longitude", nullable = true) + private Double longitude; + + + +} diff --git a/src/main/java/site/billbill/apiserver/model/post/ItemsReviewJpaEntity.java b/src/main/java/site/billbill/apiserver/model/post/ItemsReviewJpaEntity.java new file mode 100644 index 0000000..cf6ef9c --- /dev/null +++ b/src/main/java/site/billbill/apiserver/model/post/ItemsReviewJpaEntity.java @@ -0,0 +1,34 @@ +package site.billbill.apiserver.model.post; + +import jakarta.persistence.*; +import lombok.*; +import org.hibernate.annotations.DynamicUpdate; +import site.billbill.apiserver.model.BaseTime; +import site.billbill.apiserver.model.user.UserJpaEntity; + +@DynamicUpdate +@Entity +@Builder +@Table(name = "items_review") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class ItemsReviewJpaEntity extends BaseTime { + + @Id + @Column(name="review_id") + private String id; + @ManyToOne + @JoinColumn(name="item_id") + private ItemsJpaEntity items; + @ManyToOne + @JoinColumn(name="user_id") + private UserJpaEntity user; + + @Column(name="rating",nullable = false) + private int rating; + @Column(name="content",nullable = false) + private String content; + +} diff --git a/src/main/java/site/billbill/apiserver/model/post/emebeded/ItemsLikeId.java b/src/main/java/site/billbill/apiserver/model/post/emebeded/ItemsLikeId.java new file mode 100644 index 0000000..a3b47aa --- /dev/null +++ b/src/main/java/site/billbill/apiserver/model/post/emebeded/ItemsLikeId.java @@ -0,0 +1,22 @@ +package site.billbill.apiserver.model.post.emebeded; + +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@Embeddable +@AllArgsConstructor +@NoArgsConstructor +@EqualsAndHashCode +@Data +public class ItemsLikeId implements Serializable { + @Column(name="item_id") + private String itemId; + @Column(name="user_id") + private String userId; +} diff --git a/src/main/java/site/billbill/apiserver/model/post/itemsLikeJpaEntity.java b/src/main/java/site/billbill/apiserver/model/post/itemsLikeJpaEntity.java new file mode 100644 index 0000000..dd5918c --- /dev/null +++ b/src/main/java/site/billbill/apiserver/model/post/itemsLikeJpaEntity.java @@ -0,0 +1,39 @@ +package site.billbill.apiserver.model.post; + +import jakarta.mail.FetchProfile; +import jakarta.persistence.*; +import lombok.*; +import org.hibernate.annotations.DynamicUpdate; +import site.billbill.apiserver.common.converter.BooleanConverter; +import site.billbill.apiserver.model.BaseTime; +import site.billbill.apiserver.model.post.emebeded.ItemsLikeId; +import site.billbill.apiserver.model.user.UserJpaEntity; + +@DynamicUpdate +@Entity +@Builder +@Table(name = "items_like") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor + +public class itemsLikeJpaEntity extends BaseTime { + @EmbeddedId + private ItemsLikeId id; + + @ManyToOne + @MapsId + @JoinColumn(name="item_id") + private ItemsJpaEntity items; + + @ManyToOne + @MapsId + @JoinColumn(name="user_id") + private UserJpaEntity user; + + @Column(name = "del_yn", nullable = false) + @Convert(converter = BooleanConverter.class) + private boolean delYn; + +}