source: src/main/java/com/example/fooddeliverysystem/model/Order.java

Last change on this file was 8d11f8c, checked in by jovanmanchev <jovanmanchev3003@…>, 20 months ago

code added, trial 2

  • Property mode set to 100644
File size: 1.9 KB
Line 
1package com.example.fooddeliverysystem.model;
2
3import jakarta.persistence.*;
4import lombok.AllArgsConstructor;
5import lombok.Data;
6import lombok.NoArgsConstructor;
7
8import java.sql.Timestamp;
9import java.time.LocalDate;
10import java.util.ArrayList;
11import 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)
25public 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}
Note: See TracBrowser for help on using the repository browser.