CompanyNotice.go 1.9 KB

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