From d29aad4d8336597cfb838259313021af4b6ffb2c Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 20 Jun 2024 11:01:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E6=9C=9F=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dao/installment_payment_scheme_dao.go | 3 ++- .../installment_payment_scheme_with_goods_dao.go | 6 ++++-- src/implement/installment_payment_scheme_db.go | 10 +++++++++- .../installment_payment_scheme_with_goods_db.go | 15 ++++++++++++++- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/dao/installment_payment_scheme_dao.go b/src/dao/installment_payment_scheme_dao.go index d81f5fb..935cb2c 100644 --- a/src/dao/installment_payment_scheme_dao.go +++ b/src/dao/installment_payment_scheme_dao.go @@ -1,8 +1,9 @@ -package dao +package dao import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" type InstallmentPaymentSchemeDao interface { InsertInstallmentPaymentScheme(m *models.InstallmentPaymentScheme) (id int, err error) GetInstallmentPaymentSchemeById(id int) (m *models.InstallmentPaymentScheme, err error) + FindInstallmentPaymentScheme() (m *[]models.InstallmentPaymentScheme, err error) } diff --git a/src/dao/installment_payment_scheme_with_goods_dao.go b/src/dao/installment_payment_scheme_with_goods_dao.go index 9d7faa3..a00f121 100644 --- a/src/dao/installment_payment_scheme_with_goods_dao.go +++ b/src/dao/installment_payment_scheme_with_goods_dao.go @@ -1,5 +1,7 @@ -package dao +package dao + +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" type InstallmentPaymentSchemeWithGoodsDao interface { - //TODO:: You can add specific method definitions here + GetInstallmentPaymentSchemeGoodsByGoodsId(goodsId int) (m *models.InstallmentPaymentSchemeWithGoods, err error) } diff --git a/src/implement/installment_payment_scheme_db.go b/src/implement/installment_payment_scheme_db.go index d7493f7..100415b 100644 --- a/src/implement/installment_payment_scheme_db.go +++ b/src/implement/installment_payment_scheme_db.go @@ -1,4 +1,4 @@ -package implement +package implement import ( "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" @@ -35,3 +35,11 @@ func (i InstallmentPaymentSchemeDb) GetInstallmentPaymentSchemeById(id int) (m * } return m, nil } +func (i InstallmentPaymentSchemeDb) FindInstallmentPaymentScheme() (m *[]models.InstallmentPaymentScheme, err error) { + mm := make([]models.InstallmentPaymentScheme, 0) + err = i.Db.Find(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return &mm, nil +} diff --git a/src/implement/installment_payment_scheme_with_goods_db.go b/src/implement/installment_payment_scheme_with_goods_db.go index 6bd1965..dc00bbb 100644 --- a/src/implement/installment_payment_scheme_with_goods_db.go +++ b/src/implement/installment_payment_scheme_with_goods_db.go @@ -1,7 +1,9 @@ -package implement +package implement import ( "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" "xorm.io/xorm" ) @@ -12,3 +14,14 @@ type InstallmentPaymentSchemeWithGoodsDb struct { func NewInstallmentPaymentSchemeWithGoodsDb(engine *xorm.Engine) dao.InstallmentPaymentSchemeWithGoodsDao { return &InstallmentPaymentSchemeWithGoodsDb{Db: engine} } +func (i InstallmentPaymentSchemeWithGoodsDb) GetInstallmentPaymentSchemeGoodsByGoodsId(goodsId int) (m *models.InstallmentPaymentSchemeWithGoods, err error) { + m = new(models.InstallmentPaymentSchemeWithGoods) + has, err := i.Db.Where("goods_id =?", goodsId).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +}