float64全部改float32

This commit is contained in:
2025-11-10 21:42:46 +08:00
parent 75306941c2
commit 3e711551e7
21 changed files with 74 additions and 73 deletions

View File

@@ -86,14 +86,14 @@ type ListHistoricalAlarmResponse struct {
type CreateDeviceThresholdAlarmDTO struct {
DeviceID uint `json:"device_id" binding:"required"` // 设备ID
SensorType models.SensorType `json:"sensor_type" binding:"required"` // 传感器类型
Thresholds float64 `json:"thresholds" binding:"required"` // 阈值
Thresholds float32 `json:"thresholds" binding:"required"` // 阈值
Operator models.Operator `json:"operator" binding:"required"` // 操作符 (使用string类型与前端交互更通用)
Level models.SeverityLevel `json:"level,omitempty"` // 告警等级,可选,如果未提供则使用默认值
}
// UpdateDeviceThresholdAlarmDTO 更新设备阈值告警的请求DTO
type UpdateDeviceThresholdAlarmDTO struct {
Thresholds float64 `json:"thresholds" binding:"required"` // 新的阈值
Thresholds float32 `json:"thresholds" binding:"required"` // 新的阈值
Operator models.Operator `json:"operator" binding:"required"` // 新的操作符
Level models.SeverityLevel `json:"level,omitempty"` // 新的告警等级,可选
}
@@ -102,14 +102,14 @@ type UpdateDeviceThresholdAlarmDTO struct {
type CreateAreaThresholdAlarmDTO struct {
AreaControllerID uint `json:"area_controller_id" binding:"required"` // 区域主控ID
SensorType models.SensorType `json:"sensor_type" binding:"required"` // 传感器类型
Thresholds float64 `json:"thresholds" binding:"required"` // 阈值
Thresholds float32 `json:"thresholds" binding:"required"` // 阈值
Operator models.Operator `json:"operator" binding:"required"` // 操作符
Level models.SeverityLevel `json:"level,omitempty"` // 告警等级,可选
}
// UpdateAreaThresholdAlarmDTO 更新区域阈值告警的请求DTO
type UpdateAreaThresholdAlarmDTO struct {
Thresholds float64 `json:"thresholds" binding:"required"` // 新的阈值
Thresholds float32 `json:"thresholds" binding:"required"` // 新的阈值
Operator models.Operator `json:"operator" binding:"required"` // 新的操作符
Level models.SeverityLevel `json:"level,omitempty"` // 新的告警等级,可选
}
@@ -124,7 +124,7 @@ type AreaThresholdAlarmDTO struct {
ID int `json:"id"`
AreaControllerID uint `json:"area_controller_id"`
SensorType models.SensorType `json:"sensor_type"`
Thresholds float64 `json:"thresholds"`
Thresholds float32 `json:"thresholds"`
Operator models.Operator `json:"operator"`
Level models.SeverityLevel `json:"level"`
}
@@ -134,7 +134,7 @@ type DeviceThresholdAlarmDTO struct {
ID int `json:"id"`
DeviceID uint `json:"device_id"`
SensorType models.SensorType `json:"sensor_type"`
Thresholds float64 `json:"thresholds"`
Thresholds float32 `json:"thresholds"`
Operator models.Operator `json:"operator"`
Level models.SeverityLevel `json:"level"`
}

View File

@@ -227,9 +227,9 @@ type RawMaterialPurchaseDTO struct {
RawMaterialID uint `json:"raw_material_id"`
RawMaterial RawMaterialDTO `json:"raw_material"`
Supplier string `json:"supplier"`
Amount float64 `json:"amount"`
UnitPrice float64 `json:"unit_price"`
TotalPrice float64 `json:"total_price"`
Amount float32 `json:"amount"`
UnitPrice float32 `json:"unit_price"`
TotalPrice float32 `json:"total_price"`
PurchaseDate time.Time `json:"purchase_date"`
CreatedAt time.Time `json:"created_at"`
}
@@ -258,7 +258,7 @@ type ListRawMaterialStockLogRequest struct {
type RawMaterialStockLogDTO struct {
ID uint `json:"id"`
RawMaterialID uint `json:"raw_material_id"`
ChangeAmount float64 `json:"change_amount"`
ChangeAmount float32 `json:"change_amount"`
SourceType models.StockLogSourceType `json:"source_type"`
SourceID uint `json:"source_id"`
HappenedAt time.Time `json:"happened_at"`
@@ -304,7 +304,7 @@ type FeedUsageRecordDTO struct {
Pen PenDTO `json:"pen"`
FeedFormulaID uint `json:"feed_formula_id"`
FeedFormula FeedFormulaDTO `json:"feed_formula"`
Amount float64 `json:"amount"`
Amount float32 `json:"amount"`
RecordedAt time.Time `json:"recorded_at"`
OperatorID uint `json:"operator_id"`
Remarks string `json:"remarks"`
@@ -343,7 +343,7 @@ type MedicationLogDTO struct {
PigBatchID uint `json:"pig_batch_id"`
MedicationID uint `json:"medication_id"`
Medication MedicationDTO `json:"medication"`
DosageUsed float64 `json:"dosage_used"`
DosageUsed float32 `json:"dosage_used"`
TargetCount int `json:"target_count"`
Reason models.MedicationReasonType `json:"reason"`
Description string `json:"description"`
@@ -439,7 +439,7 @@ type WeighingRecordDTO struct {
ID uint `json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Weight float64 `json:"weight"`
Weight float32 `json:"weight"`
WeighingBatchID uint `json:"weighing_batch_id"`
PenID uint `json:"pen_id"`
OperatorID uint `json:"operator_id"`
@@ -552,8 +552,8 @@ type PigPurchaseDTO struct {
PurchaseDate time.Time `json:"purchase_date"`
Supplier string `json:"supplier"`
Quantity int `json:"quantity"`
UnitPrice float64 `json:"unit_price"`
TotalPrice float64 `json:"total_price"`
UnitPrice float32 `json:"unit_price"`
TotalPrice float32 `json:"total_price"`
Remarks string `json:"remarks"`
OperatorID uint `json:"operator_id"`
}
@@ -587,8 +587,8 @@ type PigSaleDTO struct {
SaleDate time.Time `json:"sale_date"`
Buyer string `json:"buyer"`
Quantity int `json:"quantity"`
UnitPrice float64 `json:"unit_price"`
TotalPrice float64 `json:"total_price"`
UnitPrice float32 `json:"unit_price"`
TotalPrice float32 `json:"total_price"`
Remarks string `json:"remarks"`
OperatorID uint `json:"operator_id"`
}

View File

@@ -74,8 +74,8 @@ type MovePigsIntoPenRequest struct {
type SellPigsRequest struct {
PenID uint `json:"pen_id" validate:"required"` // 猪栏ID
Quantity int `json:"quantity" validate:"required,min=1"` // 卖出猪只数量
UnitPrice float64 `json:"unit_price" validate:"required,min=0"` // 单价
TotalPrice float64 `json:"total_price" validate:"required,min=0"` // 总价
UnitPrice float32 `json:"unit_price" validate:"required,min=0"` // 单价
TotalPrice float32 `json:"total_price" validate:"required,min=0"` // 总价
TraderName string `json:"trader_name" validate:"required"` // 交易方名称
TradeDate time.Time `json:"trade_date" validate:"required"` // 交易日期
Remarks string `json:"remarks"` // 备注
@@ -85,8 +85,8 @@ type SellPigsRequest struct {
type BuyPigsRequest struct {
PenID uint `json:"pen_id" validate:"required"` // 猪栏ID
Quantity int `json:"quantity" validate:"required,min=1"` // 买入猪只数量
UnitPrice float64 `json:"unit_price" validate:"required,min=0"` // 单价
TotalPrice float64 `json:"total_price" validate:"required,min=0"` // 总价
UnitPrice float32 `json:"unit_price" validate:"required,min=0"` // 单价
TotalPrice float32 `json:"total_price" validate:"required,min=0"` // 总价
TraderName string `json:"trader_name" validate:"required"` // 交易方名称
TradeDate time.Time `json:"trade_date" validate:"required"` // 交易日期
Remarks string `json:"remarks"` // 备注