Browse Source

feat: add withdraw apply get by time

master
shenjiachi 1 week ago
parent
commit
05318afe83
2 changed files with 10 additions and 3 deletions
  1. +1
    -1
      src/dao/fin_withdraw_apply_dao.go
  2. +9
    -2
      src/implement/fin_withdraw_apply_implement.go

+ 1
- 1
src/dao/fin_withdraw_apply_dao.go View File

@@ -8,7 +8,7 @@ import (
type FinWithdrawApplyDao interface { type FinWithdrawApplyDao interface {
FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawApply, error) FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawApply, error)
FinWithdrawApplyInsertOneBySession(session *xorm.Session, m *model.FinWithdrawApply) (int64, error) FinWithdrawApplyInsertOneBySession(session *xorm.Session, m *model.FinWithdrawApply) (int64, error)
FinWithdrawApplyAmountGetByParams(params map[string]interface{}) (float64, error)
FinWithdrawApplyAmountGetByParams(params map[string]interface{}, startAt, endAt string) (float64, error)
FinWithdrawApplyGet(id int64) (*model.FinWithdrawApply, error) FinWithdrawApplyGet(id int64) (*model.FinWithdrawApply, error)
UpdateFinWithdrawApply(m *model.FinWithdrawApply, columns ...string) (int64, error) UpdateFinWithdrawApply(m *model.FinWithdrawApply, columns ...string) (int64, error)
UpdateFinWithdrawApplyBySession(session *xorm.Session, m *model.FinWithdrawApply, columns ...string) (int64, error) UpdateFinWithdrawApplyBySession(session *xorm.Session, m *model.FinWithdrawApply, columns ...string) (int64, error)


+ 9
- 2
src/implement/fin_withdraw_apply_implement.go View File

@@ -70,10 +70,17 @@ func (f FinWithdrawApplyDb) FinWithdrawApplyGetBySession(session *xorm.Session,
return m, nil return m, nil
} }


func (f FinWithdrawApplyDb) FinWithdrawApplyAmountGetByParams(params map[string]interface{}) (float64, error) {
func (f FinWithdrawApplyDb) FinWithdrawApplyAmountGetByParams(params map[string]interface{}, startAt, endAt string) (float64, error) {
var m model.FinWithdrawApply var m model.FinWithdrawApply
var query = fmt.Sprintf("%s =?", params["key"]) var query = fmt.Sprintf("%s =?", params["key"])
total, err := f.Db.Where(query, params["value"]).Sum(m, "amount")
sess := f.Db.Where(query, params["value"])
if startAt != "" {
sess.Where("create_at >= ?", startAt)
}
if endAt != "" {
sess.Where("create_at <= ?", endAt)
}
total, err := sess.Sum(m, "amount")
if err != nil { if err != nil {
return 0, err return 0, err
} }


Loading…
Cancel
Save