| 21714 |
ashik.ali |
1 |
package com.spice.profitmandi.dao.entity.fofo;
|
| 21596 |
ashik.ali |
2 |
|
|
|
3 |
import java.io.Serializable;
|
|
|
4 |
import java.time.LocalDateTime;
|
| 22243 |
ashik.ali |
5 |
import java.time.format.DateTimeFormatter;
|
| 21984 |
kshitij.so |
6 |
import java.util.List;
|
| 21596 |
ashik.ali |
7 |
|
| 21984 |
kshitij.so |
8 |
import javax.persistence.CascadeType;
|
| 21596 |
ashik.ali |
9 |
import javax.persistence.Column;
|
| 22009 |
ashik.ali |
10 |
import javax.persistence.Convert;
|
| 21596 |
ashik.ali |
11 |
import javax.persistence.Entity;
|
| 21984 |
kshitij.so |
12 |
import javax.persistence.FetchType;
|
| 21596 |
ashik.ali |
13 |
import javax.persistence.GeneratedValue;
|
|
|
14 |
import javax.persistence.GenerationType;
|
|
|
15 |
import javax.persistence.Id;
|
| 21984 |
kshitij.so |
16 |
import javax.persistence.JoinColumn;
|
|
|
17 |
import javax.persistence.ManyToOne;
|
| 21596 |
ashik.ali |
18 |
import javax.persistence.NamedQueries;
|
|
|
19 |
import javax.persistence.NamedQuery;
|
| 21984 |
kshitij.so |
20 |
import javax.persistence.OneToMany;
|
| 21596 |
ashik.ali |
21 |
import javax.persistence.Table;
|
|
|
22 |
|
| 22009 |
ashik.ali |
23 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
|
|
|
24 |
|
| 21596 |
ashik.ali |
25 |
@Entity
|
|
|
26 |
@Table(name="fofo.fofo_order", schema = "fofo")
|
|
|
27 |
@NamedQueries({
|
|
|
28 |
@NamedQuery(name = "FofoOrder.selectCount", query = "select count(fo) from FofoOrder fo"),
|
|
|
29 |
@NamedQuery(name = "FofoOrder.selectById", query = "select fo from FofoOrder fo where fo.id = :id"),
|
|
|
30 |
@NamedQuery(name = "FofoOrder.selectByFofoId", query = "select fo from FofoOrder fo where fo.fofoId = :fofoId"),
|
|
|
31 |
@NamedQuery(name = "FofoOrder.selectTotolAmountByFofoId", query = "select sum(fo.totalAmount) from FofoOrder fo where fo.fofoId = :fofoId group by fo.fofoId"),
|
|
|
32 |
@NamedQuery(name = "FofoOrder.selectByInvoiceNumber", query = "select fo from FofoOrder fo where fo.invoiceNumber = :invoiceNumber")
|
|
|
33 |
})
|
|
|
34 |
public class FofoOrder implements Serializable{
|
|
|
35 |
|
|
|
36 |
private static final long serialVersionUID = 1L;
|
|
|
37 |
|
|
|
38 |
@Id
|
|
|
39 |
@Column(name = "id")
|
|
|
40 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
41 |
private int id;
|
|
|
42 |
|
|
|
43 |
@Column(name = "fofo_id")
|
|
|
44 |
private int fofoId;
|
|
|
45 |
|
|
|
46 |
@Column(name = "customer_id")
|
|
|
47 |
private int customerId;
|
|
|
48 |
|
| 21710 |
ashik.ali |
49 |
@Column(name = "customer_address_id")
|
|
|
50 |
private int customerAddressId;
|
|
|
51 |
|
| 21596 |
ashik.ali |
52 |
@Column(name = "total_amount")
|
|
|
53 |
private float totalAmount;
|
|
|
54 |
|
| 21609 |
ashik.ali |
55 |
@Column(name = "invoice_number", length = 50)
|
| 21596 |
ashik.ali |
56 |
private String invoiceNumber;
|
|
|
57 |
|
| 22009 |
ashik.ali |
58 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
| 21596 |
ashik.ali |
59 |
@Column(name = "create_timestamp")
|
|
|
60 |
private LocalDateTime createTimestamp = LocalDateTime.now();
|
|
|
61 |
|
| 21984 |
kshitij.so |
62 |
@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
|
|
|
63 |
@JoinColumn(name="order_id",insertable=false,updatable=false,nullable=false)
|
|
|
64 |
private List<FofoLineItem> fofoLineItem;
|
| 21924 |
ashik.ali |
65 |
|
| 22009 |
ashik.ali |
66 |
|
| 21984 |
kshitij.so |
67 |
@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
|
|
|
68 |
@JoinColumn(name="order_id",insertable=false,updatable=false,nullable=false)
|
|
|
69 |
private List<PaymentOption> paymentOption;
|
|
|
70 |
|
|
|
71 |
public List<PaymentOption> getPaymentOption() {
|
|
|
72 |
return paymentOption;
|
|
|
73 |
}
|
|
|
74 |
public void setPaymentOption(List<PaymentOption> paymentOption) {
|
|
|
75 |
this.paymentOption = paymentOption;
|
|
|
76 |
}
|
|
|
77 |
public List<FofoLineItem> getFofoLineItem() {
|
|
|
78 |
return fofoLineItem;
|
|
|
79 |
}
|
|
|
80 |
public void setFofoLineItem(List<FofoLineItem> fofoLineItem) {
|
|
|
81 |
this.fofoLineItem = fofoLineItem;
|
|
|
82 |
}
|
|
|
83 |
@ManyToOne(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
|
|
|
84 |
@JoinColumn(name="customer_id",insertable=false,updatable=false,nullable=false, referencedColumnName="id")
|
|
|
85 |
private Customer customer;
|
|
|
86 |
|
| 21988 |
kshitij.so |
87 |
@ManyToOne(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
|
|
|
88 |
@JoinColumn(name="customer_address_id",insertable=false,updatable=false,nullable=false, referencedColumnName="id")
|
|
|
89 |
private CustomerAddress customerAddress;
|
|
|
90 |
|
|
|
91 |
public CustomerAddress getCustomerAddress() {
|
|
|
92 |
return customerAddress;
|
|
|
93 |
}
|
|
|
94 |
public void setCustomerAddress(CustomerAddress customerAddress) {
|
|
|
95 |
this.customerAddress = customerAddress;
|
|
|
96 |
}
|
| 21984 |
kshitij.so |
97 |
public Customer getCustomer() {
|
|
|
98 |
return customer;
|
|
|
99 |
}
|
|
|
100 |
public void setCustomer(Customer customer) {
|
|
|
101 |
this.customer = customer;
|
|
|
102 |
}
|
|
|
103 |
public int getId() {
|
|
|
104 |
return id;
|
|
|
105 |
}
|
|
|
106 |
public void setId(int id) {
|
|
|
107 |
this.id = id;
|
|
|
108 |
}
|
|
|
109 |
public int getFofoId() {
|
|
|
110 |
return fofoId;
|
|
|
111 |
}
|
|
|
112 |
public void setFofoId(int fofoId) {
|
|
|
113 |
this.fofoId = fofoId;
|
|
|
114 |
}
|
|
|
115 |
public int getCustomerId() {
|
|
|
116 |
return customerId;
|
|
|
117 |
}
|
|
|
118 |
public void setCustomerId(int customerId) {
|
|
|
119 |
this.customerId = customerId;
|
|
|
120 |
}
|
|
|
121 |
public int getCustomerAddressId() {
|
|
|
122 |
return customerAddressId;
|
|
|
123 |
}
|
|
|
124 |
public void setCustomerAddressId(int customerAddressId) {
|
|
|
125 |
this.customerAddressId = customerAddressId;
|
|
|
126 |
}
|
|
|
127 |
public float getTotalAmount() {
|
|
|
128 |
return totalAmount;
|
|
|
129 |
}
|
|
|
130 |
public void setTotalAmount(float totalAmount) {
|
|
|
131 |
this.totalAmount = totalAmount;
|
|
|
132 |
}
|
|
|
133 |
public String getInvoiceNumber() {
|
|
|
134 |
return invoiceNumber;
|
|
|
135 |
}
|
|
|
136 |
public void setInvoiceNumber(String invoiceNumber) {
|
|
|
137 |
this.invoiceNumber = invoiceNumber;
|
|
|
138 |
}
|
|
|
139 |
public LocalDateTime getCreateTimestamp() {
|
|
|
140 |
return createTimestamp;
|
|
|
141 |
}
|
|
|
142 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
|
|
143 |
this.createTimestamp = createTimestamp;
|
|
|
144 |
}
|
| 22009 |
ashik.ali |
145 |
|
| 22243 |
ashik.ali |
146 |
public String getFormattedDate(){
|
|
|
147 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
|
|
|
148 |
return this.createTimestamp.format(formatter);
|
|
|
149 |
}
|
| 22009 |
ashik.ali |
150 |
|
| 21924 |
ashik.ali |
151 |
@Override
|
| 22009 |
ashik.ali |
152 |
public int hashCode() {
|
|
|
153 |
final int prime = 31;
|
|
|
154 |
int result = 1;
|
|
|
155 |
result = prime * result + id;
|
|
|
156 |
return result;
|
|
|
157 |
}
|
|
|
158 |
@Override
|
|
|
159 |
public boolean equals(Object obj) {
|
|
|
160 |
if (this == obj)
|
|
|
161 |
return true;
|
|
|
162 |
if (obj == null)
|
|
|
163 |
return false;
|
|
|
164 |
if (getClass() != obj.getClass())
|
|
|
165 |
return false;
|
|
|
166 |
FofoOrder other = (FofoOrder) obj;
|
|
|
167 |
if (id != other.id)
|
|
|
168 |
return false;
|
|
|
169 |
return true;
|
|
|
170 |
}
|
|
|
171 |
@Override
|
| 21602 |
ashik.ali |
172 |
public String toString() {
|
| 21710 |
ashik.ali |
173 |
return "FofoOrder [id=" + id + ", fofoId=" + fofoId + ", customerId=" + customerId + ", customerAddressId="
|
|
|
174 |
+ customerAddressId + ", totalAmount=" + totalAmount + ", invoiceNumber=" + invoiceNumber
|
| 21984 |
kshitij.so |
175 |
+ ", createTimestamp=" + createTimestamp + ", fofoLineItem=" + fofoLineItem + ", paymentOption="
|
|
|
176 |
+ paymentOption + ", customer=" + customer + "]";
|
| 21602 |
ashik.ali |
177 |
}
|
|
|
178 |
|
| 21710 |
ashik.ali |
179 |
|
| 21596 |
ashik.ali |
180 |
}
|