Subversion Repositories SmartDukaan

Rev

Rev 21693 | Rev 21924 | 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;
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
 
228
    public boolean isFofo() {
229
		return fofo;
230
	}
231
    public void setFofo(boolean fofo) {
232
		this.fofo = fofo;
233
	}
21602 ashik.ali 234
	@Override
235
	public String toString() {
236
		return "Retailer [id=" + id + ", name=" + name + ", number=" + number + ", type=" + type + ", monthlySaleValue="
237
				+ monthlySaleValue + ", smartphoneSaleValue=" + smartphoneSaleValue + ", recharge=" + recharge
238
				+ ", mobile=" + mobile + ", accessories=" + accessories + ", other1=" + other1 + ", other2=" + other2
239
				+ ", selfPickup=" + selfPickup + ", active=" + active + ", migrated=" + migrated + ", createTimestamp="
21693 ashik.ali 240
				+ createTimestamp + ", updateTimestamp=" + updateTimestamp + ", documentId="
21602 ashik.ali 241
				+ documentId + ", currentAddressId=" + currentAddressId + ", fofo=" + fofo + "]";
242
	}
21545 ashik.ali 243
 
21602 ashik.ali 244
 
21545 ashik.ali 245
 
246
}