Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
22352 ashik.ali 1
package com.spice.profitmandi.dao.entity.user;
2
 
3
import java.time.LocalDateTime;
4
 
5
import javax.persistence.Column;
6
import javax.persistence.Convert;
7
import javax.persistence.Entity;
8
import javax.persistence.GeneratedValue;
9
import javax.persistence.GenerationType;
10
import javax.persistence.Id;
11
import javax.persistence.Table;
12
 
13
import org.hibernate.annotations.UpdateTimestamp;
14
 
15
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
16
 
17
import in.shop2020.model.v1.user.CartStatus;
18
 
19
/**
20
 * This class basically contains cart details
21
 * 
22
 * @author ashikali
23
 *
24
 */
25
@Entity
26
@Table(name="user.cart", schema = "user")
27
 
28
public class Cart {
29
 
30
	@Id
31
	@Column(name="id", unique=true, updatable=false)
32
	@GeneratedValue(strategy = GenerationType.IDENTITY)
33
	private int id;
34
 
35
	@Column(name = "wallet_amount")
28653 amit.gupta 36
	private double walletAmount;
22352 ashik.ali 37
 
38
	@Column(name = "total_price")
28653 amit.gupta 39
	private double totalPrice;
22352 ashik.ali 40
 
41
	@Column(name = "cart_status")
42
	private CartStatus cartStatus;
43
 
44
	@Column(name = "address_id")
45
	private int addressId;
46
 
47
	@Column(name="checked_out_on", updatable = false)
48
	private LocalDateTime checkoutTimestamp = LocalDateTime.now();
49
 
50
	@Column(name="created_on", updatable = false)
51
	private LocalDateTime createTimestamp = LocalDateTime.now();
52
 
53
	@Column(name="updated_on")
54
	@UpdateTimestamp
55
	private LocalDateTime updateTimestamp = LocalDateTime.now();
56
 
57
 
58
	public int getId() {
59
		return id;
60
	}
61
 
62
	public void setId(int id) {
63
		this.id = id;
64
	}
65
 
66
 
67
 
28653 amit.gupta 68
	public double getWalletAmount() {
22352 ashik.ali 69
		return walletAmount;
70
	}
71
 
28653 amit.gupta 72
	public void setWalletAmount(double walletAmount) {
22352 ashik.ali 73
		this.walletAmount = walletAmount;
74
	}
75
 
28653 amit.gupta 76
	public double getTotalPrice() {
22352 ashik.ali 77
		return totalPrice;
78
	}
79
 
28653 amit.gupta 80
	public void setTotalPrice(double totalPrice) {
22352 ashik.ali 81
		this.totalPrice = totalPrice;
82
	}
83
 
84
	public CartStatus getCartStatus() {
85
		return cartStatus;
86
	}
87
 
88
	public void setCartStatus(CartStatus cartStatus) {
89
		this.cartStatus = cartStatus;
90
	}
91
 
92
	public int getAddressId() {
93
		return addressId;
94
	}
95
 
96
	public void setAddressId(int addressId) {
97
		this.addressId = addressId;
98
	}
99
 
100
	public LocalDateTime getCheckoutTimestamp() {
101
		return checkoutTimestamp;
102
	}
103
 
104
	public void setCheckoutTimestamp(LocalDateTime checkoutTimestamp) {
105
		this.checkoutTimestamp = checkoutTimestamp;
106
	}
107
 
108
	public LocalDateTime getCreateTimestamp() {
109
		return createTimestamp;
110
	}
111
 
112
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
113
		this.createTimestamp = createTimestamp;
114
	}
115
 
116
	public LocalDateTime getUpdateTimestamp() {
117
		return updateTimestamp;
118
	}
119
 
120
	public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
121
		this.updateTimestamp = updateTimestamp;
122
	}
123
 
124
	@Override
125
	public int hashCode() {
126
		final int prime = 31;
127
		int result = 1;
128
		result = prime * result + id;
129
		return result;
130
	}
131
 
132
	@Override
133
	public boolean equals(Object obj) {
134
		if (this == obj)
135
			return true;
136
		if (obj == null)
137
			return false;
138
		if (getClass() != obj.getClass())
139
			return false;
140
		Cart other = (Cart) obj;
141
		if (id != other.id)
142
			return false;
143
		return true;
144
	}
145
 
146
	@Override
147
	public String toString() {
148
		return "Cart [id=" + id + ", walletAmount=" + walletAmount + ", totalPrice=" + totalPrice + ", cartStatus="
149
				+ cartStatus + ", addressId=" + addressId + ", checkoutTimestamp=" + checkoutTimestamp
150
				+ ", createTimestamp=" + createTimestamp + ", updateTimestamp=" + updateTimestamp + "]";
151
	}
152
 
153
 
154
}