From 4bc6b0e87dbc4f2fd6d74ac97606c457aeba4db6 Mon Sep 17 00:00:00 2001 From: mrfoxygmfr Date: Sun, 23 Mar 2025 14:49:14 +0300 Subject: feat(db): add mappings --- .../ru/mrfoxygmfr/warehouse_accounting/db/models/Operation.java | 4 ++++ .../java/ru/mrfoxygmfr/warehouse_accounting/db/models/Partner.java | 6 ++++++ 2 files changed, 10 insertions(+) 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 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 contacts; } -- cgit mrf-deployment