Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
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;
22009 ashik.ali 7
import javax.persistence.Convert;
21545 ashik.ali 8
import javax.persistence.Entity;
9
import javax.persistence.EnumType;
10
import javax.persistence.Enumerated;
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
 
22009 ashik.ali 17
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
21720 ashik.ali 18
import com.spice.profitmandi.dao.enumuration.dtr.RetailerType;
19
import com.spice.profitmandi.dao.enumuration.dtr.SaleValue;
21545 ashik.ali 20
 
21
/**
22
 * This class basically contains api details
23
 * 
24
 * @author ashikali
25
 *
26
 */
27
@Entity
21720 ashik.ali 28
@Table(name="dtr.retailer", schema = "dtr", uniqueConstraints = {@UniqueConstraint(columnNames = {"number","type"})})
21545 ashik.ali 29
@NamedQueries({
30
	@NamedQuery(name = "Retailer.selectCount", query = "select count(r) from Retailer r"),
31
	@NamedQuery(name = "Retailer.selectAll",query="select r from Retailer r"),
32
	@NamedQuery(name = "Retailer.selectById",query="select r from Retailer r where r.id= :id"),
33
	@NamedQuery(name = "Retailer.selectByName",query="select r from Retailer r where r.name= :name"),
34
	@NamedQuery(name = "Retailer.selectCountByNumberAndType",query="select count(r) from Retailer r where r.number= :number and r.type= :type"),
35
	@NamedQuery(name = "Retailer.selectCountByDocumentId", query="select count(r) from Retailer r where r.documentId= :documentId"),
36
	@NamedQuery(name = "Retailer.selectCountByName", query = "select count(r) from Retailer r where r.name= :name"),
37
	@NamedQuery(name = "Retailer.selectCountById", query = "select count(r) from Retailer r where r.id= :id"),
38
	@NamedQuery(name = "Retailer.deleteById",query="delete from Retailer r where r.id= :id"),
21559 ashik.ali 39
	@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 40
	@NamedQuery(
41
			name = "Retailer.selectFofoIdAndEmailIdByEmailId",
42
			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 43
})
44
public class Retailer implements Serializable{
45
 
46
	private static final long serialVersionUID = 1L;
47
 
48
	public Retailer() {
49
	}
50
 
51
	@Id
52
	@Column(name = "id", unique=true, updatable=false)
53
	private int id;
54
 
55
	@Column(name = "name")
56
	private String name;
57
 
58
	@Column(name = "number", length = 128)
59
	private String number;
60
 
61
	@Column(name = "type")
62
	@Enumerated(EnumType.STRING)
63
	private RetailerType type;
64
 
65
	@Column(name = "monthly_sale_value")
66
	private SaleValue monthlySaleValue;
67
 
68
	@Column(name = "smartphone_sale_value")
69
	private SaleValue smartphoneSaleValue;
70
 
71
	@Column(name = "recharge", columnDefinition="tinyint(1) default 0")
72
	private boolean recharge;
73
 
74
	@Column(name = "mobile", columnDefinition="tinyint(1) default 0")
75
	private boolean mobile;
76
 
77
	@Column(name = "accessories", columnDefinition="tinyint(1) default 0")
78
	private boolean accessories;
79
 
80
	@Column(name = "other1", length = 128)
81
	private String other1;
82
 
83
	@Column(name = "other2", length = 128)
84
	private String other2;
85
 
86
	@Column(name = "self_pickup", columnDefinition="tinyint(1) default 0")
87
	private boolean selfPickup;
88
 
89
	@Column(name = "active", columnDefinition = "tinyint(1) default 0")
90
	private boolean active;
91
 
92
	@Column(name = "migrated", columnDefinition = "tinyint(1) default 0")
93
	private boolean migrated;
94
 
22009 ashik.ali 95
	@Convert(converter = LocalDateTimeAttributeConverter.class)
21545 ashik.ali 96
	@Column(name="create_timestamp", updatable = false)
97
	private LocalDateTime createTimestamp = LocalDateTime.now();
98
 
22009 ashik.ali 99
	@Convert(converter = LocalDateTimeAttributeConverter.class)
21545 ashik.ali 100
	@Column(name="update_timestamp")
101
	private LocalDateTime updateTimestamp = LocalDateTime.now();
102
 
103
	@Column(name = "document_id")
104
	private int documentId;
105
 
106
	@Column(name = "current_address_id")
107
	private int currentAddressId;
108
 
21688 ashik.ali 109
	@Column(name = "fofo", columnDefinition = "tinyint(1) default 0")
21566 ashik.ali 110
	private boolean fofo;
111
 
21545 ashik.ali 112
	public int getId() {
113
		return id;
114
	}
115
	public void setId(int id) {
116
		this.id = id;
117
	}
118
	public void setName(String name) {
119
        this.name = name;
120
    }
121
    public String getName() {
122
        return name;
123
    }
124
 
125
    public String getNumber() {
126
		return number;
127
	}
128
    public void setNumber(String number) {
129
		this.number = number;
130
	}
131
 
132
    public SaleValue getMonthlySaleValue() {
133
		return monthlySaleValue;
134
	}
135
    public void setMonthlySaleValue(SaleValue monthlySaleValue) {
136
		this.monthlySaleValue = monthlySaleValue;
137
	}
138
    public SaleValue getSmartphoneSaleValue() {
139
		return smartphoneSaleValue;
140
	}
141
    public void setSmartphoneSaleValue(SaleValue smartphoneSaleValue) {
142
		this.smartphoneSaleValue = smartphoneSaleValue;
143
	}
144
 
145
    public boolean isRecharge() {
146
		return recharge;
147
	}
148
    public void setRecharge(boolean recharge) {
149
		this.recharge = recharge;
150
	}
151
    public boolean isMobile() {
152
		return mobile;
153
	}
154
    public void setMobile(boolean mobile) {
155
		this.mobile = mobile;
156
	}
157
    public boolean isAccessories() {
158
		return accessories;
159
	}
160
    public void setAccessories(boolean accessories) {
161
		this.accessories = accessories;
162
	}
163
    public String getOther1() {
164
		return other1;
165
	}
166
    public void setOther1(String other1) {
167
		this.other1 = other1;
168
	}
169
    public String getOther2() {
170
		return other2;
171
	}
172
    public void setOther2(String other2) {
173
		this.other2 = other2;
174
	}
175
    public void setType(RetailerType type) {
176
		this.type = type;
177
	}
178
    public RetailerType getType() {
179
		return type;
180
	}
181
 
182
    public int getDocumentId() {
183
		return documentId;
184
	}
185
    public void setDocumentId(int documentId) {
186
		this.documentId = documentId;
187
	}
188
 
189
    public void setCurrentAddressId(int currentAddressId) {
190
		this.currentAddressId = currentAddressId;
191
	}
192
    public int getCurrentAddressId() {
193
		return currentAddressId;
194
	}
195
 
196
    public boolean isSelfPickup() {
197
		return selfPickup;
198
	}
199
    public void setSelfPickup(boolean selfPickup) {
200
		this.selfPickup = selfPickup;
201
	}
202
 
203
    public boolean isActive() {
204
		return active;
205
	}
206
    public void setActive(boolean active) {
207
		this.active = active;
208
	}
209
 
210
    public boolean isMigrated() {
211
		return migrated;
212
	}
213
    public void setMigrated(boolean migrated) {
214
		this.migrated = migrated;
215
	}
216
 
217
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
218
		this.createTimestamp = createTimestamp;
219
	}
220
    public LocalDateTime getCreateTimestamp() {
221
		return createTimestamp;
222
	}
223
 
224
    public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
225
		this.updateTimestamp = updateTimestamp;
226
	}
