diff --git a/src/main/java/org/kakaoshare/backend/domain/base/entity/BaseTimeEntity.java b/src/main/java/org/kakaoshare/backend/domain/base/entity/BaseTimeEntity.java new file mode 100644 index 000000000..b875c65c2 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/base/entity/BaseTimeEntity.java @@ -0,0 +1,23 @@ +package org.kakaoshare.backend.domain.base.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; +import java.time.LocalDateTime; +import lombok.Getter; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +@Getter +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +public abstract class BaseTimeEntity { + + @CreatedDate + @Column(updatable = false) + protected LocalDateTime createdAt; + + @LastModifiedDate + protected LocalDateTime updatedAt; +} diff --git a/src/main/java/org/kakaoshare/backend/domain/brand/entity/Brand.java b/src/main/java/org/kakaoshare/backend/domain/brand/entity/Brand.java new file mode 100644 index 000000000..74396a056 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/brand/entity/Brand.java @@ -0,0 +1,41 @@ +package org.kakaoshare.backend.domain.brand.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; +import java.util.List; +import lombok.Getter; +import org.kakaoshare.backend.domain.base.entity.BaseTimeEntity; +import org.kakaoshare.backend.domain.category.entity.Category; +import org.kakaoshare.backend.domain.product.entity.Product; + + +@Entity +@Getter +public class Brand extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long brandId; + + @Column(nullable = false) + private String name; + + @Column + private String iconPhoto; + + @Column(nullable = false) + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "category_id") + private Category category; + + @OneToMany(mappedBy = "brand") + private List products; + +} diff --git a/src/main/java/org/kakaoshare/backend/domain/brand/repository/BrandRepository.java b/src/main/java/org/kakaoshare/backend/domain/brand/repository/BrandRepository.java new file mode 100644 index 000000000..57592695f --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/brand/repository/BrandRepository.java @@ -0,0 +1,8 @@ +package org.kakaoshare.backend.domain.brand.repository; + +import org.kakaoshare.backend.domain.brand.entity.Brand; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface BrandRepository extends JpaRepository { +} diff --git a/src/main/java/org/kakaoshare/backend/domain/category/entity/Category.java b/src/main/java/org/kakaoshare/backend/domain/category/entity/Category.java new file mode 100644 index 000000000..72dea178f --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/category/entity/Category.java @@ -0,0 +1,35 @@ +package org.kakaoshare.backend.domain.category.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; +import java.util.List; +import lombok.Getter; +import org.kakaoshare.backend.domain.base.entity.BaseTimeEntity; + + +@Entity +@Getter +public class Category extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long categoryId; + + @Column(nullable = false) + private String name; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "parent_id") + private Category parent; + + @OneToMany(mappedBy = "parent", fetch = FetchType.LAZY) + private List Categories; + +} diff --git a/src/main/java/org/kakaoshare/backend/domain/category/repository/CategoryRepository.java b/src/main/java/org/kakaoshare/backend/domain/category/repository/CategoryRepository.java new file mode 100644 index 000000000..f4b5dd4f7 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/category/repository/CategoryRepository.java @@ -0,0 +1,8 @@ +package org.kakaoshare.backend.domain.category.repository; + +import org.kakaoshare.backend.domain.category.entity.Category; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface CategoryRepository extends JpaRepository { +} diff --git a/src/main/java/org/kakaoshare/backend/domain/funding/entity/Funding.java b/src/main/java/org/kakaoshare/backend/domain/funding/entity/Funding.java new file mode 100644 index 000000000..523a486f1 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/funding/entity/Funding.java @@ -0,0 +1,52 @@ +package org.kakaoshare.backend.domain.funding.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import lombok.Getter; +import org.kakaoshare.backend.domain.base.entity.BaseTimeEntity; +import org.kakaoshare.backend.domain.member.entity.Member; +import org.kakaoshare.backend.domain.product.entity.Product; + + +@Entity +@Getter +public class Funding extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long fundingId; + + @Column + private String status; + + @Column(nullable = false) + private LocalDate expiredAt; + + @Column(nullable = false, precision = 12, scale = 2) + private BigDecimal goalAmount; + + @Column(nullable = false, precision = 12, scale = 2) + private BigDecimal accumulateAmount; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id", nullable = false) + private Member member; + + @OneToMany(mappedBy = "funding") + private List fundingDetails; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "product_id", nullable = false) + private Product product; +} diff --git a/src/main/java/org/kakaoshare/backend/domain/funding/entity/FundingDetail.java b/src/main/java/org/kakaoshare/backend/domain/funding/entity/FundingDetail.java new file mode 100644 index 000000000..885268a96 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/funding/entity/FundingDetail.java @@ -0,0 +1,41 @@ +package org.kakaoshare.backend.domain.funding.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; +import java.math.BigDecimal; +import java.util.List; +import lombok.Getter; +import org.kakaoshare.backend.domain.base.entity.BaseTimeEntity; +import org.kakaoshare.backend.domain.order.entity.Order; + + +@Entity +@Getter +public class FundingDetail extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long fundingDetailId; + + @Column(nullable = false, precision = 12, scale = 2) + private BigDecimal amount; + + @Column(nullable = false, precision = 7, scale = 2) + private BigDecimal rate; + + @OneToMany(mappedBy = "fundingDetail") + private List orders; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "funding_id", nullable = false) + private Funding funding; + + +} diff --git a/src/main/java/org/kakaoshare/backend/domain/funding/repository/FundingDetailRepository.java b/src/main/java/org/kakaoshare/backend/domain/funding/repository/FundingDetailRepository.java new file mode 100644 index 000000000..0e76703c2 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/funding/repository/FundingDetailRepository.java @@ -0,0 +1,8 @@ +package org.kakaoshare.backend.domain.funding.repository; + +import org.kakaoshare.backend.domain.funding.entity.FundingDetail; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface FundingDetailRepository extends JpaRepository { +} diff --git a/src/main/java/org/kakaoshare/backend/domain/funding/repository/FundingRepository.java b/src/main/java/org/kakaoshare/backend/domain/funding/repository/FundingRepository.java new file mode 100644 index 000000000..187fcf36e --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/funding/repository/FundingRepository.java @@ -0,0 +1,8 @@ +package org.kakaoshare.backend.domain.funding.repository; + +import org.kakaoshare.backend.domain.funding.entity.Funding; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface FundingRepository extends JpaRepository { +} diff --git a/src/main/java/org/kakaoshare/backend/domain/gift/entity/Gift.java b/src/main/java/org/kakaoshare/backend/domain/gift/entity/Gift.java new file mode 100644 index 000000000..c170ffe9a --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/gift/entity/Gift.java @@ -0,0 +1,40 @@ +package org.kakaoshare.backend.domain.gift.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import lombok.Getter; +import org.kakaoshare.backend.domain.base.entity.BaseTimeEntity; +import org.kakaoshare.backend.domain.order.entity.Order; +import org.kakaoshare.backend.domain.product.entity.Product; + + +@Entity +@Getter +public class Gift extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long giftId; + @Column(nullable = false, length = 50) + private String status; + + @Column + private String message; + + @Column + private String messagePhoto; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "orders_id", nullable = false) + private Order order; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "product_id", nullable = false) + private Product product; +} diff --git a/src/main/java/org/kakaoshare/backend/domain/gift/repository/GiftRepository.java b/src/main/java/org/kakaoshare/backend/domain/gift/repository/GiftRepository.java new file mode 100644 index 000000000..4c28e217c --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/gift/repository/GiftRepository.java @@ -0,0 +1,8 @@ +package org.kakaoshare.backend.domain.gift.repository; + +import org.kakaoshare.backend.domain.gift.entity.Gift; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface GiftRepository extends JpaRepository { +} diff --git a/src/main/java/org/kakaoshare/backend/domain/hashtag/entity/Hashtag.java b/src/main/java/org/kakaoshare/backend/domain/hashtag/entity/Hashtag.java new file mode 100644 index 000000000..a12af64fe --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/hashtag/entity/Hashtag.java @@ -0,0 +1,28 @@ +package org.kakaoshare.backend.domain.hashtag.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.OneToMany; +import java.util.List; +import lombok.Getter; +import org.kakaoshare.backend.domain.base.entity.BaseTimeEntity; + + +@Entity +@Getter +public class Hashtag extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long hashtagId; + + @Column(nullable = false) + private String name; + + @OneToMany(mappedBy = "hashtag") + private List ProductHashtags; + +} diff --git a/src/main/java/org/kakaoshare/backend/domain/hashtag/entity/ProductHashtag.java b/src/main/java/org/kakaoshare/backend/domain/hashtag/entity/ProductHashtag.java new file mode 100644 index 000000000..fbd71f937 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/hashtag/entity/ProductHashtag.java @@ -0,0 +1,31 @@ +package org.kakaoshare.backend.domain.hashtag.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import lombok.Getter; +import org.kakaoshare.backend.domain.base.entity.BaseTimeEntity; +import org.kakaoshare.backend.domain.hashtag.entity.Hashtag; +import org.kakaoshare.backend.domain.product.entity.Product; + + +@Entity +@Getter +public class ProductHashtag extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long productHashtagId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "hashtag_id", nullable = false) + private Hashtag hashtag; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "product_id", nullable = false) + private Product product; +} diff --git a/src/main/java/org/kakaoshare/backend/domain/hashtag/repository/HashtagRepository.java b/src/main/java/org/kakaoshare/backend/domain/hashtag/repository/HashtagRepository.java new file mode 100644 index 000000000..74639c75b --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/hashtag/repository/HashtagRepository.java @@ -0,0 +1,8 @@ +package org.kakaoshare.backend.domain.hashtag.repository; + +import org.kakaoshare.backend.domain.hashtag.entity.Hashtag; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface HashtagRepository extends JpaRepository { +} diff --git a/src/main/java/org/kakaoshare/backend/domain/member/entity/Member.java b/src/main/java/org/kakaoshare/backend/domain/member/entity/Member.java new file mode 100644 index 000000000..842a3a765 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/member/entity/Member.java @@ -0,0 +1,42 @@ +package org.kakaoshare.backend.domain.member.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.OneToMany; +import java.util.List; +import lombok.Getter; +import org.kakaoshare.backend.domain.base.entity.BaseTimeEntity; +import org.kakaoshare.backend.domain.order.entity.Order; +import org.kakaoshare.backend.domain.funding.entity.Funding; + + +@Entity +@Getter +public class Member extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long memberId; + + @Column(nullable = false) + private String email; + + @Column(nullable = false, length = 20) + private String phoneNumber; + + @Column + private String kakaoId; + + @Column + private String kakaoUuid; + + @OneToMany(mappedBy = "member") + private List orders; + + @OneToMany(mappedBy = "member") + private List funding; + +} diff --git a/src/main/java/org/kakaoshare/backend/domain/member/repository/MemberRepository.java b/src/main/java/org/kakaoshare/backend/domain/member/repository/MemberRepository.java new file mode 100644 index 000000000..efa0a9c02 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/member/repository/MemberRepository.java @@ -0,0 +1,8 @@ +package org.kakaoshare.backend.domain.member.repository; + +import org.kakaoshare.backend.domain.member.entity.Member; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface MemberRepository extends JpaRepository { +} diff --git a/src/main/java/org/kakaoshare/backend/domain/option/entity/Option.java b/src/main/java/org/kakaoshare/backend/domain/option/entity/Option.java new file mode 100644 index 000000000..94ffbb99a --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/option/entity/Option.java @@ -0,0 +1,35 @@ +package org.kakaoshare.backend.domain.option.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; +import java.util.List; +import lombok.Getter; +import org.kakaoshare.backend.domain.base.entity.BaseTimeEntity; +import org.kakaoshare.backend.domain.product.entity.Product; + + +@Entity +@Getter +public class Option extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long optionId; + + @Column(nullable = false) + private String name; + + @OneToMany(mappedBy = "option") + private List optionDetails; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "product_id", nullable = false) + private Product product; +} diff --git a/src/main/java/org/kakaoshare/backend/domain/option/entity/OptionDetail.java b/src/main/java/org/kakaoshare/backend/domain/option/entity/OptionDetail.java new file mode 100644 index 000000000..4879b0b35 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/option/entity/OptionDetail.java @@ -0,0 +1,41 @@ +package org.kakaoshare.backend.domain.option.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import java.math.BigDecimal; +import lombok.Getter; +import org.kakaoshare.backend.domain.base.entity.BaseTimeEntity; +import org.kakaoshare.backend.domain.option.entity.Option; + + +@Entity +@Getter +public class OptionDetail extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long optionDetailId; + + @Column(nullable = false) + private String name; + + @Column(nullable = false) + private Integer stockQuantity; + + @Column(nullable = false, precision = 12, scale = 2) + private BigDecimal additionalPrice; + + @Column + private String photo; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "option_id", nullable = false) + private Option option; + +} diff --git a/src/main/java/org/kakaoshare/backend/domain/option/repository/OptionDetailRepository.java b/src/main/java/org/kakaoshare/backend/domain/option/repository/OptionDetailRepository.java new file mode 100644 index 000000000..d8bc99c93 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/option/repository/OptionDetailRepository.java @@ -0,0 +1,8 @@ +package org.kakaoshare.backend.domain.option.repository; + +import org.kakaoshare.backend.domain.option.entity.OptionDetail; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface OptionDetailRepository extends JpaRepository { +} diff --git a/src/main/java/org/kakaoshare/backend/domain/option/repository/OptionRepository.java b/src/main/java/org/kakaoshare/backend/domain/option/repository/OptionRepository.java new file mode 100644 index 000000000..21231cb64 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/option/repository/OptionRepository.java @@ -0,0 +1,8 @@ +package org.kakaoshare.backend.domain.option.repository; + +import org.kakaoshare.backend.domain.option.entity.Option; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface OptionRepository extends JpaRepository { +} diff --git a/src/main/java/org/kakaoshare/backend/domain/order/entity/Order.java b/src/main/java/org/kakaoshare/backend/domain/order/entity/Order.java new file mode 100644 index 000000000..3982bd493 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/order/entity/Order.java @@ -0,0 +1,58 @@ +package org.kakaoshare.backend.domain.order.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; +import java.util.List; +import lombok.Getter; +import org.kakaoshare.backend.domain.base.entity.BaseTimeEntity; +import org.kakaoshare.backend.domain.payment.entity.Payment; +import org.kakaoshare.backend.domain.product.entity.Product; +import org.kakaoshare.backend.domain.funding.entity.FundingDetail; +import org.kakaoshare.backend.domain.gift.entity.Gift; +import org.kakaoshare.backend.domain.member.entity.Member; + + +@Entity +@Getter +@Table(name = "orders") +public class Order extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long ordersId; + + @Column(nullable = false) + private Integer stockQuantity; + + @Column(nullable = false, length = 50) + private String orderNumber; + + @Column(nullable = false, length = 50) + private String status; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id", nullable = false) + private Member member; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "funding_detail_id") + private FundingDetail fundingDetail; + + @OneToMany(mappedBy = "orders") + private List Payments; + + @OneToMany(mappedBy = "orders") + private List sGifts; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "product_id", nullable = false) + private Product product; +} diff --git a/src/main/java/org/kakaoshare/backend/domain/order/repository/OrderRepository.java b/src/main/java/org/kakaoshare/backend/domain/order/repository/OrderRepository.java new file mode 100644 index 000000000..ad0ef4ee5 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/order/repository/OrderRepository.java @@ -0,0 +1,8 @@ +package org.kakaoshare.backend.domain.order.repository; + +import org.kakaoshare.backend.domain.order.entity.Order; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface OrderRepository extends JpaRepository { +} diff --git a/src/main/java/org/kakaoshare/backend/domain/payment/entity/Payment.java b/src/main/java/org/kakaoshare/backend/domain/payment/entity/Payment.java new file mode 100644 index 000000000..ba80737ea --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/payment/entity/Payment.java @@ -0,0 +1,39 @@ +package org.kakaoshare.backend.domain.payment.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import java.math.BigDecimal; +import lombok.Getter; +import org.kakaoshare.backend.domain.base.entity.BaseTimeEntity; +import org.kakaoshare.backend.domain.order.entity.Order; + + +@Entity +@Getter +public class Payment extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long paymentId; + + @Column(nullable = false, length = 50) + private String method; + + @Column(nullable = false, precision = 12, scale = 2) + private BigDecimal totalPrice; + + @Column(nullable = false, precision = 12, scale = 2) + private BigDecimal purchasePrice; + + @Column(nullable = false, precision = 12, scale = 2) + private BigDecimal deliveryPrice; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "orders_id", nullable = false) + private Order order; +} diff --git a/src/main/java/org/kakaoshare/backend/domain/payment/repository/PaymentRepository.java b/src/main/java/org/kakaoshare/backend/domain/payment/repository/PaymentRepository.java new file mode 100644 index 000000000..016a1e1fd --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/payment/repository/PaymentRepository.java @@ -0,0 +1,8 @@ +package org.kakaoshare.backend.domain.payment.repository; + +import org.kakaoshare.backend.domain.payment.entity.Payment; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface PaymentRepository extends JpaRepository { +} diff --git a/src/main/java/org/kakaoshare/backend/domain/product/entity/Product.java b/src/main/java/org/kakaoshare/backend/domain/product/entity/Product.java new file mode 100644 index 000000000..cf29438a0 --- /dev/null +++ b/src/main/java/org/kakaoshare/backend/domain/product/entity/Product.java @@ -0,0 +1,89 @@ +package org.kakaoshare.backend.domain.product.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; +import java.math.BigDecimal; +import java.util.List; +import lombok.Getter; +import org.kakaoshare.backend.domain.base.entity.BaseTimeEntity; +import org.kakaoshare.backend.domain.hashtag.entity.ProductHashtag; +import org.kakaoshare.backend.domain.theme.entity.Theme; +import org.kakaoshare.backend.domain.wish.entity.Wish; +import org.kakaoshare.backend.domain.brand.entity.Brand; +import org.kakaoshare.backend.domain.funding.entity.Funding; +import org.kakaoshare.backend.domain.gift.entity.Gift; +import org.kakaoshare.backend.domain.option.entity.Option; +import org.kakaoshare.backend.domain.order.entity.Order; + + +@Entity +@Getter +public class Product extends BaseTimeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long productId; + + @Column(nullable = false) + private String name; + + @Column(nullable = false, precision = 12, scale = 2) + private BigDecimal price; + + @Column + private String photo; + + @Column(nullable = false, length = 50) + private String type; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "brand_id", nullable = false) + private Brand brand; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "product_detail_id", nullable = false) + private ProductDetail productDetail; + + @OneToMany(fetch = FetchType.LAZY) + @JoinColumn(name = "product_id") + private List