Subversion Repositories SmartDukaan

Rev

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

Rev 29990 Rev 30077
Line 4... Line 4...
4
 
4
 
5
@Entity
5
@Entity
6
@Table(name = "transaction.userwallet", schema = "transaction")
6
@Table(name = "transaction.userwallet", schema = "transaction")
7
@NamedQueries({
7
@NamedQueries({
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"),
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" +
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 " +
10
				+ " join UserWallet uw on uw.userId = fs.id " + "join UserWalletHistory uwh on uwh.walletId = uw.id "
12
				"where uwh.referenceType in ('ADVANCE_AMOUNT', 'AUTOMATED_ADVANCE', 'PAYMENT_GATEWAY') " +
11
				+ "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"),
12
				+ "and uwh.timestamp between :startDate and :endDate and fs.internal=false group by fs.warehouseId"),
-
 
13
 
14
})
14
		@NamedQuery(name = "UserWallet.getPartnerWiseTargetCollections", query = "SELECT new com.spice.profitmandi.dao.model.PartnerCollectionPlanModel(fs.id,case when pcp.collectionPlan is not null then cast(pcp.collectionPlan As long) else 0 end,sum(cast(uwh.amount AS int))) FROM FofoStore fs"
-
 
15
				+ " join UserWallet uw on uw.userId = fs.id " + "join UserWalletHistory uwh on uwh.walletId = uw.id"
-
 
16
				+ " left join PartnerCollectionPlan pcp on (pcp.fofoId = fs.id and pcp.createTimestamp > :startDate)"
-
 
17
				+ "where uwh.referenceType in ('ADVANCE_AMOUNT', 'AUTOMATED_ADVANCE', 'PAYMENT_GATEWAY') "
-
 
18
				+ "and uwh.timestamp > :startDate and fs.id in :fofoIds and fs.internal=0 group by fs.id"), })
15
public class UserWallet {
19
public class UserWallet {
16
 
20
 
17
	@Id
21
	@Id
18
	@GeneratedValue(strategy = GenerationType.IDENTITY)
22
	@GeneratedValue(strategy = GenerationType.IDENTITY)
19
	private int id;
23
	private int id;