浏览代码

update

master
shenjiachi 6 天前
父节点
当前提交
408f683bcf
共有 2 个文件被更改,包括 8 次插入8 次删除
  1. +2
    -2
      src/dao/egg_energy_user_watch_records_dao.go
  2. +6
    -6
      src/implement/egg_energy_user_watch_records_implement.go

+ 2
- 2
src/dao/egg_energy_user_watch_records_dao.go 查看文件

@@ -3,7 +3,7 @@
import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type EggEnergyUserWatchRecordsDao interface {
EggEnergyUserWatchRecordsInsert(OneCirclesUserWatchRecords *model.EggEnergyUserWatchRecords) (int64, error)
EggEnergyUserWatchRecordsUpdate(id interface{}, OneCirclesUserWatchRecords *model.EggEnergyUserWatchRecords, forceColums ...string) (int64, error)
EggEnergyUserWatchRecordsInsert(userWatchRecords *model.EggEnergyUserWatchRecords) (int64, error)
EggEnergyUserWatchRecordsUpdate(id interface{}, userWatchRecords *model.EggEnergyUserWatchRecords, forceColums ...string) (int64, error)
EggEnergyUserWatchRecordsGetOneByParams(params map[string]interface{}) (*model.EggEnergyUserWatchRecords, error)
}

+ 6
- 6
src/implement/egg_energy_user_watch_records_implement.go 查看文件

@@ -16,23 +16,23 @@ type EggEnergyUserWatchRecordsDb struct {
Db *xorm.Engine
}

func (e EggEnergyUserWatchRecordsDb) EggEnergyUserWatchRecordsInsert(OneCirclesUserWatchRecords *model.EggEnergyUserWatchRecords) (int64, error) {
_, err := e.Db.InsertOne(OneCirclesUserWatchRecords)
func (e EggEnergyUserWatchRecordsDb) EggEnergyUserWatchRecordsInsert(userWatchRecords *model.EggEnergyUserWatchRecords) (int64, error) {
_, err := e.Db.InsertOne(userWatchRecords)
if err != nil {
return 0, err
}
return OneCirclesUserWatchRecords.Id, nil
return userWatchRecords.Id, nil
}

func (e EggEnergyUserWatchRecordsDb) EggEnergyUserWatchRecordsUpdate(id interface{}, OneCirclesUserWatchRecords *model.EggEnergyUserWatchRecords, forceColums ...string) (int64, error) {
func (e EggEnergyUserWatchRecordsDb) EggEnergyUserWatchRecordsUpdate(id interface{}, userWatchRecords *model.EggEnergyUserWatchRecords, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = e.Db.Where("id=?", id).Cols(forceColums...).Update(OneCirclesUserWatchRecords)
affected, err = e.Db.Where("id=?", id).Cols(forceColums...).Update(userWatchRecords)
} else {
affected, err = e.Db.Where("id=?", id).Update(OneCirclesUserWatchRecords)
affected, err = e.Db.Where("id=?", id).Update(userWatchRecords)
}
if err != nil {
return 0, err


正在加载...
取消
保存