package iot import ( "IotAdmin/common/models" "time" ) type Device struct { ID int64 `gorm:"primary_key;auto_increment;not null;comment:Id"` ParentId int64 `gorm:"type:bigint;not null;comment:父ID"` GroupId int64 `gorm:"type:bigint;not null;comment:分组ID"` SN string `gorm:"type:varchar(50);not null;comment:设备编码"` Name string `gorm:"type:varchar(50);not null;comment:设备名称"` Type int `gorm:"type:tinyint(1);not null;comment:设备类型 1:网关 2:表计"` Mode int `gorm:"type:tinyint(1);comment:设备模式 1:下发指令查询 2:表计主动上报"` Cycle int `gorm:"type:int;comment:上报周期"` Status int `gorm:"type:tinyint(1);comment:启用状态"` // DSN 表计上报IP、端口、协议、ST、MN、用户、密码 192.168.0.104:8080@YcHj212@1@mn,192.168.0.104:8081@YcHj212@user@123456 DSN string `gorm:"type:text;comment:设备Dsn"` Description string `gorm:"type:varchar(255);comment:设备描述"` Protocol string `gorm:"type:varchar(50);comment:表计协议"` Address int `gorm:"type:int;comment:表计地址"` BmYz string `gorm:"type:text;comment:编码因子"` OtherConfig string `gorm:"type:text;comment:其他配置"` //LvRef 表计线基准电压 PvRef表计相基准电压 PT CT 等配置 OnlineStatus int `gorm:"type:tinyint(1);comment:在线状态"` TimeOnline time.Time `gorm:"type:datetime;comment:上线时间"` TimeOffline time.Time `gorm:"type:datetime;comment:离线时间"` models.ControlBy models.ModelTime } func (Device) TableName() string { return "iot_device" }