Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
21545 ashik.ali 1
package com.spice.profitmandi.dao.entity;
2
 
3
import java.io.Serializable;
4
import java.time.LocalDateTime;
5
 
6
import javax.persistence.Basic;
7
import javax.persistence.Column;
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
import javax.persistence.Version;
17
 
18
import com.spice.profitmandi.dao.enumuration.RetailerType;
19
import com.spice.profitmandi.dao.enumuration.SaleValue;
20
 
21
/**
22
 * This class basically contains api details
23
 * 
24
 * @author ashikali
25
 *
26
 */
27
@Entity
28
@Table(name="retailer", schema = "dtr", uniqueConstraints = {@UniqueConstraint(columnNames = {"number","type"})})
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
 
95
	@Column(name="create_timestamp", updatable = false)
96
	private LocalDateTime createTimestamp = LocalDateTime.now();
97
 
98
	@Column(name="update_timestamp")
99
	private LocalDateTime updateTimestamp = LocalDateTime.now();
100
 
101
	@Column(name = "document_id")
102
	private int documentId;
103
 
104
	@Column(name = "current_address_id")
105
	private int currentAddressId;
106
 
21688 ashik.ali 107
	@Column(name = "fofo", columnDefinition = "tinyint(1) default 0")
21566 ashik.ali 108
	private boolean fofo;
109
 
21545 ashik.ali 110
	public int getId() {
111
		return id;
112
	}
113
	public void setId(int id) {
114
		this.id = id;
115
	}
116
	public void setName(String name) {
117
        this.name = name;
118
    }
119
    public String getName() {
120
        return name;
121
    }
122
 
123
    public String getNumber() {
124
		return number;
125
	}
126
    public void setNumber(String number) {
127
		this.number = number;
128
	}
129
 
130
    public SaleValue getMonthlySaleValue() {
131
		return monthlySaleValue;
132
	}
133
    public void setMonthlySaleValue(SaleValue monthlySaleValue) {
134
		this.monthlySaleValue = monthlySaleValue;
135
	}
136
    public SaleValue getSmartphoneSaleValue() {
137
		return smartphoneSaleValue;
138
	}
139
    public void setSmartphoneSaleValue(SaleValue smartphoneSaleValue) {
140
		this.smartphoneSaleValue = smartphoneSaleValue;
141
	}
142
 
143
    public boolean isRecharge() {
144
		return recharge;
145
	}
146
    public void setRecharge(boolean recharge) {
147
		this.recharge = recharge;
148
	}
149
    public boolean isMobile() {
150
		return mobile;
151
	}
152
    public void setMobile(boolean mobile) {
153
		this.mobile = mobile;
154
	}
155
    public boolean isAccessories() {
156
		return accessories;
157
	}
158
    public void setAccessories(boolean accessories) {
159
		this.accessories = accessories;
160
	}
161
    public String getOther1() {
162
		return other1;
163
	}
164
    public void setOther1(String other1) {
165
		this.other1 = other1;
166
	}
167
    public String getOther2() {
168
		return other2;
169
	}
170
    public void setOther2(String other2) {
171
		this.other2 = other2;
172
	}
173
    public void setType(RetailerType type) {
174
		this.type = type;
175
	}
176
    public RetailerType getType() {
177
		return type;
178
	}
179
 
180
    public int getDocumentId() {
181
		return documentId;
182
	}
183
    public void setDocumentId(int documentId) {
184
		this.documentId = documentId;
185
	}
186
 
187
    public void setCurrentAddressId(int currentAddressId) {
188
		this.currentAddressId = currentAddressId;
189
	}
190
    public int getCurrentAddressId() {
191
		return currentAddressId;
192
	}
193
 
194
    public boolean isSelfPickup() {
195
		return selfPickup;
196
	}
197
    public void setSelfPickup(boolean selfPickup) {
198
		this.selfPickup = selfPickup;
199
	}
200
 
201
    public boolean isActive() {
202
		return active;
203
	}
204
    public void setActive(boolean active) {
205
		this.active = active;
206
	}
207
 
208
    public boolean isMigrated() {
209
		return migrated;
210
	}
211
    public void setMigrated(boolean migrated) {
212
		this.migrated = migrated;
213
	}
214
 
215
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
216
		this.createTimestamp = createTimestamp;
217
	}
218
    public LocalDateTime getCreateTimestamp() {
219
		return createTimestamp;
220
	}
221
 
222
    public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
223
		this.updateTimestamp = updateTimestamp;
224
	}
225
    public LocalDateTime getUpdateTimestamp() {
226
		return updateTimestamp;
227
	}
228
 
21566 ashik.ali 229
 
230
    public boolean isFofo() {
231
		return fofo;
232
	}
233
    public void setFofo(boolean fofo) {
234
		this.fofo = fofo;
235
	}
21602 ashik.ali 236
	@Override
237
	public String toString() {
238
		return "Retailer [id=" + id + ", name=" + name + ", number=" + number + ", type=" + type + ", monthlySaleValue="
239
				+ monthlySaleValue + ", smartphoneSaleValue=" + smartphoneSaleValue + ", recharge=" + recharge
240
				+ ", mobile=" + mobile + ", accessories=" + accessories + ", other1=" + other1 + ", other2=" + other2
241
				+ ", selfPickup=" + selfPickup + ", active=" + active + ", migrated=" + migrated + ", createTimestamp="
21693 ashik.ali 242
				+ createTimestamp + ", updateTimestamp=" + updateTimestamp + ", documentId="
21602 ashik.ali 243
				+ documentId + ", currentAddressId=" + currentAddressId + ", fofo=" + fofo + "]";
244
	}
21545 ashik.ali 245
 
21602 ashik.ali 246
 
21545 ashik.ali 247
 
248
}