CompanyNotice.go 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package Company
  2. import (
  3. _ "github.com/astaxie/beego/cache/redis"
  4. "github.com/beego/beego/v2/adapter/orm"
  5. _ "github.com/go-sql-driver/mysql"
  6. "time"
  7. )
  8. type CompanyNotice struct {
  9. Id int `orm:"column(ID);size(11);auto;pk"`
  10. T_pid int `orm:"index;size(256);null"` // Account.Company 绑定公司
  11. T_name string `orm:"size(256);null"` // 分类
  12. T_Notice_wx string `orm:"type(text);null"` //w微信公众号 uuid/名字|
  13. T_Notice_phone string `orm:"type(text);null"` //p手机 uuid/名字|
  14. T_Notice_message string `orm:"type(text);null"` //m短信 uuid/名字|
  15. T_Notice_mailbox string `orm:"type(text);null"` //e邮箱 uuid/名字|
  16. T_Notice_mechanism string `orm:"type(text);null"` // 报警机制
  17. T_Notice_bind string `orm:"type(text);null"` // 绑定T_sn,Tid| 862289056463538,1|8622546456433,1|
  18. // W报警编号,处理,w启用,持续秒,间隔秒,发送条数,d启用,持续秒,间隔秒,发送条数,p启用,持续秒,间隔秒,发送条数|
  19. // W15,1,0,1,0,9999,0,0,0,0,0,0,0,0,0|
  20. T_State int `orm:"size(2);1"` // 0 删除 1 正常
  21. CreateTime time.Time `orm:"column(create_time);type(timestamp);null;auto_now_add"` //auto_now_add 第一次保存时才设置时间
  22. UpdateTime time.Time `orm:"column(update_time);type(timestamp);null;auto_now"` //auto_now 每次 model 保存时都会对时间自动更新
  23. }
  24. func (t *CompanyNotice) TableName() string {
  25. return "company_notice" // 数据库名称 // ************** 替换 DesignDeviceNotice **************
  26. }
  27. func init() {
  28. //注册模型
  29. orm.RegisterModel(new(CompanyNotice))
  30. }
  31. // 获取列表
  32. func Read_CompanyNotice_List(T_pid int) (r []CompanyNotice) {
  33. o := orm.NewOrm()
  34. qs := o.QueryTable(new(CompanyNotice))
  35. qs.Filter("T_pid", T_pid).OrderBy("Id").All(&r)
  36. return r
  37. }