diff options
author | mrfoxygmfr <mrfoxygmfr@sch9.ru> | 2025-03-23 14:49:14 +0300 |
---|---|---|
committer | mrfoxygmfr <mrfoxygmfr@sch9.ru> | 2025-03-23 14:49:14 +0300 |
commit | 4bc6b0e87dbc4f2fd6d74ac97606c457aeba4db6 (patch) | |
tree | 0aa1bbb932bc2ff6dd6ae5077f9ac96fe30888f9 | |
parent | 5b0b6fc434659f13c0ff1f898c4b5d7ce136d992 (diff) |
feat(db): add mappings
-rw-r--r-- | src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Operation.java | 4 | ||||
-rw-r--r-- | src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Partner.java | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Operation.java b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Operation.java index 72c2353..51b8bbd 100644 --- a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Operation.java +++ b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Operation.java @@ -4,6 +4,7 @@ import jakarta.persistence.*; import lombok.*; import java.sql.Timestamp; +import java.util.Set; @Entity @Table(name = "operations") @@ -55,4 +56,7 @@ public class Operation { @JoinColumn(name = "responsible_id", referencedColumnName = "id", insertable = false, updatable = false) @NonNull private PartnerContact responsible; + + @OneToMany(mappedBy = "operation") + private Set<OperationProducts> products; } diff --git a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Partner.java b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Partner.java index f801c42..78f203c 100644 --- a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Partner.java +++ b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Partner.java @@ -3,6 +3,8 @@ package ru.mrfoxygmfr.warehouse_accounting.db.models; import jakarta.persistence.*; import lombok.*; +import java.util.Set; + @Entity @Table(name = "partners") @Getter @@ -33,4 +35,8 @@ public class Partner { @Column(nullable = false, name = "address") @NonNull private String address; + + @OneToMany(mappedBy = "partner") + @ToString.Exclude + private Set<PartnerContact> contacts; } |