|
|
@@ -7,15 +7,31 @@ import ( |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
type happyOrchardUserSeedRecordDb struct { |
|
|
|
type HappyOrchardUserSeedRecordDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func (h HappyOrchardUserSeedRecordDb) UpdateHappyOrchardUserSeedRecord(m *models.HappyOrchardUserSeedRecord, forceColums ...string) (int64, error) { |
|
|
|
var ( |
|
|
|
affected int64 |
|
|
|
err error |
|
|
|
) |
|
|
|
if forceColums != nil { |
|
|
|
affected, err = h.Db.Where("id=?", m.Id).Cols(forceColums...).Update(m) |
|
|
|
} else { |
|
|
|
affected, err = h.Db.Where("id=?", m.Id).Update(m) |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return affected, nil |
|
|
|
} |
|
|
|
|
|
|
|
func NewHappyOrchardUserSeedRecordDb(engine *xorm.Engine) dao.HappyOrchardUserSeedRecordDao { |
|
|
|
return &happyOrchardUserSeedRecordDb{Db: engine} |
|
|
|
return &HappyOrchardUserSeedRecordDb{Db: engine} |
|
|
|
} |
|
|
|
|
|
|
|
func (h happyOrchardUserSeedRecordDb) GetHappyOrchardUserSeedRecord(id int) (m *models.HappyOrchardUserSeedRecord, err error) { |
|
|
|
func (h HappyOrchardUserSeedRecordDb) GetHappyOrchardUserSeedRecord(id int) (m *models.HappyOrchardUserSeedRecord, err error) { |
|
|
|
//TODO implement me |
|
|
|
m = new(models.HappyOrchardUserSeedRecord) |
|
|
|
has, err := h.Db.Where("id =?", id).Get(m) |
|
|
@@ -28,7 +44,7 @@ func (h happyOrchardUserSeedRecordDb) GetHappyOrchardUserSeedRecord(id int) (m * |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (h happyOrchardUserSeedRecordDb) FindHappyOrchardUserSeedRecordByUid(uid int) (mm *[]models.HappyOrchardUserSeedRecord, err error) { |
|
|
|
func (h HappyOrchardUserSeedRecordDb) FindHappyOrchardUserSeedRecordByUid(uid int) (mm *[]models.HappyOrchardUserSeedRecord, err error) { |
|
|
|
//TODO implement me |
|
|
|
var m []models.HappyOrchardUserSeedRecord |
|
|
|
if err := h.Db.Where("uid =?", uid).Desc("id").Find(&m); err != nil { |
|
|
@@ -36,7 +52,7 @@ func (h happyOrchardUserSeedRecordDb) FindHappyOrchardUserSeedRecordByUid(uid in |
|
|
|
} |
|
|
|
return &m, nil |
|
|
|
} |
|
|
|
func (h happyOrchardUserSeedRecordDb) GetHappyOrchardUserSeedRecordByUidWithState(uid, state int) (m *models.HappyOrchardUserSeedRecord, err error) { |
|
|
|
func (h HappyOrchardUserSeedRecordDb) GetHappyOrchardUserSeedRecordByUidWithState(uid, state int) (m *models.HappyOrchardUserSeedRecord, err error) { |
|
|
|
m = new(models.HappyOrchardUserSeedRecord) |
|
|
|
has, err := h.Db.Where("uid =? and state=?", uid, state).Get(m) |
|
|
|
if err != nil { |
|
|
@@ -47,7 +63,7 @@ func (h happyOrchardUserSeedRecordDb) GetHappyOrchardUserSeedRecordByUidWithStat |
|
|
|
} |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
func (h happyOrchardUserSeedRecordDb) GetHappyOrchardUserSeedRecordByUidWithStateAndId(uid, id, state int) (m *models.HappyOrchardUserSeedRecord, err error) { |
|
|
|
func (h HappyOrchardUserSeedRecordDb) GetHappyOrchardUserSeedRecordByUidWithStateAndId(uid, id, state int) (m *models.HappyOrchardUserSeedRecord, err error) { |
|
|
|
m = new(models.HappyOrchardUserSeedRecord) |
|
|
|
has, err := h.Db.Where("uid =? and state=? and id=?", uid, state, id).Get(m) |
|
|
|
if err != nil { |
|
|
@@ -58,7 +74,7 @@ func (h happyOrchardUserSeedRecordDb) GetHappyOrchardUserSeedRecordByUidWithStat |
|
|
|
} |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
func (h happyOrchardUserSeedRecordDb) FindHappyOrchardUserSeedRecordAll(uid, start, limit int) (mm *[]models.HappyOrchardUserSeedRecord, err error) { |
|
|
|
func (h HappyOrchardUserSeedRecordDb) FindHappyOrchardUserSeedRecordAll(uid, start, limit int) (mm *[]models.HappyOrchardUserSeedRecord, err error) { |
|
|
|
var m []models.HappyOrchardUserSeedRecord |
|
|
|
if err := h.Db.Where("uid=?", uid).OrderBy("id desc").Limit(limit, start).Find(&m); err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|