From 5e80e4d0fd978d36e9735b5c45aaf38305c753a1 Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Mon, 25 Nov 2024 15:52:50 +0800 Subject: [PATCH] update --- src/dao/fin_withdraw_apply_dao.go | 7 +++++- src/implement/fin_withdraw_apply_implement.go | 24 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/dao/fin_withdraw_apply_dao.go b/src/dao/fin_withdraw_apply_dao.go index 6498cac..d3d3af1 100644 --- a/src/dao/fin_withdraw_apply_dao.go +++ b/src/dao/fin_withdraw_apply_dao.go @@ -1,6 +1,11 @@ package dao +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "xorm.io/xorm" +) + type FinWithdrawApplyDao interface { //TODO:: You can add specific method definitions here - + FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawSetting, error) } diff --git a/src/implement/fin_withdraw_apply_implement.go b/src/implement/fin_withdraw_apply_implement.go index d99bab6..1eb0588 100644 --- a/src/implement/fin_withdraw_apply_implement.go +++ b/src/implement/fin_withdraw_apply_implement.go @@ -2,6 +2,11 @@ import ( "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils" + zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" + "fmt" + "reflect" "xorm.io/xorm" ) @@ -12,3 +17,22 @@ func NewFinWithdrawApplyDb(engine *xorm.Engine) dao.FinWithdrawApplyDao { type FinWithdrawApplyDb struct { Db *xorm.Engine } + +func (f FinWithdrawApplyDb) FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawSetting, error) { + var m *[]model.FinWithdrawSetting + session = session.Where("create_at > >", startAt).And("create_at < ?", endAt) + if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { + //指定In查询 + if err := session.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Find(m); err != nil { + return nil, zhios_order_relate_logx.Warn(err) + } + } else { + var query = fmt.Sprintf("%s =?", params["key"]) + err := session.And(query, params["value"]).Find(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + } + + return m, nil +}