Subversion Repositories SmartDukaan

Rev

Rev 28521 | Rev 30077 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21716 ashik.ali 1
package com.spice.profitmandi.dao.entity.transaction;
21552 ashik.ali 2
 
29990 amit.gupta 3
import javax.persistence.*;
21552 ashik.ali 4
 
5
@Entity
28521 amit.gupta 6
@Table(name = "transaction.userwallet", schema = "transaction")
7
@NamedQueries({
29990 amit.gupta 8
		@NamedQuery(name = "UserWallet.getSummary", query = "select new com.spice.profitmandi.dao.model.AccountStatementModel(uwh.referenceType, sum(case when uwh.amount>0 then amount else 0 end), sum(case when uwh.amount<0 then -amount else 0 end))\tfrom UserWalletHistory uwh where uwh.walletId=:walletId \tand uwh.timestamp between :startDate and :endDate group by uwh.referenceType"),
9
		@NamedQuery(name = "UserWallet.getStatewiseCollections", query = "SELECT new com.spice.profitmandi.dao.model.WarehouseWalletAmountModel(fs.warehouseId, sum(uwh.amount)) FROM FofoStore fs" +
10
				" join UserWallet uw on uw.userId = fs.id " +
11
				"join UserWalletHistory uwh on uwh.walletId = uw.id " +
12
				"where uwh.referenceType in ('ADVANCE_AMOUNT', 'AUTOMATED_ADVANCE', 'PAYMENT_GATEWAY') " +
13
				"and uwh.timestamp between :startDate and :endDate and fs.internal=false group by fs.warehouseId"),
14
})
28521 amit.gupta 15
public class UserWallet {
16
 
21552 ashik.ali 17
	@Id
28521 amit.gupta 18
	@GeneratedValue(strategy = GenerationType.IDENTITY)
21552 ashik.ali 19
	private int id;
20
	private int userId;
21
	private int amount;
28521 amit.gupta 22
 
22550 ashik.ali 23
	@Column(name = "refundable_amount")
24
	private int refundableAmount;
28521 amit.gupta 25
 
21552 ashik.ali 26
	public int getId() {
27
		return id;
28
	}
28521 amit.gupta 29
 
21552 ashik.ali 30
	public void setId(int id) {
31
		this.id = id;
32
	}
28521 amit.gupta 33
 
21552 ashik.ali 34
	public int getUserId() {
35
		return userId;
36
	}
25546 amit.gupta 37
 
21552 ashik.ali 38
	public void setUserId(int userId) {
39
		this.userId = userId;
40
	}
28521 amit.gupta 41
 
21552 ashik.ali 42
	public int getAmount() {
25546 amit.gupta 43
		return amount;
21552 ashik.ali 44
	}
28521 amit.gupta 45
 
21552 ashik.ali 46
	public void setAmount(int amount) {
47
		this.amount = amount;
48
	}
28521 amit.gupta 49
 
22550 ashik.ali 50
	public int getRefundableAmount() {
51
		return refundableAmount;
21552 ashik.ali 52
	}
28521 amit.gupta 53
 
22550 ashik.ali 54
	public void setRefundableAmount(int refundableAmount) {
55
		this.refundableAmount = refundableAmount;
21552 ashik.ali 56
	}
28521 amit.gupta 57
 
21602 ashik.ali 58
	@Override
21924 ashik.ali 59
	public int hashCode() {
60
		final int prime = 31;
61
		int result = 1;
62
		result = prime * result + id;
63
		return result;
64
	}
28521 amit.gupta 65
 
21924 ashik.ali 66
	@Override
67
	public boolean equals(Object obj) {
68
		if (this == obj)
69
			return true;
70
		if (obj == null)
71
			return false;
72
		if (getClass() != obj.getClass())
73
			return false;
74
		UserWallet other = (UserWallet) obj;
75
		if (id != other.id)
76
			return false;
77
		return true;
78
	}
28521 amit.gupta 79
 
21924 ashik.ali 80
	@Override
21602 ashik.ali 81
	public String toString() {
22550 ashik.ali 82
		return "UserWallet [id=" + id + ", userId=" + userId + ", amount=" + amount + ", refundableAmount="
83
				+ refundableAmount + "]";
21602 ashik.ali 84
	}
28521 amit.gupta 85
 
22653 ashik.ali 86
}