From b87b1b4e41dbbaa33a26995c8ec19cca3c37ae13 Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Thu, 14 Nov 2024 17:27:26 +0800 Subject: [PATCH] update --- src/dao/egg_energy_fund_data_dao.go | 1 + src/dao/platform_revenue_data_dao.go | 1 + src/implement/egg_energy_fund_data_implement.go | 10 ++++++++++ src/implement/platform_revenue_data_implement.go | 10 ++++++++++ 4 files changed, 22 insertions(+) diff --git a/src/dao/egg_energy_fund_data_dao.go b/src/dao/egg_energy_fund_data_dao.go index a19e909..db9ff55 100644 --- a/src/dao/egg_energy_fund_data_dao.go +++ b/src/dao/egg_energy_fund_data_dao.go @@ -11,4 +11,5 @@ type EggEnergyFundDataDao interface { EggEnergyFundDataInsert(eggEnergyFundData *model.EggEnergyFundData) (int, error) EggEnergyFundDataFindNotFinish() ([]model.EggEnergyFundData, error) EggEnergyFundDataUpdateBySession(session *xorm.Session, m model.EggEnergyFundData, forceColumns ...string) (int64, error) + EggEnergyFundDataGetOneByParams(params map[string]interface{}) (*model.EggEnergyFundData, error) } diff --git a/src/dao/platform_revenue_data_dao.go b/src/dao/platform_revenue_data_dao.go index 913a913..463f614 100644 --- a/src/dao/platform_revenue_data_dao.go +++ b/src/dao/platform_revenue_data_dao.go @@ -11,4 +11,5 @@ type PlatformRevenueDataDao interface { PlatformRevenueDataFindAndCount(page, limit int, startAt, endAt string, kind int) ([]model.PlatformRevenueData, int64, error) PlatformRevenueDataFindNotFinish() ([]model.PlatformRevenueData, error) PlatformRevenueDataUpdateBySession(session *xorm.Session, m model.PlatformRevenueData, forceColumns ...string) (int64, error) + PlatformRevenueDataGetOneByParams(params map[string]interface{}) (*model.PlatformRevenueData, error) } diff --git a/src/implement/egg_energy_fund_data_implement.go b/src/implement/egg_energy_fund_data_implement.go index 470d6ce..bea26a1 100644 --- a/src/implement/egg_energy_fund_data_implement.go +++ b/src/implement/egg_energy_fund_data_implement.go @@ -4,6 +4,7 @@ import ( "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" + "fmt" "xorm.io/xorm" ) @@ -59,3 +60,12 @@ func (e EggEnergyFundDataDb) EggEnergyFundDataUpdateBySession(session *xorm.Sess return affected, nil } + +func (e EggEnergyFundDataDb) EggEnergyFundDataGetOneByParams(params map[string]interface{}) (*model.EggEnergyFundData, error) { + var m model.EggEnergyFundData + var query = fmt.Sprintf("%s =?", params["key"]) + if has, err := e.Db.Where(query, params["value"]).Get(&m); err != nil || has == false { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil +} diff --git a/src/implement/platform_revenue_data_implement.go b/src/implement/platform_revenue_data_implement.go index bd3d173..7af3643 100644 --- a/src/implement/platform_revenue_data_implement.go +++ b/src/implement/platform_revenue_data_implement.go @@ -4,6 +4,7 @@ import ( "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" + "fmt" "xorm.io/xorm" ) @@ -59,3 +60,12 @@ func (p PlatformRevenueDataDb) PlatformRevenueDataUpdateBySession(session *xorm. return affected, nil } + +func (p PlatformRevenueDataDb) PlatformRevenueDataGetOneByParams(params map[string]interface{}) (*model.PlatformRevenueData, error) { + var m model.PlatformRevenueData + var query = fmt.Sprintf("%s =?", params["key"]) + if has, err := p.Db.Where(query, params["value"]).Get(&m); err != nil || has == false { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil +}