From 20bf9e0d7fc02c4fa669148646a2d71e8fb69c95 Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Sat, 23 Nov 2024 17:32:54 +0800 Subject: [PATCH] update --- src/dao/egg_energy_available_energy_flow_dao.go | 1 + .../egg_energy_available_energy_flow_implement.go | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/dao/egg_energy_available_energy_flow_dao.go b/src/dao/egg_energy_available_energy_flow_dao.go index 014aa69..c1152e2 100644 --- a/src/dao/egg_energy_available_energy_flow_dao.go +++ b/src/dao/egg_energy_available_energy_flow_dao.go @@ -8,4 +8,5 @@ import ( type EggEnergyAvailableEnergyFlowDao interface { EggEnergyAvailableEnergyFlowFindAndCount(kind, page, pageSize int, startAt, endAt string) ([]*model.EggEnergyAvailableEnergyFlow, int64, error) EggEnergyAvailableEnergyFlowInsertBySession(session *xorm.Session, eggEnergyAvailableEnergyFlow *model.EggEnergyAvailableEnergyFlow) (int64, error) + EggEnergyAvailableEnergyFlowGetSumByKind(kind int) (float64, error) } diff --git a/src/implement/egg_energy_available_energy_flow_implement.go b/src/implement/egg_energy_available_energy_flow_implement.go index 612d7a1..d1172f2 100644 --- a/src/implement/egg_energy_available_energy_flow_implement.go +++ b/src/implement/egg_energy_available_energy_flow_implement.go @@ -41,3 +41,12 @@ func (e EggEnergyAvailableEnergyFlowDb) EggEnergyAvailableEnergyFlowFindAndCount } return m, total, nil } + +func (e EggEnergyAvailableEnergyFlowDb) EggEnergyAvailableEnergyFlowGetSumByKind(kind int) (float64, error) { + var m model.EggEnergyAvailableEnergyFlow + sum, err := e.Db.Where("kind = ?", kind).Sum(m, "amount") + if err != nil { + return 0, zhios_order_relate_logx.Error(err.Error()) + } + return sum, nil +}