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