uint/uint64全部改为uint32

This commit is contained in:
2025-11-10 22:23:31 +08:00
parent 3e711551e7
commit ecd2d37c70
96 changed files with 775 additions and 785 deletions

View File

@@ -6,7 +6,6 @@ import (
"strings"
"gorm.io/datatypes"
"gorm.io/gorm"
)
// --- Properties 结构体定义 ---
@@ -19,7 +18,7 @@ type Bus485Properties struct {
// AreaController 是一个LoRa转总线(如485)的通信网关
type AreaController struct {
gorm.Model
Model
// Name 是主控的业务名称,例如 "1号猪舍主控"
Name string `gorm:"not null;unique" json:"name"`
@@ -53,20 +52,20 @@ func (AreaController) TableName() string {
// Device 代表系统中的所有普通设备
type Device struct {
// gorm.Model 内嵌了标准模型字段 (ID, CreatedAt, UpdatedAt, DeletedAt)
gorm.Model
// Model 内嵌了标准模型字段 (ID, CreatedAt, UpdatedAt, DeletedAt)
Model
// Name 是设备的业务名称,应清晰可读,例如 "1号猪舍温度传感器"
Name string `gorm:"not null" json:"name"`
// DeviceTemplateID 是设备模板的外键
DeviceTemplateID uint `gorm:"not null;index" json:"device_template_id"`
DeviceTemplateID uint32 `gorm:"not null;index" json:"device_template_id"`
// DeviceTemplate 是设备的模板,包含了设备的通用信息
DeviceTemplate DeviceTemplate `json:"device_template"`
// AreaControllerID 是区域主控的外键
AreaControllerID uint `gorm:"not null;index" json:"area_controller_id"`
AreaControllerID uint32 `gorm:"not null;index" json:"area_controller_id"`
// AreaController 是设备所属的区域主控
AreaController AreaController `json:"area_controller"`