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 +}