diff --git a/src/dao/fin_withdraw_apply_dao.go b/src/dao/fin_withdraw_apply_dao.go index fa643e5..24b286f 100644 --- a/src/dao/fin_withdraw_apply_dao.go +++ b/src/dao/fin_withdraw_apply_dao.go @@ -8,4 +8,5 @@ import ( type FinWithdrawApplyDao interface { FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawApply, error) FinWithdrawApplyInsertOneBySession(session *xorm.Session, m *model.FinWithdrawApply) (int64, error) + FinWithdrawApplyAmountGetByParams(params map[string]interface{}) (float64, error) } diff --git a/src/implement/fin_withdraw_apply_implement.go b/src/implement/fin_withdraw_apply_implement.go index b6830d9..6e1b17a 100644 --- a/src/implement/fin_withdraw_apply_implement.go +++ b/src/implement/fin_withdraw_apply_implement.go @@ -44,3 +44,13 @@ func (f FinWithdrawApplyDb) FinWithdrawApplyGetBySession(session *xorm.Session, return m, nil } + +func (f FinWithdrawApplyDb) FinWithdrawApplyAmountGetByParams(params map[string]interface{}) (float64, error) { + var m model.FinWithdrawApply + var query = fmt.Sprintf("%s =?", params["key"]) + total, err := f.Db.Where(query, params["value"]).Sum(m, "amount") + if err != nil { + return 0, err + } + return total, nil +}