| 21720 |
ashik.ali |
1 |
package com.spice.profitmandi.dao.entity.dtr;
|
| 21545 |
ashik.ali |
2 |
|
|
|
3 |
import java.io.Serializable;
|
|
|
4 |
import java.time.LocalDateTime;
|
|
|
5 |
|
|
|
6 |
import javax.persistence.Column;
|
|
|
7 |
import javax.persistence.Entity;
|
|
|
8 |
import javax.persistence.EnumType;
|
|
|
9 |
import javax.persistence.Enumerated;
|
|
|
10 |
import javax.persistence.Id;
|
|
|
11 |
import javax.persistence.NamedQueries;
|
|
|
12 |
import javax.persistence.NamedQuery;
|
|
|
13 |
import javax.persistence.Table;
|
|
|
14 |
import javax.persistence.UniqueConstraint;
|
|
|
15 |
|
| 21720 |
ashik.ali |
16 |
import com.spice.profitmandi.dao.enumuration.dtr.RetailerType;
|
|
|
17 |
import com.spice.profitmandi.dao.enumuration.dtr.SaleValue;
|
| 21545 |
ashik.ali |
18 |
|
|
|
19 |
/**
|
|
|
20 |
* This class basically contains api details
|
|
|
21 |
*
|
|
|
22 |
* @author ashikali
|
|
|
23 |
*
|
|
|
24 |
*/
|
|
|
25 |
@Entity
|
| 21720 |
ashik.ali |
26 |
@Table(name="dtr.retailer", schema = "dtr", uniqueConstraints = {@UniqueConstraint(columnNames = {"number","type"})})
|
| 21545 |
ashik.ali |
27 |
@NamedQueries({
|
|
|
28 |
@NamedQuery(name = "Retailer.selectCount", query = "select count(r) from Retailer r"),
|
|
|
29 |
@NamedQuery(name = "Retailer.selectAll",query="select r from Retailer r"),
|
|
|
30 |
@NamedQuery(name = "Retailer.selectById",query="select r from Retailer r where r.id= :id"),
|
|
|
31 |
@NamedQuery(name = "Retailer.selectByName",query="select r from Retailer r where r.name= :name"),
|
|
|
32 |
@NamedQuery(name = "Retailer.selectCountByNumberAndType",query="select count(r) from Retailer r where r.number= :number and r.type= :type"),
|
|
|
33 |
@NamedQuery(name = "Retailer.selectCountByDocumentId", query="select count(r) from Retailer r where r.documentId= :documentId"),
|
|
|
34 |
@NamedQuery(name = "Retailer.selectCountByName", query = "select count(r) from Retailer r where r.name= :name"),
|
|
|
35 |
@NamedQuery(name = "Retailer.selectCountById", query = "select count(r) from Retailer r where r.id= :id"),
|
|
|
36 |
@NamedQuery(name = "Retailer.deleteById",query="delete from Retailer r where r.id= :id"),
|
| 21559 |
ashik.ali |
37 |
@NamedQuery(name = "Retailer.selectDocumentById", query = "select d from Retailer r join Document d on d.id = r.documentId where r.id = :id"),
|
| 21566 |
ashik.ali |
38 |
@NamedQuery(
|
|
|
39 |
name = "Retailer.selectFofoIdAndEmailIdByEmailId",
|
|
|
40 |
query = "select r.id, u.emailId from User u join UserAccounts ua on ua.user_id = u.id join Retailer r on r.id = ua.account_key where u.emailId = :emailId and ua.account_type = 'saholic' and r.fofo = true")
|
| 21545 |
ashik.ali |
41 |
})
|
|
|
42 |
public class Retailer implements Serializable{
|
|
|
43 |
|
|
|
44 |
private static final long serialVersionUID = 1L;
|
|
|
45 |
|
|
|
46 |
public Retailer() {
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
@Id
|
|
|
50 |
@Column(name = "id", unique=true, updatable=false)
|
|
|
51 |
private int id;
|
|
|
52 |
|
|
|
53 |
@Column(name = "name")
|
|
|
54 |
private String name;
|
|
|
55 |
|
|
|
56 |
@Column(name = "number", length = 128)
|
|
|
57 |
private String number;
|
|
|
58 |
|
|
|
59 |
@Column(name = "type")
|
|
|
60 |
@Enumerated(EnumType.STRING)
|
|
|
61 |
private RetailerType type;
|
|
|
62 |
|
|
|
63 |
@Column(name = "monthly_sale_value")
|
|
|
64 |
private SaleValue monthlySaleValue;
|
|
|
65 |
|
|
|
66 |
@Column(name = "smartphone_sale_value")
|
|
|
67 |
private SaleValue smartphoneSaleValue;
|
|
|
68 |
|
|
|
69 |
@Column(name = "recharge", columnDefinition="tinyint(1) default 0")
|
|
|
70 |
private boolean recharge;
|
|
|
71 |
|
|
|
72 |
@Column(name = "mobile", columnDefinition="tinyint(1) default 0")
|
|
|
73 |
private boolean mobile;
|
|
|
74 |
|
|
|
75 |
@Column(name = "accessories", columnDefinition="tinyint(1) default 0")
|
|
|
76 |
private boolean accessories;
|
|
|
77 |
|
|
|
78 |
@Column(name = "other1", length = 128)
|
|
|
79 |
private String other1;
|
|
|
80 |
|
|
|
81 |
@Column(name = "other2", length = 128)
|
|
|
82 |
private String other2;
|
|
|
83 |
|
|
|
84 |
@Column(name = "self_pickup", columnDefinition="tinyint(1) default 0")
|
|
|
85 |
private boolean selfPickup;
|
|
|
86 |
|
|
|
87 |
@Column(name = "active", columnDefinition = "tinyint(1) default 0")
|
|
|
88 |
private boolean active;
|
|
|
89 |
|
|
|
90 |
@Column(name = "migrated", columnDefinition = "tinyint(1) default 0")
|
|
|
91 |
private boolean migrated;
|
|
|
92 |
|
|
|
93 |
@Column(name="create_timestamp", updatable = false)
|
|
|
94 |
private LocalDateTime createTimestamp = LocalDateTime.now();
|
|
|
95 |
|
|
|
96 |
@Column(name="update_timestamp")
|
|
|
97 |
private LocalDateTime updateTimestamp = LocalDateTime.now();
|
|
|
98 |
|
|
|
99 |
@Column(name = "document_id")
|
|
|
100 |
private int documentId;
|
|
|
101 |
|
|
|
102 |
@Column(name = "current_address_id")
|
|
|
103 |
private int currentAddressId;
|
|
|
104 |
|
| 21688 |
ashik.ali |
105 |
@Column(name = "fofo", columnDefinition = "tinyint(1) default 0")
|
| 21566 |
ashik.ali |
106 |
private boolean fofo;
|
|
|
107 |
|
| 21545 |
ashik.ali |
108 |
public int getId() {
|
|
|
109 |
return id;
|
|
|
110 |
}
|
|
|
111 |
public void setId(int id) {
|
|
|
112 |
this.id = id;
|
|
|
113 |
}
|
|
|
114 |
public void setName(String name) {
|
|
|
115 |
this.name = name;
|
|
|
116 |
}
|
|
|
117 |
public String getName() {
|
|
|
118 |
return name;
|
|
|
119 |
}
|
|
|
120 |
|
|
|
121 |
public String getNumber() {
|
|
|
122 |
return number;
|
|
|
123 |
}
|
|
|
124 |
public void setNumber(String number) {
|
|
|
125 |
this.number = number;
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
public SaleValue getMonthlySaleValue() {
|
|
|
129 |
return monthlySaleValue;
|
|
|
130 |
}
|
|
|
131 |
public void setMonthlySaleValue(SaleValue monthlySaleValue) {
|
|
|
132 |
this.monthlySaleValue = monthlySaleValue;
|
|
|
133 |
}
|
|
|
134 |
public SaleValue getSmartphoneSaleValue() {
|
|
|
135 |
return smartphoneSaleValue;
|
|
|
136 |
}
|
|
|
137 |
public void setSmartphoneSaleValue(SaleValue smartphoneSaleValue) {
|
|
|
138 |
this.smartphoneSaleValue = smartphoneSaleValue;
|
|
|
139 |
}
|
|
|
140 |
|
|
|
141 |
public boolean isRecharge() {
|
|
|
142 |
return recharge;
|
|
|
143 |
}
|
|
|
144 |
public void setRecharge(boolean recharge) {
|
|
|
145 |
this.recharge = recharge;
|
|
|
146 |
}
|
|
|
147 |
public boolean isMobile() {
|
|
|
148 |
return mobile;
|
|
|
149 |
}
|
|
|
150 |
public void setMobile(boolean mobile) {
|
|
|
151 |
this.mobile = mobile;
|
|
|
152 |
}
|
|
|
153 |
public boolean isAccessories() {
|
|
|
154 |
return accessories;
|
|
|
155 |
}
|
|
|
156 |
public void setAccessories(boolean accessories) {
|
|
|
157 |
this.accessories = accessories;
|
|
|
158 |
}
|
|
|
159 |
public String getOther1() {
|
|
|
160 |
return other1;
|
|
|
161 |
}
|
|
|
162 |
public void setOther1(String other1) {
|
|
|
163 |
this.other1 = other1;
|
|
|
164 |
}
|
|
|
165 |
public String getOther2() {
|
|
|
166 |
return other2;
|
|
|
167 |
}
|
|
|
168 |
public void setOther2(String other2) {
|
|
|
169 |
this.other2 = other2;
|
|
|
170 |
}
|
|
|
171 |
public void setType(RetailerType type) {
|
|
|
172 |
this.type = type;
|
|
|
173 |
}
|
|
|
174 |
public RetailerType getType() {
|
|
|
175 |
return type;
|
|
|
176 |
}
|
|
|
177 |
|
|
|
178 |
public int getDocumentId() {
|
|
|
179 |
return documentId;
|
|
|
180 |
}
|
|
|
181 |
public void setDocumentId(int documentId) {
|
|
|
182 |
this.documentId = documentId;
|
|
|
183 |
}
|
|
|
184 |
|
|
|
185 |
public void setCurrentAddressId(int currentAddressId) {
|
|
|
186 |
this.currentAddressId = currentAddressId;
|
|
|
187 |
}
|
|
|
188 |
public int getCurrentAddressId() {
|
|
|
189 |
return currentAddressId;
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
public boolean isSelfPickup() {
|
|
|
193 |
return selfPickup;
|
|
|
194 |
}
|
|
|
195 |
public void setSelfPickup(boolean selfPickup) {
|
|
|
196 |
this.selfPickup = selfPickup;
|
|
|
197 |
}
|
|
|
198 |
|
|
|
199 |
public boolean isActive() {
|
|
|
200 |
return active;
|
|
|
201 |
}
|
|
|
202 |
public void setActive(boolean active) {
|
|
|
203 |
this.active = active;
|
|
|
204 |
}
|
|
|
205 |
|
|
|
206 |
public boolean isMigrated() {
|
|
|
207 |
return migrated;
|
|
|
208 |
}
|
|
|
209 |
public void setMigrated(boolean migrated) {
|
|
|
210 |
this.migrated = migrated;
|
|
|
211 |
}
|
|
|
212 |
|
|
|
213 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
|
|
214 |
this.createTimestamp = createTimestamp;
|
|
|
215 |
}
|
|
|
216 |
public LocalDateTime getCreateTimestamp() {
|
|
|
217 |
return createTimestamp;
|
|
|
218 |
}
|
|
|
219 |
|
|
|
220 |
public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
|
|
|
221 |
this.updateTimestamp = updateTimestamp;
|
|
|
222 |
}
|
|
|
223 |
public LocalDateTime getUpdateTimestamp() {
|
|
|
224 |
return updateTimestamp;
|
|
|
225 |
}
|
|
|
226 |
|
| 21566 |
ashik.ali |
227 |
public boolean isFofo() {
|
|
|
228 |
return fofo;
|
|
|
229 |
}
|
|
|
230 |
public void setFofo(boolean fofo) {
|
|
|
231 |
this.fofo = fofo;
|
|
|
232 |
}
|
| 21924 |
ashik.ali |
233 |
|
|
|
234 |
|
| 21602 |
ashik.ali |
235 |
@Override
|
| 21924 |
ashik.ali |
236 |
public int hashCode() {
|
|
|
237 |
final int prime = 31;
|
|
|
238 |
int result = 1;
|
|
|
239 |
result = prime * result + (accessories ? 1231 : 1237);
|
|
|
240 |
result = prime * result + (active ? 1231 : 1237);
|
|
|
241 |
result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
|
|
|
242 |
result = prime * result + currentAddressId;
|
|
|
243 |
result = prime * result + documentId;
|
|
|
244 |
result = prime * result + (fofo ? 1231 : 1237);
|
|
|
245 |
result = prime * result + id;
|
|
|
246 |
result = prime * result + (migrated ? 1231 : 1237);
|
|
|
247 |
result = prime * result + (mobile ? 1231 : 1237);
|
|
|
248 |
result = prime * result + ((monthlySaleValue == null) ? 0 : monthlySaleValue.hashCode());
|
|
|
249 |
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
|
|
250 |
result = prime * result + ((number == null) ? 0 : number.hashCode());
|
|
|
251 |
result = prime * result + ((other1 == null) ? 0 : other1.hashCode());
|
|
|
252 |
result = prime * result + ((other2 == null) ? 0 : other2.hashCode());
|
|
|
253 |
result = prime * result + (recharge ? 1231 : 1237);
|
|
|
254 |
result = prime * result + (selfPickup ? 1231 : 1237);
|
|
|
255 |
result = prime * result + ((smartphoneSaleValue == null) ? 0 : smartphoneSaleValue.hashCode());
|
|
|
256 |
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
|
|
257 |
result = prime * result + ((updateTimestamp == null) ? 0 : updateTimestamp.hashCode());
|
|
|
258 |
return result;
|
|
|
259 |
}
|
|
|
260 |
@Override
|
|
|
261 |
public boolean equals(Object obj) {
|
|
|
262 |
if (this == obj)
|
|
|
263 |
return true;
|
|
|
264 |
if (obj == null)
|
|
|
265 |
return false;
|
|
|
266 |
if (getClass() != obj.getClass())
|
|
|
267 |
return false;
|
|
|
268 |
Retailer other = (Retailer) obj;
|
|
|
269 |
if (accessories != other.accessories)
|
|
|
270 |
return false;
|
|
|
271 |
if (active != other.active)
|
|
|
272 |
return false;
|
|
|
273 |
if (createTimestamp == null) {
|
|
|
274 |
if (other.createTimestamp != null)
|
|
|
275 |
return false;
|
|
|
276 |
} else if (!createTimestamp.equals(other.createTimestamp))
|
|
|
277 |
return false;
|
|
|
278 |
if (currentAddressId != other.currentAddressId)
|
|
|
279 |
return false;
|
|
|
280 |
if (documentId != other.documentId)
|
|
|
281 |
return false;
|
|
|
282 |
if (fofo != other.fofo)
|
|
|
283 |
return false;
|
|
|
284 |
if (id != other.id)
|
|
|
285 |
return false;
|
|
|
286 |
if (migrated != other.migrated)
|
|
|
287 |
return false;
|
|
|
288 |
if (mobile != other.mobile)
|
|
|
289 |
return false;
|
|
|
290 |
if (monthlySaleValue != other.monthlySaleValue)
|
|
|
291 |
return false;
|
|
|
292 |
if (name == null) {
|
|
|
293 |
if (other.name != null)
|
|
|
294 |
return false;
|
|
|
295 |
} else if (!name.equals(other.name))
|
|
|
296 |
return false;
|
|
|
297 |
if (number == null) {
|
|
|
298 |
if (other.number != null)
|
|
|
299 |
return false;
|
|
|
300 |
} else if (!number.equals(other.number))
|
|
|
301 |
return false;
|
|
|
302 |
if (other1 == null) {
|
|
|
303 |
if (other.other1 != null)
|
|
|
304 |
return false;
|
|
|
305 |
} else if (!other1.equals(other.other1))
|
|
|
306 |
return false;
|
|
|
307 |
if (other2 == null) {
|
|
|
308 |
if (other.other2 != null)
|
|
|
309 |
return false;
|
|
|
310 |
} else if (!other2.equals(other.other2))
|
|
|
311 |
return false;
|
|
|
312 |
if (recharge != other.recharge)
|
|
|
313 |
return false;
|
|
|
314 |
if (selfPickup != other.selfPickup)
|
|
|
315 |
return false;
|
|
|
316 |
if (smartphoneSaleValue != other.smartphoneSaleValue)
|
|
|
317 |
return false;
|
|
|
318 |
if (type != other.type)
|
|
|
319 |
return false;
|
|
|
320 |
if (updateTimestamp == null) {
|
|
|
321 |
if (other.updateTimestamp != null)
|
|
|
322 |
return false;
|
|
|
323 |
} else if (!updateTimestamp.equals(other.updateTimestamp))
|
|
|
324 |
return false;
|
|
|
325 |
return true;
|
|
|
326 |
}
|
|
|
327 |
@Override
|
| 21602 |
ashik.ali |
328 |
public String toString() {
|
|
|
329 |
return "Retailer [id=" + id + ", name=" + name + ", number=" + number + ", type=" + type + ", monthlySaleValue="
|
|
|
330 |
+ monthlySaleValue + ", smartphoneSaleValue=" + smartphoneSaleValue + ", recharge=" + recharge
|
|
|
331 |
+ ", mobile=" + mobile + ", accessories=" + accessories + ", other1=" + other1 + ", other2=" + other2
|
|
|
332 |
+ ", selfPickup=" + selfPickup + ", active=" + active + ", migrated=" + migrated + ", createTimestamp="
|
| 21693 |
ashik.ali |
333 |
+ createTimestamp + ", updateTimestamp=" + updateTimestamp + ", documentId="
|
| 21602 |
ashik.ali |
334 |
+ documentId + ", currentAddressId=" + currentAddressId + ", fofo=" + fofo + "]";
|
|
|
335 |
}
|
| 21545 |
ashik.ali |
336 |
|
| 21602 |
ashik.ali |
337 |
|
| 21545 |
ashik.ali |
338 |
|
|
|
339 |
}
|