From 6bf3ba96c5b11959a3ac0aa42b8c2259d82c608f Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Fri, 29 Nov 2024 18:15:01 +0800 Subject: [PATCH] update --- src/dao/fin_withdraw_apply_dao.go | 1 + src/implement/fin_withdraw_apply_implement.go | 10 ++++++++++ 2 files changed, 11 insertions(+) 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 +}