chance_revise_log.go 1.2 KB
package models

import (
	"time"

	"github.com/astaxie/beego/orm"
)

type ChanceReviseLog struct {
	Id            int64     `orm:"column(id);pk" description:"id 主键"`
	ChanceId      int64     `orm:"column(chance_id)" description:"机会编号"`
	UserCompanyId int64     `orm:"column(user_company_id);null" description:"用户编号 编辑机会的人"`
	Data          string    `orm:"column(data);null" description:"机会数据"`
	CreateAt      time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"`
}

func (t *ChanceReviseLog) TableName() string {
	return "chance_revise_log"
}

func init() {
	orm.RegisterModel(new(ChanceReviseLog))
}

// AddChanceReviseLog insert a new ChanceReviseLog into database and returns
// last inserted Id on success.
func AddChanceReviseLog(m *ChanceReviseLog) (id int64, err error) {
	o := orm.NewOrm()
	id, err = o.Insert(m)
	return
}

// GetChanceReviseLogById retrieves ChanceReviseLog by Id. Returns error if
// Id doesn't exist
func GetChanceReviseLogById(id int64) (v *ChanceReviseLog, err error) {
	o := orm.NewOrm()
	v = &ChanceReviseLog{Id: id}
	if err = o.Read(v); err == nil {
		return v, nil
	}
	return nil, err
}