huangjiajun pirms 2 nedēļām
vecāks
revīzija
3a9a60112b
2 mainītis faili ar 46 papildinājumiem un 0 dzēšanām
  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 Parādīt failu

@@ -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 Parādīt failu

@@ -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
}

Notiek ielāde…
Atcelt
Saglabāt