| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.dao.entity.transaction;
|
1 |
package com.spice.profitmandi.dao.entity.transaction;
|
| 2 |
|
2 |
|
| 3 |
import javax.persistence.Column;
|
- |
|
| 4 |
import javax.persistence.Entity;
|
- |
|
| 5 |
import javax.persistence.GeneratedValue;
|
- |
|
| 6 |
import javax.persistence.GenerationType;
|
- |
|
| 7 |
import javax.persistence.Id;
|
3 |
import javax.persistence.*;
|
| 8 |
import javax.persistence.NamedQueries;
|
- |
|
| 9 |
import javax.persistence.NamedQuery;
|
- |
|
| 10 |
import javax.persistence.Table;
|
- |
|
| 11 |
|
4 |
|
| 12 |
@Entity
|
5 |
@Entity
|
| 13 |
@Table(name = "transaction.userwallet", schema = "transaction")
|
6 |
@Table(name = "transaction.userwallet", schema = "transaction")
|
| 14 |
@NamedQueries({
|
7 |
@NamedQueries({
|
| 15 |
@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" +
|
| - |
|
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 |
})
|
| 16 |
public class UserWallet {
|
15 |
public class UserWallet {
|
| 17 |
|
16 |
|
| 18 |
@Id
|
17 |
@Id
|
| 19 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
18 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
| 20 |
private int id;
|
19 |
private int id;
|