Subversion Repositories SmartDukaan

Rev

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