Subversion Repositories SmartDukaan

Rev

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

Rev 30109 Rev 30110
Line 4... Line 4...
4
import java.time.LocalDateTime;
4
import java.time.LocalDateTime;
5
import java.time.format.DateTimeFormatter;
5
import java.time.format.DateTimeFormatter;
6
 
6
 
7
import javax.persistence.CascadeType;
7
import javax.persistence.CascadeType;
8
import javax.persistence.Column;
8
import javax.persistence.Column;
-
 
9
import javax.persistence.ColumnResult;
-
 
10
import javax.persistence.ConstructorResult;
9
import javax.persistence.Convert;
11
import javax.persistence.Convert;
10
import javax.persistence.Entity;
12
import javax.persistence.Entity;
11
import javax.persistence.EntityResult;
-
 
12
import javax.persistence.EnumType;
13
import javax.persistence.EnumType;
13
import javax.persistence.Enumerated;
14
import javax.persistence.Enumerated;
14
import javax.persistence.FetchType;
15
import javax.persistence.FetchType;
15
import javax.persistence.FieldResult;
-
 
16
import javax.persistence.GeneratedValue;
16
import javax.persistence.GeneratedValue;
17
import javax.persistence.GenerationType;
17
import javax.persistence.GenerationType;
18
import javax.persistence.Id;
18
import javax.persistence.Id;
19
import javax.persistence.JoinColumn;
19
import javax.persistence.JoinColumn;
20
import javax.persistence.ManyToOne;
20
import javax.persistence.ManyToOne;
21
import javax.persistence.NamedNativeQueries;
-
 
22
import javax.persistence.NamedNativeQuery;
21
import javax.persistence.NamedNativeQuery;
23
import javax.persistence.NamedQueries;
22
import javax.persistence.NamedQueries;
24
import javax.persistence.NamedQuery;
23
import javax.persistence.NamedQuery;
25
import javax.persistence.SqlResultSetMapping;
24
import javax.persistence.SqlResultSetMapping;
26
import javax.persistence.Table;
25
import javax.persistence.Table;
Line 194... Line 193...
194
				+ "  and psp.createTimestamp <= :endDate and psp.active = 1 )"
193
				+ "  and psp.createTimestamp <= :endDate and psp.active = 1 )"
195
				+ " where fs.id in :fofoIds and fs.internal = 0  group by li.brand,psp.brand,fs.id"),
194
				+ " where fs.id in :fofoIds and fs.internal = 0  group by li.brand,psp.brand,fs.id"),
196
 
195
 
197
})
196
})
198
 
197
 
-
 
198
//@NamedNativeQuery(name = "Order.findByEmailAddress", query = "select * from transaction.`order` o where  o.id = '1694173'", resultClass = Order.class)
-
 
199
 
-
 
200
@SqlResultSetMapping(name = "partnerSecondaryPlanModel", classes = {
-
 
201
		@ConstructorResult(targetClass = PartnerSecondaryPlanModel.class, columns = {
-
 
202
				@ColumnResult(name = "id", type = Integer.class), @ColumnResult(name = "brand", type = String.class),
-
 
203
				@ColumnResult(name = "secondary_plan", type = Long.class),
-
 
204
				@ColumnResult(name = "total_price", type = Long.class),
-
 
205
				@ColumnResult(name = "auth_id", type = Integer.class) }) })
-
 
206
 
-
 
207
@NamedNativeQuery(name = "selectPartnerSecondaryGroupByBrand", query = "select fs.id,ifnull(a.sb,brand) as brand,a.secondary_plan,sum(a.total_price) as total_price,a.auth_id from "
-
 
208
		+ "fofo.fofo_store fs left join (select o.customer_id , li.brand as sb, li.total_price, psp.fofo_id , psp.brand, psp.secondary_plan,psp.auth_id from transaction.`order` o join transaction.lineitem li on "
-
 
209
		+ "(o.id = li.order_id) left join  auth.partner_secondary_plan psp on (psp.fofo_id = o.customer_id  and date(psp.create_timestamp) = :startDate and "
-
 
210
		+ "psp.active = 1 and psp.brand = li.brand ) where o.customer_id in :fofoIds and  o.status in (7,9,10,12) and date(o.billing_timestamp) = :startDate"
-
 
211
		+ " union select if(li.brand is null, null, o.customer_id) as customer_id, li.brand as sb, li.total_price, psp.fofo_id , psp.brand, psp.secondary_plan,psp.auth_id "
-
 
212
		+ "from auth.partner_secondary_plan psp  left join transaction.`order` o on (psp.fofo_id = o.customer_id and o.status in (7,9,10,12) and date(o.billing_timestamp) = :startDate) "
-
 
213
		+ "left join transaction.lineitem li on  (o.id = li.order_id and psp.brand=li.brand) where psp.fofo_id in :fofoIds and date(psp.create_timestamp) = :startDate "
-
 
214
		+ "and psp.active = 1) a on fs.id = a.customer_id or fs.id = a.fofo_id where fs.id in :fofoIds group by a.customer_id ,a.sb;", resultSetMapping = "partnerSecondaryPlanModel")
-
 
215
 
199
public class Order implements Serializable {
216
public class Order implements Serializable {
200
 
217
 
201
	private static final long serialVersionUID = 1L;
218
	private static final long serialVersionUID = 1L;
202
 
219
 
203
	public Order() {
220
	public Order() {