From 096d2e783fa1bfa9a0bb8dd69a9cbe30b65f37eb Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sun, 22 Dec 2024 00:42:24 +0800 Subject: [PATCH] team --- src/dao/egg_energy_team_assistance_dao.go | 1 + .../egg_energy_team_assistance_implement.go | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/dao/egg_energy_team_assistance_dao.go b/src/dao/egg_energy_team_assistance_dao.go index 409a4be..d8b7bf6 100644 --- a/src/dao/egg_energy_team_assistance_dao.go +++ b/src/dao/egg_energy_team_assistance_dao.go @@ -9,6 +9,7 @@ type EggEnergyTeamAssistanceDao interface { EggEnergyTeamAssistanceInsertBySession(session *xorm.Session, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance) (int64, error) EggEnergyTeamAssistanceUpdateBySession(session *xorm.Session, id interface{}, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance, forceColums ...string) (int64, error) EggEnergyTeamAssistanceGetOneByParamsBySession(session *xorm.Session, params map[string]interface{}) (*model.EggEnergyTeamAssistance, error) + EggEnergyTeamAssistanceGetOneByParams(params map[string]interface{}) (*model.EggEnergyTeamAssistance, error) EggEnergyTeamAssistanceGetOneBySession(session *xorm.Session, uid int64, date string) (*model.EggEnergyTeamAssistance, error) EggEnergyTeamAssistanceGetOne(uid int64, date string) (*model.EggEnergyTeamAssistance, error) EggEnergyTeamAssistanceInsert(EggEnergyTeamAssistance *model.EggEnergyTeamAssistance) (int64, error) diff --git a/src/implement/egg_energy_team_assistance_implement.go b/src/implement/egg_energy_team_assistance_implement.go index 5854823..3f1b27c 100644 --- a/src/implement/egg_energy_team_assistance_implement.go +++ b/src/implement/egg_energy_team_assistance_implement.go @@ -52,7 +52,18 @@ func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOneByParamsBySessio } return &m, nil } - +func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOneByParams(params map[string]interface{}) (*model.EggEnergyTeamAssistance, error) { + var m model.EggEnergyTeamAssistance + var query = fmt.Sprintf("%s =?", params["key"]) + has, err := e.Db.Where(query, params["value"]).Get(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return &m, nil +} func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOne(uid int64, date string) (*model.EggEnergyTeamAssistance, error) { var m model.EggEnergyTeamAssistance has, err := e.Db.Where("uid = ?", uid).And("date = ?", date).Get(&m)