package iot import ( "IotAdmin/common/models" ) 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:int;not null;comment:设备类型 1:网关 2:表计"` Mode int `gorm:"type:int;not null;comment:设备模式 1:下发指令查询 2:表计主动上报"` Cycle int `gorm:"type:int;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:varchar(255);comment:设备Dsn"` Description string `gorm:"type:varchar(255);comment:设备描述"` Protocol string `gorm:"type:varchar(255);comment:表计协议"` Address int `gorm:"type:int;not null;comment:表计地址"` LvRef float32 `gorm:"type:float;comment:表计线基准电压"` PvRef float32 `gorm:"type:float;comment:表计相基准电压"` BmYz string `gorm:"type:varchar(255);comment:编码因子"` Config string `gorm:"type:varchar(255);comment:其他配置"` models.ControlBy models.ModelTime } func (Device) TableName() string { return "iot_device" }