Browse Source

update

master
dengbiao 6 months ago
parent
commit
7cef1846f7
2 changed files with 29 additions and 2 deletions
  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 View File

@@ -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 View File

@@ -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…
Cancel
Save