Subversion Repositories SmartDukaan

Rev

Rev 21984 | Rev 22009 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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