Subversion Repositories SmartDukaan

Rev

Rev 30499 | Rev 31767 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30499 Rev 31065
Line 1... Line 1...
1
package com.spice.profitmandi.dao.entity.catalog;
1
package com.spice.profitmandi.dao.entity.catalog;
2
 
2
 
-
 
3
import java.io.Serializable;
-
 
4
import java.util.ArrayList;
-
 
5
import java.util.Arrays;
-
 
6
import java.util.List;
-
 
7
 
-
 
8
import javax.persistence.Column;
-
 
9
import javax.persistence.Entity;
-
 
10
import javax.persistence.EnumType;
-
 
11
import javax.persistence.Enumerated;
-
 
12
import javax.persistence.GeneratedValue;
-
 
13
import javax.persistence.GenerationType;
-
 
14
import javax.persistence.Id;
-
 
15
import javax.persistence.NamedQueries;
-
 
16
import javax.persistence.NamedQuery;
-
 
17
import javax.persistence.Table;
-
 
18
 
3
import com.spice.profitmandi.common.enumuration.ItemType;
19
import com.spice.profitmandi.common.enumuration.ItemType;
4
import in.shop2020.model.v1.catalog.status;
-
 
5
 
20
 
6
import javax.persistence.*;
-
 
7
import java.io.Serializable;
21
import in.shop2020.model.v1.catalog.status;
8
 
22
 
9
/**
23
/**
10
 * This class basically contains item details
24
 * This class basically contains item details
11
 *
25
 *
12
 * @author ashikali
26
 * @author ashikali
Line 21... Line 35...
21
		@NamedQuery(name = "Item.selectCatalogIdByMopRange", query = "select i.catalogItemId"
35
		@NamedQuery(name = "Item.selectCatalogIdByMopRange", query = "select i.catalogItemId"
22
				+ " from Item i join TagListing tl on tl.itemId = i.id "
36
				+ " from Item i join TagListing tl on tl.itemId = i.id "
23
				+ " where tl.mop between :startPrice and :endPrice and  i.categoryId=10006 group by i.catalogItemId"),
37
				+ " where tl.mop between :startPrice and :endPrice and  i.categoryId=10006 group by i.catalogItemId"),
24
 
38
 
25
		@NamedQuery(name = "Item.selectAllBrands", query = "select distinct"
39
		@NamedQuery(name = "Item.selectAllBrands", query = "select distinct"
26
				+ "  i.brand from Item i join TagListing tl on tl.itemId = i.id "
40
				+ "  i.brand from Item i join TagListing tl on tl.itemId = i.id " + " where i.categoryId=:categoryId"),
27
				+ " where i.categoryId=:categoryId"),
-
 
28
		@NamedQuery(name = "Item.selectAllCategories", query = "select distinct"
41
		@NamedQuery(name = "Item.selectAllCategories", query = "select distinct"
29
				+ "  i.categoryId from Item i join TagListing tl on tl.itemId = i.id "),
42
				+ "  i.categoryId from Item i join TagListing tl on tl.itemId = i.id "),
30
		@NamedQuery(name = "Item.selectAllModels", query = "select "
43
		@NamedQuery(name = "Item.selectAllModels", query = "select "
31
				+ "  i from Item i join TagListing tl on tl.itemId = i.id where i.brand in :brands and i.categoryId = :categoryId")
44
				+ "  i from Item i join TagListing tl on tl.itemId = i.id where i.brand in :brands and i.categoryId = :categoryId") })
32
})
-
 
33
@Entity
45
@Entity
34
@Table(name = "catalog.item", schema = "catalog")
46
@Table(name = "catalog.item", schema = "catalog")
35
public class Item implements Serializable {
47
public class Item implements Serializable {
36
 
48
 
-
 
49
	public static final List<String> SMART_PG = Arrays.asList("85171300", "85171290");
-
 
50
 
37
	private static final long serialVersionUID = 1L;
51
	private static final long serialVersionUID = 1L;
38
 
52
 
39
	public Item() {
53
	public Item() {
40
	}
54
	}
41
 
55
 
Line 203... Line 217...
203
			itemString.append(this.getColor().trim());
217
			itemString.append(this.getColor().trim());
204
		}
218
		}
205
		return itemString.toString().replaceAll("\\s+", " ").trim();
219
		return itemString.toString().replaceAll("\\s+", " ").trim();
206
	}
220
	}
207
 
221
 
-
 
222
	public boolean isSmartPhone() {
-
 
223
		return SMART_PG.contains(this.getHsnCode());
-
 
224
	}
-
 
225
 
208
	public String getItemDescriptionNoColor() {
226
	public String getItemDescriptionNoColor() {
209
		StringBuilder itemString = new StringBuilder();
227
		StringBuilder itemString = new StringBuilder();
210
		if (this.getBrand() != null && !this.getBrand().isEmpty()) {
228
		if (this.getBrand() != null && !this.getBrand().isEmpty()) {
211
			itemString.append(this.getBrand().trim());
229
			itemString.append(this.getBrand().trim());
212
		}
230
		}