ソースを参照

更新

master
huangjiajun 6時間前
コミット
3a9a60112b
2個のファイルの変更46行の追加0行の削除
  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 ファイルの表示

@@ -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 ファイルの表示

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

読み込み中…
キャンセル
保存