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"),
40
	@NamedQuery(name = "Retailer.selectFofoIdAndEmailIdByEmailId", 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
	@Basic(optional = false)
100
    @Column(nullable = false)
101
	@Version
102
	private int version;
103
 
104
	@Column(name = "document_id")
105
	private int documentId;
106
 
107
	@Column(name = "current_address_id")
108
	private int currentAddressId;
109
 
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
 
229
    public void setVersion(int version) {
230
		this.version = version;
231
	}
232
    public int getVersion() {
233
		return version;
234
	}
235
 
236
 
237
}