diff --git a/src/dao/installment_payment_scheme_with_goods_dao.go b/src/dao/installment_payment_scheme_with_goods_dao.go index a00f121..3508d5d 100644 --- a/src/dao/installment_payment_scheme_with_goods_dao.go +++ b/src/dao/installment_payment_scheme_with_goods_dao.go @@ -1,7 +1,11 @@ package dao -import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + "xorm.io/xorm" +) type InstallmentPaymentSchemeWithGoodsDao interface { GetInstallmentPaymentSchemeGoodsByGoodsId(goodsId int) (m *models.InstallmentPaymentSchemeWithGoods, err error) + GetInstallmentPaymentSchemeGoodsByGoodsIdSess(sess *xorm.Session, goodsId int) (m *models.InstallmentPaymentSchemeWithGoods, err error) } diff --git a/src/implement/installment_payment_scheme_with_goods_db.go b/src/implement/installment_payment_scheme_with_goods_db.go index dc00bbb..1a7bf8c 100644 --- a/src/implement/installment_payment_scheme_with_goods_db.go +++ b/src/implement/installment_payment_scheme_with_goods_db.go @@ -25,3 +25,14 @@ func (i InstallmentPaymentSchemeWithGoodsDb) GetInstallmentPaymentSchemeGoodsByG } return m, nil } +func (i InstallmentPaymentSchemeWithGoodsDb) GetInstallmentPaymentSchemeGoodsByGoodsIdSess(sess *xorm.Session, goodsId int) (m *models.InstallmentPaymentSchemeWithGoods, err error) { + m = new(models.InstallmentPaymentSchemeWithGoods) + has, err := sess.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 +}