227
    public LocalDateTime getUpdateTimestamp() {
228
		return updateTimestamp;
229
	}
230
 
21566 ashik.ali 231
    public boolean isFofo() {
232
		return fofo;
233
	}
234
    public void setFofo(boolean fofo) {
235
		this.fofo = fofo;
236
	}
21924 ashik.ali 237
 
238
 
22009 ashik.ali 239
 
21602 ashik.ali 240
	@Override
21924 ashik.ali 241
	public int hashCode() {
242
		final int prime = 31;
243
		int result = 1;
244
		result = prime * result + id;
245
		return result;
246
	}
247
	@Override
248
	public boolean equals(Object obj) {
249
		if (this == obj)
250
			return true;
251
		if (obj == null)
252
			return false;
253
		if (getClass() != obj.getClass())
254
			return false;
255
		Retailer other = (Retailer) obj;
256
		if (id != other.id)
257
			return false;
258
		return true;
259
	}
260
	@Override
21602 ashik.ali 261
	public String toString() {
262
		return "Retailer [id=" + id + ", name=" + name + ", number=" + number + ", type=" + type + ", monthlySaleValue="
263
				+ monthlySaleValue + ", smartphoneSaleValue=" + smartphoneSaleValue + ", recharge=" + recharge
264
				+ ", mobile=" + mobile + ", accessories=" + accessories + ", other1=" + other1 + ", other2=" + other2
265
				+ ", selfPickup=" + selfPickup + ", active=" + active + ", migrated=" + migrated + ", createTimestamp="
21693 ashik.ali 266
				+ createTimestamp + ", updateTimestamp=" + updateTimestamp + ", documentId="
21602 ashik.ali 267
				+ documentId + ", currentAddressId=" + currentAddressId + ", fofo=" + fofo + "]";
268
	}
21545 ashik.ali 269
 
21602 ashik.ali 270
 
21545 ashik.ali 271
 
272
}