From 4497935a55e286ee922b99e6e478b7714a35d0b2 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 03 十一月 2023 16:28:33 +0800
Subject: [PATCH] fix
---
model/device_plc.go | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/model/device_plc.go b/model/device_plc.go
index 0f35260..a098e81 100644
--- a/model/device_plc.go
+++ b/model/device_plc.go
@@ -13,15 +13,20 @@
// DevicePlc 璁惧鐨凱LC閰嶇疆
DevicePlc struct {
gorm.Model
- DeviceID string `gorm:"unique;column:device_id;type:varchar(255);not null;default ''" json:"deviceID"` //璁惧缂栧彿
+ DeviceID string `gorm:"column:device_id;type:varchar(255);not null;unique" json:"deviceID"` //璁惧缂栧彿
Brand string `gorm:"type:varchar(191)" json:"brand"`
Method constvar.PlcMethod `gorm:"type:varchar(191)" json:"method"`
Address string `gorm:"type:varchar(191)" json:"address"` //plc ip鍦板潃锛� method = modbusTCP鐢�
Port int `json:"port"` //plc 绔彛鍙凤紝 method = modbusTCP鐢�
BaudRate int `json:"baudRate"` //涓插彛娉㈢壒鐜囷紝 method = serial鏃� 鐢�
SerialName string `json:"serialName"` //涓插彛鍚嶇О锛宮ethod = serial鏃� 鐢�
- IsOpen bool `json:"isOpen"`
- Detail string `gorm:"type:varchar(2048)" json:"-"`
+
+ DataBit int `gorm:"type:int(11)" json:"dataBit"` //鏁版嵁浣嶏紝method = modbusRTU 鐢�
+ StopBit int `gorm:"type:int(11)" json:"stopBit"` //鍋滄浣嶏紝method = modbusRTU 鐢�
+ Parity constvar.Parity `gorm:"type:int(11)" json:"parity"` //鏍¢獙鏂瑰紡锛宮ethod = modbusRTU 鐢�
+
+ IsOpen bool `json:"isOpen"`
+ Detail string `gorm:"type:varchar(2048)" json:"-"`
Details []*DevicePlcAddress `gorm:"-" json:"details"`
--
Gitblit v1.8.0