package model import ( "time" "ulink-admin/pkg/base" ) type Stock struct { Id int64 `excel:"name= " xorm:"pk autoincr notnull comment('')" json:"id" ` // CreateDate string `excel:"name=日期 " xorm:"varchar(255) comment('日期')" json:"createDate" binding:"required"` //日期 Type int `excel:"name=交易所 ,format=1=上证,2=深证,3=创业板,4=科创,5=其它" xorm:"int(1) notnull default(2) comment('交易所')" json:"type" binding:"required,oneof=1 2 3 4 5 "` //交易所(1上证 2深证 3创业板 4科创 5其它 ) Label int `excel:"name=大盘走势 ,format=1=上涨,2=下跌,3=未知" xorm:"int(1) notnull default(2) comment('大盘走势')" json:"label" ` //大盘走势(1上涨 2下跌) Val string `excel:"name=值 " xorm:"varchar(255) comment('值')" json:"val" ` //值 CreateTime time.Time `excel:"name=创建时间 " xorm:"datetime comment('创建时间')" json:"createTime" ` //创建时间 CreateBy string `excel:"name=创建人 " xorm:"varchar(255) comment('创建人')" json:"createBy" ` //创建人 UpdateTime time.Time `excel:"name=更新时间 " xorm:"datetime comment('更新时间')" json:"updateTime" ` //更新时间 UpdateBy string `excel:"name=更新人 " xorm:"varchar(255) comment('更新人')" json:"updateBy" ` //更新人 Details []*StockDetail `xorm:"-" json:"details"` //岗位id组 } func (this Stock) TableName() string { return "stock" } func (this *Stock) Key() int64 { return this.Id } func (this *Stock) Model() interface{} { return this } func (this *Stock) BeforeUpdate() { user := base.GetCurUser() if user != nil { this.UpdateBy = user.Name } } func (this *Stock) BeforeInsert() { user := base.GetCurUser() if user != nil { this.CreateBy = user.Name this.UpdateBy = user.Name } }