Skip to content

Commit

Permalink
feat: #10 product entity
Browse files Browse the repository at this point in the history
  • Loading branch information
sominyun committed Mar 2, 2024
1 parent 70bb951 commit 1bffae0
Show file tree
Hide file tree
Showing 8 changed files with 202 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/com/backend/soullive_a/constant/AgeType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.backend.soullive_a.constant;

public enum AgeType {
TEN,TWENTY,THIRTEEN, FOURTEEN, FIFTEEN, SIXTEEN
}
5 changes: 5 additions & 0 deletions src/main/java/com/backend/soullive_a/constant/GenderType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.backend.soullive_a.constant;

public enum GenderType {
Male, Female
}
29 changes: 29 additions & 0 deletions src/main/java/com/backend/soullive_a/entity/Age.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.backend.soullive_a.entity;

import com.backend.soullive_a.constant.AgeType;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.annotations.DynamicInsert;

@Slf4j
@Entity
@Table(name = "AGE")
@Builder
@Getter
@DynamicInsert
@AllArgsConstructor
@NoArgsConstructor
public class Age {
@Id
@GeneratedValue
@Column(name = "AGE_ID")
private Long id;

@Enumerated(EnumType.STRING)
@Column(name = "AGE_TYPE")
private AgeType ageType;
}
27 changes: 27 additions & 0 deletions src/main/java/com/backend/soullive_a/entity/BrandImage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.backend.soullive_a.entity;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.annotations.DynamicInsert;

@Slf4j
@Entity
@Table(name = "BRAND_IMAGE")
@Builder
@Getter
@DynamicInsert
@AllArgsConstructor
@NoArgsConstructor
public class BrandImage {
@Id
@GeneratedValue
@Column(name = "BRAND_IMAGE_ID")
private Long id;

@Column(name = "BRAND_IMAGE")
private String brandImage;
}
29 changes: 29 additions & 0 deletions src/main/java/com/backend/soullive_a/entity/Gender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.backend.soullive_a.entity;

import com.backend.soullive_a.constant.GenderType;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.annotations.DynamicInsert;

@Slf4j
@Entity
@Table(name = "GENDER")
@Builder
@Getter
@DynamicInsert
@AllArgsConstructor
@NoArgsConstructor
public class Gender {
@Id
@GeneratedValue
@Column(name = "GENDER_ID")
private Long id;

@Enumerated(EnumType.STRING)
@Column(name = "GENDER")
private GenderType gender;
}
54 changes: 54 additions & 0 deletions src/main/java/com/backend/soullive_a/entity/Product.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.backend.soullive_a.entity;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.annotations.DynamicInsert;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@Entity
@Table(name = "PRODUCT")
@Builder
@Getter
@DynamicInsert
@AllArgsConstructor
@NoArgsConstructor
public class Product {
@Id
@GeneratedValue
@Column(name = "PRODUCT_ID")
private Long id;

@Column(name = "COMPANY", length = 100)
private String company;

@Column(name = "BRAND", length = 100)
private String brand;

@OneToMany(mappedBy = "PRODUCT")
private List<BrandImage> brandImages = new ArrayList<>();

@Column(name = "PRODUCT", length = 100)
private String product;

@Column(name = "CHARACTERISTIC")
private String characteristic;

@OneToMany(mappedBy = "PRODUCT_IMAGE")
private List<ProductImage> productImages = new ArrayList<>();

@OneToMany(mappedBy = "GENDER")
private List<Gender> genders = new ArrayList<>();

@OneToMany(mappedBy = "AGE")
private List<Age> ages = new ArrayList<>();

@OneToMany(mappedBy = "range")
private List<Range> ranges = new ArrayList<>();
}
27 changes: 27 additions & 0 deletions src/main/java/com/backend/soullive_a/entity/ProductImage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.backend.soullive_a.entity;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.annotations.DynamicInsert;

@Slf4j
@Entity
@Table(name = "PRODUCT_IMAGE")
@Builder
@Getter
@DynamicInsert
@AllArgsConstructor
@NoArgsConstructor
public class ProductImage {
@Id
@GeneratedValue
@Column(name = "PRODUCT_ID")
private Long id;

@Column(name = "PRODUCT_IMAGE")
private String productImage;
}
26 changes: 26 additions & 0 deletions src/main/java/com/backend/soullive_a/entity/Range.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.backend.soullive_a.entity;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.annotations.DynamicInsert;

@Slf4j
@Entity(name = "RANGE")
@Builder
@Getter
@DynamicInsert
@AllArgsConstructor
@NoArgsConstructor
public class Range {
@Id
@GeneratedValue
@Column(name = "RANGE_ID")
private Long id;

@Column(name = "RANGE")
private String rangeType;
}

0 comments on commit 1bffae0

Please sign in to comment.