| 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")
|
|
|
36 |
private float walletAmount;
|
|
|
37 |
|
|
|
38 |
@Column(name = "total_price")
|
|
|
39 |
private float totalPrice;
|
|
|
40 |
|
|
|
41 |
@Column(name = "cart_status")
|
|
|
42 |
private CartStatus cartStatus;
|
|
|
43 |
|
|
|
44 |
@Column(name = "address_id")
|
|
|
45 |
private int addressId;
|
|
|
46 |
|
|
|
47 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
|
|
48 |
@Column(name="checked_out_on", updatable = false)
|
|
|
49 |
private LocalDateTime checkoutTimestamp = LocalDateTime.now();
|
|
|
50 |
|
|
|
51 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
|
|
52 |
@Column(name="created_on", updatable = false)
|
|
|
53 |
private LocalDateTime createTimestamp = LocalDateTime.now();
|
|
|
54 |
|
|
|
55 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
|
|
56 |
@Column(name="updated_on")
|
|
|
57 |
@UpdateTimestamp
|
|
|
58 |
private LocalDateTime updateTimestamp = LocalDateTime.now();
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
public int getId() {
|
|
|
62 |
return id;
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
public void setId(int id) {
|
|
|
66 |
this.id = id;
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
|
71 |
public float getWalletAmount() {
|
|
|
72 |
return walletAmount;
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
public void setWalletAmount(float walletAmount) {
|
|
|
76 |
this.walletAmount = walletAmount;
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
public float getTotalPrice() {
|
|
|
80 |
return totalPrice;
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
public void setTotalPrice(float totalPrice) {
|
|
|
84 |
this.totalPrice = totalPrice;
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
public CartStatus getCartStatus() {
|
|
|
88 |
return cartStatus;
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
public void setCartStatus(CartStatus cartStatus) {
|
|
|
92 |
this.cartStatus = cartStatus;
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
public int getAddressId() {
|
|
|
96 |
return addressId;
|
|
|
97 |
}
|
|
|
98 |
|
|
|
99 |
public void setAddressId(int addressId) {
|
|
|
100 |
this.addressId = addressId;
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
public LocalDateTime getCheckoutTimestamp() {
|
|
|
104 |
return checkoutTimestamp;
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
public void setCheckoutTimestamp(LocalDateTime checkoutTimestamp) {
|
|
|
108 |
this.checkoutTimestamp = checkoutTimestamp;
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
public LocalDateTime getCreateTimestamp() {
|
|
|
112 |
return createTimestamp;
|
|
|
113 |
}
|
|
|
114 |
|
|
|
115 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
|
|
116 |
this.createTimestamp = createTimestamp;
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
public LocalDateTime getUpdateTimestamp() {
|
|
|
120 |
return updateTimestamp;
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
|
|
|
124 |
this.updateTimestamp = updateTimestamp;
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
@Override
|
|
|
128 |
public int hashCode() {
|
|
|
129 |
final int prime = 31;
|
|
|
130 |
int result = 1;
|
|
|
131 |
result = prime * result + id;
|
|
|
132 |
return result;
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
@Override
|
|
|
136 |
public boolean equals(Object obj) {
|
|
|
137 |
if (this == obj)
|
|
|
138 |
return true;
|
|
|
139 |
if (obj == null)
|
|
|
140 |
return false;
|
|
|
141 |
if (getClass() != obj.getClass())
|
|
|
142 |
return false;
|
|
|
143 |
Cart other = (Cart) obj;
|
|
|
144 |
if (id != other.id)
|
|
|
145 |
return false;
|
|
|
146 |
return true;
|
|
|
147 |
}
|
|
|
148 |
|
|
|
149 |
@Override
|
|
|
150 |
public String toString() {
|
|
|
151 |
return "Cart [id=" + id + ", walletAmount=" + walletAmount + ", totalPrice=" + totalPrice + ", cartStatus="
|
|
|
152 |
+ cartStatus + ", addressId=" + addressId + ", checkoutTimestamp=" + checkoutTimestamp
|
|
|
153 |
+ ", createTimestamp=" + createTimestamp + ", updateTimestamp=" + updateTimestamp + "]";
|
|
|
154 |
}
|
|
|
155 |
|
|
|
156 |
|
|
|
157 |
}
|