-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
25b2aa9
commit f947a38
Showing
8 changed files
with
181 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/net/skhu/tastyinventory_be/domain/inventory/Inventory.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,34 @@ | ||
package net.skhu.tastyinventory_be.domain.inventory; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import net.skhu.tastyinventory_be.domain.inventoryVolume.InventoryVolume; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@Entity | ||
public class Inventory { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String name; | ||
private String unit; | ||
|
||
@OneToMany(mappedBy = "inventory", cascade = CascadeType.ALL, orphanRemoval = true) | ||
private Set<InventoryVolume> inventoryVolumes = new HashSet<>(); | ||
|
||
|
||
@Builder | ||
public Inventory(Long id, String name, String unit, Set<InventoryVolume> inventoryVolumes) { | ||
this.id = id; | ||
this.name = name; | ||
this.unit = unit; | ||
this.inventoryVolumes = inventoryVolumes != null ? inventoryVolumes : new HashSet<>(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/net/skhu/tastyinventory_be/domain/inventory/InventoryRepository.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,7 @@ | ||
package net.skhu.tastyinventory_be.domain.inventory; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface InventoryRepository extends JpaRepository<Inventory, Long> { | ||
|
||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/net/skhu/tastyinventory_be/domain/inventoryVolume/InventoryVolume.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,53 @@ | ||
package net.skhu.tastyinventory_be.domain.inventoryVolume; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import net.skhu.tastyinventory_be.domain.inventory.Inventory; | ||
|
||
import java.util.Date; | ||
|
||
|
||
@Getter | ||
@NoArgsConstructor | ||
@Entity | ||
public class InventoryVolume { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Temporal(TemporalType.DATE) | ||
private Date weekStart; | ||
|
||
private Integer friInventory; | ||
private Integer sunInventory; | ||
private Integer monOrder; | ||
private Integer tueOrder; | ||
private Integer wedOrder; | ||
private Integer thuOrder; | ||
private Integer friOrder; | ||
private Integer satOrder; | ||
private Integer sunOrder; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "inventory_id") | ||
private Inventory inventory; | ||
|
||
@Builder | ||
public InventoryVolume(Long id, Date weekStart, Integer friInventory, Integer sumInventory, Integer monOrder, Integer tueOrder, Integer wedOrder, Integer thuOrder, Integer friOrder, Integer satOrder, Integer sunOrder, Inventory inventory) { | ||
this.id = id; | ||
this.weekStart = weekStart; | ||
this.friInventory = friInventory; | ||
this.sunInventory = sumInventory; | ||
this.monOrder = monOrder; | ||
this.tueOrder = tueOrder; | ||
this.wedOrder = wedOrder; | ||
this.thuOrder = thuOrder; | ||
this.friOrder = friOrder; | ||
this.satOrder = satOrder; | ||
this.sunOrder = sunOrder; | ||
this.inventory = inventory; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...ain/java/net/skhu/tastyinventory_be/domain/inventoryVolume/InventoryVolumeRepository.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,6 @@ | ||
package net.skhu.tastyinventory_be.domain.inventoryVolume; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface InventoryVolumeRepository extends JpaRepository<InventoryVolume, Long> { | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/net/skhu/tastyinventory_be/domain/menu/Menu.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,32 @@ | ||
package net.skhu.tastyinventory_be.domain.menu; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import net.skhu.tastyinventory_be.domain.recipe.Recipe; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@Entity | ||
public class Menu { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String name; | ||
|
||
@OneToMany(mappedBy = "menu", cascade = CascadeType.ALL, orphanRemoval = true) | ||
private Set<Recipe> recipes = new HashSet<>(); | ||
|
||
@Builder | ||
public Menu(Long id, String name) { | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/net/skhu/tastyinventory_be/domain/menu/MenuRepository.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,6 @@ | ||
package net.skhu.tastyinventory_be.domain.menu; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface MenuRepository extends JpaRepository<Menu, Long> { | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/net/skhu/tastyinventory_be/domain/recipe/Recipe.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,36 @@ | ||
package net.skhu.tastyinventory_be.domain.recipe; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import net.skhu.tastyinventory_be.domain.inventory.Inventory; | ||
import net.skhu.tastyinventory_be.domain.menu.Menu; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@Entity | ||
public class Recipe { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "menu_id") | ||
private Menu menu; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "inventory_id") | ||
private Inventory inventory; | ||
|
||
private Integer usage; //재료 사용량 | ||
|
||
@Builder | ||
public Recipe(Long id, Menu menu, Inventory inventory, Integer usage) { | ||
this.id = id; | ||
this.menu = menu; | ||
this.inventory = inventory; | ||
this.usage = usage; | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/net/skhu/tastyinventory_be/domain/recipe/RecipeRepository.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,7 @@ | ||
package net.skhu.tastyinventory_be.domain.recipe; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface RecipeRepository extends JpaRepository<Recipe, Long> { | ||
|
||
} |