huangjiajun 2 tygodni temu
rodzic
commit
3a9a60112b
2 zmienionych plików z 46 dodań i 0 usunięć
  1. +8
    -0
      src/dao/yibao_merchant_dao.go
  2. +38
    -0
      src/implement/yibao_merchant_db.go

+ 8
- 0
src/dao/yibao_merchant_dao.go Wyświetl plik

@@ -0,0 +1,8 @@
package dao

import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"

type YibaoMerchantDao interface {
GetYibaoMerchant(merchantNo string) (m *models.YibaoMerchant, err error)
GetYibaoMerchantById(id string) (m *models.YibaoMerchant, err error)
}

+ 38
- 0
src/implement/yibao_merchant_db.go Wyświetl plik

@@ -0,0 +1,38 @@
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"
)

type YibaoMerchantDb struct {
Db *xorm.Engine
}

func NewYibaoMerchantDb(engine *xorm.Engine) dao.YibaoMerchantDao {
return &YibaoMerchantDb{Db: engine}
}
func (y YibaoMerchantDb) GetYibaoMerchant(merchantNo string) (m *models.YibaoMerchant, err error) {
m = new(models.YibaoMerchant)
has, err := y.Db.Where("merchant_no = ?", merchantNo).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}
func (y YibaoMerchantDb) GetYibaoMerchantById(id string) (m *models.YibaoMerchant, err error) {
m = new(models.YibaoMerchant)
has, err := y.Db.Where("id = ?", id).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

Ładowanie…
Anuluj
Zapisz