main
Last change
on this file was 1bd8d1e, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 23 months ago |
Added views and functionalities for deliveryman, warehouseman and admin
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | package com.example.autopartz.model;
|
---|
2 |
|
---|
3 | import lombok.Getter;
|
---|
4 | import lombok.RequiredArgsConstructor;
|
---|
5 | import lombok.Setter;
|
---|
6 | import lombok.ToString;
|
---|
7 | import org.hibernate.Hibernate;
|
---|
8 |
|
---|
9 | import javax.persistence.*;
|
---|
10 | import java.time.LocalDateTime;
|
---|
11 | import java.util.List;
|
---|
12 | import java.util.Objects;
|
---|
13 |
|
---|
14 | @Entity
|
---|
15 | @Getter
|
---|
16 | @Setter
|
---|
17 | @ToString
|
---|
18 | @RequiredArgsConstructor
|
---|
19 | @Table(name = "order_table")
|
---|
20 | public class Order {
|
---|
21 | @Id
|
---|
22 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
23 | @Column(name = "ID_order")
|
---|
24 | Integer orderid;
|
---|
25 | String order_status;
|
---|
26 | @Column(name = "order_date")
|
---|
27 | LocalDateTime date;
|
---|
28 | @JoinColumn(name = "id_user")
|
---|
29 | @ManyToOne
|
---|
30 | Client user;
|
---|
31 | @ManyToMany
|
---|
32 | @JoinTable(name = "order_contains_part", joinColumns =
|
---|
33 | @JoinColumn(name = "id_order"),
|
---|
34 | inverseJoinColumns = @JoinColumn(name = "id_part"))
|
---|
35 | @ToString.Exclude
|
---|
36 | List<Part> partList;
|
---|
37 |
|
---|
38 | public Order(Client user) {
|
---|
39 | this.order_status = "created";
|
---|
40 | this.user = user;
|
---|
41 | this.date = LocalDateTime.now();
|
---|
42 | }
|
---|
43 |
|
---|
44 | @Override
|
---|
45 | public boolean equals(Object o) {
|
---|
46 | if (this == o) return true;
|
---|
47 | if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
---|
48 | Order order = (Order) o;
|
---|
49 | return orderid != null && Objects.equals(orderid, order.orderid);
|
---|
50 | }
|
---|
51 |
|
---|
52 | @Override
|
---|
53 | public int hashCode() {
|
---|
54 | return getClass().hashCode();
|
---|
55 | }
|
---|
56 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.