Subversion Repositories SmartDukaan

Rev

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

Rev 34287 Rev 35065
Line 1... Line 1...
1
 
1
 
2
package com.spice.profitmandi.dao.entity.fofo;
2
package com.spice.profitmandi.dao.entity.fofo;
3
 
3
 
-
 
4
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
-
 
5
 
-
 
6
import javax.persistence.*;
4
import java.io.Serializable;
7
import java.io.Serializable;
5
import java.time.LocalDateTime;
8
import java.time.LocalDateTime;
6
import java.util.Set;
9
import java.util.Set;
7
 
10
 
8
import javax.persistence.CascadeType;
-
 
9
import javax.persistence.Column;
-
 
10
import javax.persistence.Convert;
-
 
11
import javax.persistence.Entity;
-
 
12
import javax.persistence.FetchType;
-
 
13
import javax.persistence.GeneratedValue;
-
 
14
import javax.persistence.GenerationType;
-
 
15
import javax.persistence.Id;
-
 
16
import javax.persistence.JoinColumn;
-
 
17
import javax.persistence.NamedQueries;
-
 
18
import javax.persistence.NamedQuery;
-
 
19
import javax.persistence.OneToMany;
-
 
20
import javax.persistence.Table;
-
 
21
import javax.persistence.Transient;
-
 
22
import javax.persistence.UniqueConstraint;
-
 
23
 
-
 
24
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
-
 
25
 
-
 
26
@Entity
11
@Entity
27
@Table(name = "fofo.fofo_order_item", uniqueConstraints = {
12
@Table(name = "fofo.fofo_order_item", uniqueConstraints = {
28
		@UniqueConstraint(name = "UK_ORDER_ID_AND_ITEM_ID", columnNames = { "order_id", "item_id" }) })
13
		@UniqueConstraint(name = "UK_ORDER_ID_AND_ITEM_ID", columnNames = { "order_id", "item_id" }) })
29
 
14
 
30
@NamedQueries({
15
@NamedQueries({
31
		@NamedQuery(name = "FofoOrderItem.selectPartnerMonthlySale", query = "select new com.spice.profitmandi.dao.model.PartnerMonthlySaleModel(fo.fofoId, "
16
		@NamedQuery(name = "FofoOrderItem.selectPartnerMonthlySale", query = "select new com.spice.profitmandi.dao.model.PartnerMonthlySaleModel(fo.fofoId, "
32
				+ " DATE_FORMAT(foi.createTimestamp, '%m-%Y'),sum(CAST(foi.quantity*foi.mop  AS int))) from  FofoOrder fo join FofoOrderItem foi on "
17
				+ " DATE_FORMAT(foi.createTimestamp, '%m-%Y'),sum(CAST(foi.quantity*foi.mop  AS int))) from  FofoOrder fo join FofoOrderItem foi on "
33
				+ " fo.id = foi.orderId  where fo.fofoId in :fofoIds and fo.cancelledTimestamp is null "
18
				+ " fo.id = foi.orderId  where fo.fofoId in :fofoIds and fo.cancelledTimestamp is null "
34
				+ " and foi.createTimestamp >= :startDate"
19
				+ " and foi.createTimestamp >= :startDate"
35
				+ " group by fo.fofoId,DATE_FORMAT(foi.createTimestamp, '%m-%Y')"), })
20
				+ " group by fo.fofoId,DATE_FORMAT(foi.createTimestamp, '%m-%Y')"),
-
 
21
		@NamedQuery(
-
 
22
				name = "FofoOrderItem.selectPartnerBrandItemMonthlySale",
-
 
23
				query = "select new com.spice.profitmandi.dao.model.BrandItemWisePartnerSaleModel( " +
-
 
24
						"foi.brand, " +
-
 
25
						"foi.modelName, " +
-
 
26
						"foi.modelNumber, " +
-
 
27
						"sum(foi.quantity)) " +
-
 
28
						"from FofoOrder fo " +
-
 
29
						"join FofoOrderItem foi on fo.id = foi.orderId " +
-
 
30
						"join Catalog ca on ca.modelNumber = foi.modelNumber " +
-
 
31
						"where fo.fofoId in :fofoIds " +
-
 
32
						"and foi.brand =:brand " +
-
 
33
						"and fo.cancelledTimestamp is null " +
-
 
34
						"and foi.createTimestamp >= :startDate " +
-
 
35
						"group by foi.brand, foi.modelName, foi.modelNumber,ca.categoryId"
-
 
36
		),
-
 
37
 
-
 
38
})
36
public class FofoOrderItem implements Serializable {
39
public class FofoOrderItem implements Serializable {
37
 
40
 
38
	private static final long serialVersionUID = 1L;
41
	private static final long serialVersionUID = 1L;
39
 
42
 
40
	@Id
43
	@Id