| 29707 |
tejbeer |
1 |
package com.spice.profitmandi.dao.entity.catalog;
|
|
|
2 |
|
| 30121 |
amit.gupta |
3 |
import javax.persistence.*;
|
| 29707 |
tejbeer |
4 |
import java.time.LocalDateTime;
|
|
|
5 |
|
|
|
6 |
@Entity
|
| 31860 |
tejbeer |
7 |
@Table(name = "catalog.customer_offers")
|
| 29845 |
amit.gupta |
8 |
|
|
|
9 |
@NamedQueries({
|
|
|
10 |
@NamedQuery(name = "CustomerOffer.getOfferItemsByBrand", query = "select new com.spice.profitmandi.service.pricecircular.PriceCircularItemModel("
|
| 34516 |
ranu |
11 |
+ " i.id, i.catalogItemId, cast(sum(coi.schemePayout - coi.dealerPayout) as long),coi.offerType,coi.additionalInfo)"
|
| 29845 |
amit.gupta |
12 |
+ " from CustomerOfferItem coi join Item i on coi.catalogId = i.catalogItemId"
|
|
|
13 |
+ " join CustomerOffer co on co.id=coi.customerOfferId where "
|
| 31199 |
amit.gupta |
14 |
+ " :date between coi.startDate and coi.endDate and "
|
| 33872 |
ranu |
15 |
+ " :dateTime between co.startDate and co.endDate" + " and i.brand in :brands group by i.id"),
|
|
|
16 |
|
| 34433 |
ranu |
17 |
@NamedQuery(name = "CustomerOffer.getUpgradeOfferItemsByBrand", query = "select new com.spice.profitmandi.service.pricecircular.PriceCircularItemModel("
|
| 34516 |
ranu |
18 |
+ " i.id, i.catalogItemId, cast(max(coi.schemePayout) as long),coi.offerType,coi.additionalInfo)"
|
| 34433 |
ranu |
19 |
+ " from CustomerOfferItem coi join Item i on coi.catalogId = i.catalogItemId"
|
|
|
20 |
+ " join CustomerOffer co on co.id=coi.customerOfferId where "
|
|
|
21 |
+ " :date between coi.startDate and coi.endDate and "
|
|
|
22 |
+ " :dateTime between co.startDate and co.endDate" + " and i.brand in :brands group by i.catalogItemId,coi.offerType"),
|
|
|
23 |
|
| 33872 |
ranu |
24 |
@NamedQuery(name = "CustomerOffer.getMaxOfferItemsByBrand", query = "select new com.spice.profitmandi.service.pricecircular.PriceCircularItemModel("
|
| 34516 |
ranu |
25 |
+ " i.id, i.catalogItemId, cast(max(coi.schemePayout) as long),coi.offerType,coi.additionalInfo)"
|
| 33872 |
ranu |
26 |
+ " from CustomerOfferItem coi join Item i on coi.catalogId = i.catalogItemId"
|
|
|
27 |
+ " join CustomerOffer co on co.id=coi.customerOfferId where "
|
|
|
28 |
+ " :date between coi.startDate and coi.endDate and "
|
| 34433 |
ranu |
29 |
+ " :dateTime between co.startDate and co.endDate" + " and i.brand in :brands group by i.id"),
|
| 33872 |
ranu |
30 |
})
|
| 29707 |
tejbeer |
31 |
public class CustomerOffer {
|
|
|
32 |
|
|
|
33 |
@Id
|
|
|
34 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
35 |
private int id;
|
|
|
36 |
|
|
|
37 |
@Column(name = "offer_name")
|
|
|
38 |
private String offerName;
|
|
|
39 |
|
|
|
40 |
@Column(name = "start_date")
|
|
|
41 |
private LocalDateTime startDate;
|
|
|
42 |
|
|
|
43 |
@Column(name = "end_date")
|
|
|
44 |
private LocalDateTime endDate;
|
|
|
45 |
|
| 31147 |
tejbeer |
46 |
@Column(name = "partner_criteria")
|
|
|
47 |
private String partnerCriteria;
|
|
|
48 |
|
| 29707 |
tejbeer |
49 |
@Column(name = "created_timestamp")
|
|
|
50 |
private LocalDateTime createdTimestamp;
|
|
|
51 |
|
|
|
52 |
@Column(name = "updated_timestamp")
|
|
|
53 |
private LocalDateTime updatedTimestamp;
|
|
|
54 |
|
| 31147 |
tejbeer |
55 |
@Transient
|
|
|
56 |
private String partnerCriteriaString;
|
|
|
57 |
|
| 29707 |
tejbeer |
58 |
public int getId() {
|
|
|
59 |
return id;
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
public void setId(int id) {
|
|
|
63 |
this.id = id;
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
public String getOfferName() {
|
|
|
67 |
return offerName;
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
public void setOfferName(String offerName) {
|
|
|
71 |
this.offerName = offerName;
|
|
|
72 |
}
|
|
|
73 |
|
| 31147 |
tejbeer |
74 |
public String getPartnerCriteria() {
|
|
|
75 |
return partnerCriteria;
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
public void setPartnerCriteria(String partnerCriteria) {
|
|
|
79 |
this.partnerCriteria = partnerCriteria;
|
|
|
80 |
}
|
|
|
81 |
|
| 29707 |
tejbeer |
82 |
public LocalDateTime getStartDate() {
|
|
|
83 |
return startDate;
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
public void setStartDate(LocalDateTime startDate) {
|
|
|
87 |
this.startDate = startDate;
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
public LocalDateTime getEndDate() {
|
|
|
91 |
return endDate;
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
public void setEndDate(LocalDateTime endDate) {
|
|
|
95 |
this.endDate = endDate;
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
public LocalDateTime getCreatedTimestamp() {
|
|
|
99 |
return createdTimestamp;
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
|
|
|
103 |
this.createdTimestamp = createdTimestamp;
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
public LocalDateTime getUpdatedTimestamp() {
|
|
|
107 |
return updatedTimestamp;
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
public void setUpdatedTimestamp(LocalDateTime updatedTimestamp) {
|
|
|
111 |
this.updatedTimestamp = updatedTimestamp;
|
|
|
112 |
}
|
|
|
113 |
|
| 31147 |
tejbeer |
114 |
public String getPartnerCriteriaString() {
|
|
|
115 |
return partnerCriteriaString;
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
public void setPartnerCriteriaString(String partnerCriteriaString) {
|
|
|
119 |
this.partnerCriteriaString = partnerCriteriaString;
|
|
|
120 |
}
|
|
|
121 |
|
| 29707 |
tejbeer |
122 |
@Override
|
|
|
123 |
public String toString() {
|
|
|
124 |
return "CustomerOffer [id=" + id + ", offerName=" + offerName + ", startDate=" + startDate + ", endDate="
|
| 31147 |
tejbeer |
125 |
+ endDate + ", partnerCriteria=" + partnerCriteria + ", createdTimestamp=" + createdTimestamp
|
|
|
126 |
+ ", updatedTimestamp=" + updatedTimestamp + ", partnerCriteriaString=" + partnerCriteriaString + "]";
|
| 29707 |
tejbeer |
127 |
}
|
|
|
128 |
|
|
|
129 |
}
|