Subversion Repositories SmartDukaan

Rev

Rev 21602 | Rev 21924 | 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
 
5
import javax.persistence.Column;
6
import javax.persistence.Entity;
7
import javax.persistence.EnumType;
8
import javax.persistence.Enumerated;
9
import javax.persistence.GeneratedValue;
10
import javax.persistence.GenerationType;
11
import javax.persistence.Id;
12
import javax.persistence.NamedQueries;
13
import javax.persistence.NamedQuery;
14
import javax.persistence.Table;
15
import javax.persistence.UniqueConstraint;
16
 
21714 ashik.ali 17
import com.spice.profitmandi.dao.enumuration.fofo.PaymentOptionType;
21596 ashik.ali 18
 
19
/**
20
 * This class basically contains api details
21
 * 
22
 * @author ashikali
23
 *
24
 */
25
@Entity
26
@Table(name="fofo.payment_option", schema = "fofo", uniqueConstraints = {@UniqueConstraint(columnNames = {"order_id","type"})})
27
@NamedQueries({
28
	@NamedQuery(name = "PaymentOption.selectById", query = "select po from PaymentOption po where po.id = :id"),
29
	@NamedQuery(name = "PaymentOption.selectByOrderId", query = "select po from PaymentOption po where po.orderId = :orderId"),
30
	@NamedQuery(name = "PaymentOption.selectTotalAmountByType", query = "select sum(po.amount) from PaymentOption po where po.type = :type group by po.type"),
31
	@NamedQuery(name = "PaymentOption.selectTotalAmountByOrderId", query = "select sum(po.amount) from PaymentOption po where po.orderId = :orderId group by po.orderId")
32
})
33
public class PaymentOption implements Serializable{
34
 
35
	private static final long serialVersionUID = 1L;
36
 
37
	public PaymentOption() {
38
	}
39
 
40
	@Id
41
	@Column(name="id")
42
	@GeneratedValue(strategy = GenerationType.IDENTITY)
43
	private int id;
44
 
45
	@Column(name = "order_id")
46
	private int orderId;
47
 
48
	@Enumerated(EnumType.STRING)
49
	@Column(name = "type")
50
	private PaymentOptionType type;
51
 
52
	@Column(name = "amount")
53
	private float amount;
54
 
55
	public int getId() {
56
		return id;
57
	}
58
	public void setId(int id) {
59
		this.id = id;
60
	}
61
	public int getOrderId() {
62
		return orderId;
63
	}
64
	public void setOrderId(int orderId) {
65
		this.orderId = orderId;
66
	}
67
	public PaymentOptionType getType() {
68
		return type;
69
	}
70
	public void setType(PaymentOptionType type) {
71
		this.type = type;
72
	}
73
	public float getAmount() {
74
		return amount;
75
	}
76
	public void setAmount(float amount) {
77
		this.amount = amount;
78
	}
21602 ashik.ali 79
	@Override
80
	public String toString() {
81
		return "PaymentOption [id=" + id + ", orderId=" + orderId + ", type=" + type + ", amount=" + amount + "]";
82
	}
21596 ashik.ali 83
 
21602 ashik.ali 84
 
85
 
21596 ashik.ali 86
}