package model import ( "time" "ulink-admin/pkg/base" ) type SysNotice struct { Id int64 `xorm:"pk autoincr" json:"id"` //公告id NoticeTitle string `xorm:"notice_title" json:"noticeTitle" binding:"required"` //公告标题 NoticeType string `xorm:"notice_type" json:"noticeType"` //公告类型(1通知 2公告) NoticeContent string `json:"noticeContent"` //公告内容 Status string `json:"status"` //公告状态(0正常 1关闭) CreateBy string `xorm:"varchar(64)" json:"createBy"` //创建人 CreateTime time.Time `xorm:"created" json:"createTime"` //创建时间 UpdateBy string `xorm:"varchar(64)" json:"updateBy"` //更新人 UpdateTime time.Time `xorm:"updated" json:"updateTime"` //更新时间 Remark string `xorm:"varchar(500)" json:"remark"` //备注 CompanyId int64 `excel:"name=公司Id" xorm:"bigint(20)" json:"companyId" ` //公司Id } func (r *SysNotice) BeforeUpdate() { user := base.GetCurUser() if user != nil { r.UpdateBy = user.Name } } func (r *SysNotice) BeforeInsert() { user := base.GetCurUser() if user != nil { r.CreateBy = user.Name r.UpdateBy = user.Name } } func (SysNotice) TableName() string { return "sys_notice" } func (r *SysNotice) Key() int64 { return r.Id } func (r *SysNotice) Model() interface{} { return r }