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

@@ -8,7 +8,7 @@ import (
// SnoozeAlarmRequest 定义了忽略告警的请求体
type SnoozeAlarmRequest struct {
DurationMinutes uint `json:"duration_minutes" validate:"required,min=1"` // 忽略时长,单位分钟
DurationMinutes uint32 `json:"duration_minutes" validate:"required,min=1"` // 忽略时长,单位分钟
}
// ListActiveAlarmRequest 定义了获取活跃告警列表的请求参数
@@ -16,7 +16,7 @@ type ListActiveAlarmRequest struct {
Page int `json:"page" query:"page"`
PageSize int `json:"page_size" query:"page_size"`
SourceType *models.AlarmSourceType `json:"source_type" query:"source_type"` // 按告警来源类型过滤
SourceID *uint `json:"source_id" query:"source_id"` // 按告警来源ID过滤
SourceID *uint32 `json:"source_id" query:"source_id"` // 按告警来源ID过滤
Level *models.SeverityLevel `json:"level" query:"level"` // 按告警严重性等级过滤
IsIgnored *bool `json:"is_ignored" query:"is_ignored"` // 按是否被忽略过滤
TriggerTime *time.Time `json:"trigger_time" query:"trigger_time"` // 告警触发时间范围 - 开始时间
@@ -26,11 +26,11 @@ type ListActiveAlarmRequest struct {
// ActiveAlarmDTO 是用于API响应的活跃告警结构
type ActiveAlarmDTO struct {
ID uint `json:"id"`
ID uint32 `json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
SourceType models.AlarmSourceType `json:"source_type"`
SourceID uint `json:"source_id"`
SourceID uint32 `json:"source_id"`
AlarmCode models.AlarmCode `json:"alarm_code"`
AlarmSummary string `json:"alarm_summary"`
Level models.SeverityLevel `json:"level"`
@@ -52,7 +52,7 @@ type ListHistoricalAlarmRequest struct {
Page int `json:"page" query:"page"`
PageSize int `json:"page_size" query:"page_size"`
SourceType *models.AlarmSourceType `json:"source_type" query:"source_type"` // 按告警来源类型过滤
SourceID *uint `json:"source_id" query:"source_id"` // 按告警来源ID过滤
SourceID *uint32 `json:"source_id" query:"source_id"` // 按告警来源ID过滤
Level *models.SeverityLevel `json:"level" query:"level"` // 按告警严重性等级过滤
TriggerTimeStart *time.Time `json:"trigger_time_start" query:"trigger_time_start"` // 告警触发时间范围 - 开始时间
TriggerTimeEnd *time.Time `json:"trigger_time_end" query:"trigger_time_end"` // 告警触发时间范围 - 结束时间
@@ -63,9 +63,9 @@ type ListHistoricalAlarmRequest struct {
// HistoricalAlarmDTO 是用于API响应的历史告警结构
type HistoricalAlarmDTO struct {
ID uint `json:"id"`
ID uint32 `json:"id"`
SourceType models.AlarmSourceType `json:"source_type"`
SourceID uint `json:"source_id"`
SourceID uint32 `json:"source_id"`
AlarmCode models.AlarmCode `json:"alarm_code"`
AlarmSummary string `json:"alarm_summary"`
Level models.SeverityLevel `json:"level"`
@@ -73,7 +73,7 @@ type HistoricalAlarmDTO struct {
TriggerTime time.Time `json:"trigger_time"`
ResolveTime time.Time `json:"resolve_time"`
ResolveMethod string `json:"resolve_method"`
ResolvedBy *uint `json:"resolved_by"`
ResolvedBy *uint32 `json:"resolved_by"`
}
// ListHistoricalAlarmResponse 是获取历史告警列表的响应结构
@@ -84,7 +84,7 @@ type ListHistoricalAlarmResponse struct {
// CreateDeviceThresholdAlarmDTO 创建设备阈值告警的请求DTO
type CreateDeviceThresholdAlarmDTO struct {
DeviceID uint `json:"device_id" binding:"required"` // 设备ID
DeviceID uint32 `json:"device_id" binding:"required"` // 设备ID
SensorType models.SensorType `json:"sensor_type" binding:"required"` // 传感器类型
Thresholds float32 `json:"thresholds" binding:"required"` // 阈值
Operator models.Operator `json:"operator" binding:"required"` // 操作符 (使用string类型与前端交互更通用)
@@ -100,7 +100,7 @@ type UpdateDeviceThresholdAlarmDTO struct {
// CreateAreaThresholdAlarmDTO 创建区域阈值告警的请求DTO
type CreateAreaThresholdAlarmDTO struct {
AreaControllerID uint `json:"area_controller_id" binding:"required"` // 区域主控ID
AreaControllerID uint32 `json:"area_controller_id" binding:"required"` // 区域主控ID
SensorType models.SensorType `json:"sensor_type" binding:"required"` // 传感器类型
Thresholds float32 `json:"thresholds" binding:"required"` // 阈值
Operator models.Operator `json:"operator" binding:"required"` // 操作符
@@ -122,7 +122,7 @@ type DeleteDeviceThresholdAlarmDTO struct {
// AreaThresholdAlarmDTO 用于表示一个区域阈值告警任务的详细信息
type AreaThresholdAlarmDTO struct {
ID int `json:"id"`
AreaControllerID uint `json:"area_controller_id"`
AreaControllerID uint32 `json:"area_controller_id"`
SensorType models.SensorType `json:"sensor_type"`
Thresholds float32 `json:"thresholds"`
Operator models.Operator `json:"operator"`
@@ -132,7 +132,7 @@ type AreaThresholdAlarmDTO struct {
// DeviceThresholdAlarmDTO 用于表示一个设备阈值告警任务的详细信息
type DeviceThresholdAlarmDTO struct {
ID int `json:"id"`
DeviceID uint `json:"device_id"`
DeviceID uint32 `json:"device_id"`
SensorType models.SensorType `json:"sensor_type"`
Thresholds float32 `json:"thresholds"`
Operator models.Operator `json:"operator"`