From a5360fd97c2d7b5a2cc6c7694b000ed6b791cc9e Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Wed, 13 Nov 2024 14:44:47 +0800 Subject: [PATCH] update --- src/dao/egg_energy_price_dao.go | 1 + src/implement/egg_energy_price_implement.go | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/dao/egg_energy_price_dao.go b/src/dao/egg_energy_price_dao.go index 51e4b8b..84c5f1b 100644 --- a/src/dao/egg_energy_price_dao.go +++ b/src/dao/egg_energy_price_dao.go @@ -5,4 +5,5 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" type EggEnergyPriceDao interface { //TODO:: You can add specific method definitions here EggEnergyPriceList(startAt string, endAt string, hour string) ([]model.EggEnergyPrice, error) + EggEnergyPriceGetLastOne() (*model.EggEnergyPrice, bool, error) } diff --git a/src/implement/egg_energy_price_implement.go b/src/implement/egg_energy_price_implement.go index 87c9b10..cba2d42 100644 --- a/src/implement/egg_energy_price_implement.go +++ b/src/implement/egg_energy_price_implement.go @@ -28,3 +28,12 @@ func (e EggEnergyPriceDb) EggEnergyPriceList(startAt string, endAt string, hour } return m, nil } + +func (e EggEnergyPriceDb) EggEnergyPriceGetLastOne() (*model.EggEnergyPrice, bool, error) { + var m model.EggEnergyPrice + exist, err := e.Db.Desc("id").Get(&m) + if err != nil { + return nil, false, zhios_order_relate_logx.Error(err.Error()) + } + return &m, exist, nil +}