瀏覽代碼

update

master
dengbiao 6 月之前
父節點
當前提交
7cef1846f7
共有 2 個文件被更改,包括 29 次插入2 次删除
  1. +3
    -0
      src/dao/happy_orchard_reward_exchange_records_dao.go
  2. +26
    -2
      src/implement/happy_orchard_reward_exchange_records_db.go

+ 3
- 0
src/dao/happy_orchard_reward_exchange_records_dao.go 查看文件

@@ -2,6 +2,7 @@ package dao

import (
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"
"xorm.io/xorm"
)

type HappyOrchardRewardExchangeRecordsDao interface {
@@ -10,4 +11,6 @@ type HappyOrchardRewardExchangeRecordsDao interface {
GetHappyOrchardRewardExchangeRecordsByRecordId(id int) (m *models.HappyOrchardRewardExchangeRecords, err error)
GetHappyOrchardRewardExchangeRecordsByUidWithState(uid, state int) (m *models.HappyOrchardRewardExchangeRecords, err error)
GetHappyOrchardRewardExchangeRecordsByUidWithStateAndId(uid, id, state int) (m *models.HappyOrchardRewardExchangeRecords, err error)
InsertHappyOrchardRewardExchangeRecordsBySess(sess *xorm.Session, m *models.HappyOrchardRewardExchangeRecords) (int, error)
UpdateHappyOrchardRewardExchangeRecordsBySess(sess *xorm.Session, m *models.HappyOrchardRewardExchangeRecords, forceColums ...string) (int64, error)
}

+ 26
- 2
src/implement/happy_orchard_reward_exchange_records_db.go 查看文件

@@ -7,12 +7,36 @@ import (
"xorm.io/xorm"
)

func NewHappyOrchardRewardExchangeRecordsDb(engine *xorm.Engine) dao.HappyOrchardRewardExchangeRecordsDao {
return &HappyOrchardRewardExchangeRecordsDb{Db: engine}
}

type HappyOrchardRewardExchangeRecordsDb struct {
Db *xorm.Engine
}

func NewHappyOrchardRewardExchangeRecordsDb(engine *xorm.Engine) dao.HappyOrchardRewardExchangeRecordsDao {
return &HappyOrchardRewardExchangeRecordsDb{Db: engine}
func (h HappyOrchardRewardExchangeRecordsDb) UpdateHappyOrchardRewardExchangeRecordsBySess(sess *xorm.Session, m *models.HappyOrchardRewardExchangeRecords, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = sess.Where("id=?", m.Id).Cols(forceColums...).Update(m)
} else {
affected, err = sess.Where("id=?", m.Id).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

func (h HappyOrchardRewardExchangeRecordsDb) InsertHappyOrchardRewardExchangeRecordsBySess(sess *xorm.Session, m *models.HappyOrchardRewardExchangeRecords) (int, error) {
_, err := sess.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (h HappyOrchardRewardExchangeRecordsDb) GetHappyOrchardRewardExchangeRecords(id int) (m *models.HappyOrchardRewardExchangeRecords, err error) {


Loading…
取消
儲存