| | |
| | | DeviceID string `gorm:"column:device_id;type:varchar(255);not null;unique" json:"deviceID"` //设备编号 |
| | | ExtChannelAmount int `gorm:"type:tinyint;default:0" json:"extChannelAmount"` |
| | | Procedures string `gorm:"column:procedure;type:varchar(255);not null;default ''" json:"procedures"` //设备支持的工序,用逗号分隔 |
| | | DeviceMac string `gorm:"type:varchar(255);" json:"deviceMac"` //绑定的工控机设备ID |
| | | ProceduresArr []string `gorm:"-" json:"procedureAdd"` //设备支持的工序切片 |
| | | } |
| | | |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *DeviceSearch) SetDeviceMac(deviceMac string) *DeviceSearch { |
| | | slf.DeviceMac = deviceMac |
| | | return slf |
| | | } |
| | | |
| | | func (slf *DeviceSearch) SetDeviceIds(deviceIds []string) *DeviceSearch { |
| | | slf.DeviceIDs = deviceIds |
| | | return slf |
| | |
| | | db = db.Where("device_id = ?", slf.DeviceID) |
| | | } |
| | | |
| | | if slf.DeviceMac != "" { |
| | | db = db.Where("device_mac = ?", slf.DeviceMac) |
| | | } |
| | | |
| | | if len(slf.DeviceIDs) != 0 { |
| | | db = db.Where("device_id in (?)", slf.DeviceIDs) |
| | | } |