Subversion Repositories SmartDukaan

Rev

Rev 21924 | Rev 21988 | 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
 
143
	public Customer getCustomer() {
144
		return customer;
145
	}
146
	public void setCustomer(Customer customer) {
147
		this.customer = customer;
148
	}
149
	public int getId() {
150
		return id;
151
	}
152
	public void setId(int id) {
153
		this.id = id;
154
	}
155
	public int getFofoId() {
156
		return fofoId;
157
	}
158
	public void setFofoId(int fofoId) {
159
		this.fofoId = fofoId;
160
	}
161
	public int getCustomerId() {
162
		return customerId;
163
	}
164
	public void setCustomerId(int customerId) {
165
		this.customerId = customerId;
166
	}
167
	public int getCustomerAddressId() {
168
		return customerAddressId;
169
	}
170
	public void setCustomerAddressId(int customerAddressId) {
171
		this.customerAddressId = customerAddressId;
172
	}
173
	public float getTotalAmount() {
174
		return totalAmount;
175
	}
176
	public void setTotalAmount(float totalAmount) {
177
		this.totalAmount = totalAmount;
178
	}
179
	public String getInvoiceNumber() {
180
		return invoiceNumber;
181
	}
182
	public void setInvoiceNumber(String invoiceNumber) {
183
		this.invoiceNumber = invoiceNumber;
184
	}
185
	public LocalDateTime getCreateTimestamp() {
186
		return createTimestamp;
187
	}
188
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
189
		this.createTimestamp = createTimestamp;
190
	}
21924 ashik.ali 191
	@Override
21602 ashik.ali 192
	public String toString() {
21710 ashik.ali 193
		return "FofoOrder [id=" + id + ", fofoId=" + fofoId + ", customerId=" + customerId + ", customerAddressId="
194
				+ customerAddressId + ", totalAmount=" + totalAmount + ", invoiceNumber=" + invoiceNumber
21984 kshitij.so 195
				+ ", createTimestamp=" + createTimestamp + ", fofoLineItem=" + fofoLineItem + ", paymentOption="
196
				+ paymentOption + ", customer=" + customer + "]";
21602 ashik.ali 197
	}
198
 
21710 ashik.ali 199
 
21596 ashik.ali 200
}