sys_notice.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package model
  2. import (
  3. "time"
  4. "ulink-admin/pkg/base"
  5. )
  6. type SysNotice struct {
  7. Id int64 `xorm:"pk autoincr" json:"id"` //公告id
  8. NoticeTitle string `xorm:"notice_title" json:"noticeTitle" binding:"required"` //公告标题
  9. NoticeType string `xorm:"notice_type" json:"noticeType"` //公告类型(1通知 2公告)
  10. NoticeContent string `json:"noticeContent"` //公告内容
  11. Status string `json:"status"` //公告状态(0正常 1关闭)
  12. CreateBy string `xorm:"varchar(64)" json:"createBy"` //创建人
  13. CreateTime time.Time `xorm:"created" json:"createTime"` //创建时间
  14. UpdateBy string `xorm:"varchar(64)" json:"updateBy"` //更新人
  15. UpdateTime time.Time `xorm:"updated" json:"updateTime"` //更新时间
  16. Remark string `xorm:"varchar(500)" json:"remark"` //备注
  17. CompanyId int64 `excel:"name=公司Id" xorm:"bigint(20)" json:"companyId" ` //公司Id
  18. }
  19. func (r *SysNotice) BeforeUpdate() {
  20. user := base.GetCurUser()
  21. if user != nil {
  22. r.UpdateBy = user.Name
  23. }
  24. }
  25. func (r *SysNotice) BeforeInsert() {
  26. user := base.GetCurUser()
  27. if user != nil {
  28. r.CreateBy = user.Name
  29. r.UpdateBy = user.Name
  30. }
  31. }
  32. func (SysNotice) TableName() string {
  33. return "sys_notice"
  34. }
  35. func (r *SysNotice) Key() int64 {
  36. return r.Id
  37. }
  38. func (r *SysNotice) Model() interface{} {
  39. return r
  40. }