|
@@ -58,7 +58,8 @@ func (dao *CreditAccountDao) DividendsStatistics(queryOptions map[string]interfa |
|
@@ -58,7 +58,8 @@ func (dao *CreditAccountDao) DividendsStatistics(queryOptions map[string]interfa |
|
58
|
creditAccount := new(models.CreditAccount)
|
58
|
creditAccount := new(models.CreditAccount)
|
|
59
|
query := dao.transactionContext.PgTx.Model(creditAccount)
|
59
|
query := dao.transactionContext.PgTx.Model(creditAccount)
|
|
60
|
query.ColumnExpr(`sum(settlement_amount) total`)
|
60
|
query.ColumnExpr(`sum(settlement_amount) total`)
|
|
61
|
- query.ColumnExpr(`sum((case when payment_status = 1 then actually_paid_amount else 0 end)) paid`)
|
61
|
+ query.ColumnExpr(`sum((case when payment_status = 2 then actually_paid_amount else 0 end)) paid`)
|
|
|
|
62
|
+ query.ColumnExpr(`sum((case when payment_status = 1 then settlement_amount else 0 end)) unpaid`)
|
|
62
|
query.ColumnExpr(`sum((case when settlement_time is not null then settlement_amount else 0 end)) accounted `)
|
63
|
query.ColumnExpr(`sum((case when settlement_time is not null then settlement_amount else 0 end)) accounted `)
|
|
63
|
if v, ok := queryOptions["beginTime"]; ok && !(v.(time.Time).IsZero()) {
|
64
|
if v, ok := queryOptions["beginTime"]; ok && !(v.(time.Time).IsZero()) {
|
|
64
|
query.Where(`created_at>? `, queryOptions["beginTime"])
|
65
|
query.Where(`created_at>? `, queryOptions["beginTime"])
|