achievement_chance.go 1006 字节
package models

import (
	"time"

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

type AchievementChance struct {
	Id            int64     `orm:"column(id);pk"`
	AchievementId int64     `orm:"column(achievement_id);null" description:"成果编号 表achievement.id"`
	ChanceId      int64     `orm:"column(chance_id);null" description:"机会编号 表chance.id"`
	ChanceCode    string    `orm:"column(chance_code);size(255);null" description:"机会编号 表chance.code"`
	CreateAt      time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"`
}

func (t *AchievementChance) TableName() string {
	return "new_achievement_chance"
}

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

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