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

@@ -27,12 +27,12 @@ const (
// PlanExecutionLog 记录整个计划的一次执行历史
type PlanExecutionLog struct {
ID uint `gorm:"primaryKey"`
ID uint32 `gorm:"primaryKey"`
CreatedAt time.Time `gorm:"primaryKey"` // 作为联合主键方便只查询热点数据
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
PlanID uint `gorm:"index"`
PlanID uint32 `gorm:"index"`
Status ExecutionStatus
StartedAt time.Time
EndedAt time.Time
@@ -46,12 +46,12 @@ func (PlanExecutionLog) TableName() string {
// TaskExecutionLog 记录单个任务的一次执行历史
type TaskExecutionLog struct {
ID uint `gorm:"primaryKey"`
ID uint32 `gorm:"primaryKey"`
CreatedAt time.Time `gorm:"primaryKey"` // 作为联合主键方便只查询热点数据
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
PlanExecutionLogID uint `gorm:"index"` // 关联到某次计划执行
PlanExecutionLogID uint32 `gorm:"index"` // 关联到某次计划执行
// TaskID 使用 int 类型以容纳特殊的负数ID代表系统任务
TaskID int `gorm:"index"`
@@ -106,7 +106,7 @@ type DeviceCommandLog struct {
// DeviceID 是接收此下行任务的设备的ID。
// 对于 LoRaWAN这通常是区域主控设备的ID。
DeviceID uint `gorm:"not null;index" json:"device_id"`
DeviceID uint32 `gorm:"not null;index" json:"device_id"`
// SentAt 记录下行任务最初发送的时间。
SentAt time.Time `gorm:"primaryKey" json:"sent_at"`
@@ -133,7 +133,7 @@ type PendingCollection struct {
// DeviceID 是接收此任务的设备ID
// 对于 LoRaWAN这通常是区域主控设备的ID。
DeviceID uint `gorm:"index"`
DeviceID uint32 `gorm:"index"`
// CommandMetadata 存储了此次采集任务对应的设备ID列表顺序与设备响应值的顺序一致。
CommandMetadata UintArray `gorm:"type:bigint[]"`
@@ -183,13 +183,13 @@ func (a AuditContextKey) String() string {
// UserActionLog 记录用户的操作历史,用于审计
type UserActionLog struct {
// 用 ID 和 Time 组成复合主键, 防止高并发时时间重复
ID uint `gorm:"primaryKey"`
ID uint32 `gorm:"primaryKey"`
// Time 是操作发生的时间,作为主键和超表的时间分区键
Time time.Time `gorm:"primaryKey" json:"time"`
// --- Who (谁) ---
UserID uint `gorm:"not null" json:"user_id,omitempty"`
UserID uint32 `gorm:"not null" json:"user_id,omitempty"`
Username string `json:"username,omitempty"` // 操作发生时用户名的快照
// --- Where (何地) ---