1 | package com.example.fooddeliverysystem.model;
|
---|
2 |
|
---|
3 | import jakarta.persistence.*;
|
---|
4 | import lombok.AllArgsConstructor;
|
---|
5 | import lombok.Data;
|
---|
6 | import lombok.NoArgsConstructor;
|
---|
7 |
|
---|
8 | import java.sql.Timestamp;
|
---|
9 | import java.time.LocalDate;
|
---|
10 | import java.util.ArrayList;
|
---|
11 | import java.util.List;
|
---|
12 |
|
---|
13 | @Entity
|
---|
14 | @Table(name = "naracka")
|
---|
15 | @Data
|
---|
16 | @AllArgsConstructor
|
---|
17 | @NoArgsConstructor
|
---|
18 | @NamedStoredProcedureQuery(
|
---|
19 | name = "calculate_cost_of_order_food2",
|
---|
20 | procedureName = "calculate_cost_of_order_food2",
|
---|
21 | parameters = {
|
---|
22 | @StoredProcedureParameter(mode = ParameterMode.IN, type = Integer.class, name = "order_id")
|
---|
23 | }
|
---|
24 | )
|
---|
25 | public class Order {
|
---|
26 |
|
---|
27 | @Id
|
---|
28 | @Column(name = "naracka_id")
|
---|
29 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
30 | private Long orderId;
|
---|
31 |
|
---|
32 | @Column(name = "nacinplakjanje")
|
---|
33 | private String typeOfPayment;
|
---|
34 |
|
---|
35 | @Column(name = "status")
|
---|
36 | private String orderStatus;
|
---|
37 |
|
---|
38 | @Column(name = "datum_naracka")
|
---|
39 | private Timestamp orderDate;
|
---|
40 |
|
---|
41 | @ManyToOne
|
---|
42 | @JoinColumn(name = "dostavuvac_id")
|
---|
43 | private Deliver deliver;
|
---|
44 |
|
---|
45 | @ManyToOne
|
---|
46 | @JoinColumn(name = "id_mesto")
|
---|
47 | private SalePlace salePlace;
|
---|
48 |
|
---|
49 | @ManyToOne
|
---|
50 | @JoinColumn(name = "potrosuvac_id")
|
---|
51 | private Consumer consumer;
|
---|
52 |
|
---|
53 | @ManyToOne
|
---|
54 | @JoinColumn(name = "naplata_id")
|
---|
55 | private OrderPayment orderPayment;
|
---|
56 |
|
---|
57 | @Transient
|
---|
58 | private Integer orderCost;
|
---|
59 | public Order(String orderStatus, Timestamp orderDate, SalePlace salePlace, Consumer consumer) {
|
---|
60 | this.orderStatus = orderStatus;
|
---|
61 | this.orderDate = orderDate;
|
---|
62 | this.salePlace = salePlace;
|
---|
63 | this.consumer = consumer;
|
---|
64 |
|
---|
65 | }
|
---|
66 |
|
---|
67 | public Order(String typeOfPayment, String orderStatus, Timestamp orderDate, SalePlace salePlace, Consumer consumer) {
|
---|
68 | this.typeOfPayment = typeOfPayment;
|
---|
69 | this.orderStatus = orderStatus;
|
---|
70 | this.orderDate = orderDate;
|
---|
71 | this.salePlace = salePlace;
|
---|
72 | this.consumer = consumer;
|
---|
73 | }
|
---|
74 | }
|
---|