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

@@ -4,7 +4,6 @@ import (
"time"
"gorm.io/datatypes"
"gorm.io/gorm"
)
/*
@@ -57,7 +56,7 @@ type PowderInstructions struct {
// Medication 定义了兽药/疫苗的基本信息模型
type Medication struct {
gorm.Model
Model
Name string `gorm:"size:100;not null;comment:药品名称" json:"name"`
Type MedicationType `gorm:"size:20;not null;comment:兽药类型 (粉剂, 针剂, 疫苗)" json:"type"`
Category MedicationCategory `gorm:"size:30;not null;comment:兽药种类 (四环素类, 磺胺类等)" json:"category"`
@@ -82,15 +81,15 @@ const (
// MedicationLog 记录了对整个猪批次的用药情况
type MedicationLog struct {
gorm.Model
PigBatchID uint `gorm:"not null;index;comment:关联的猪批次ID"`
MedicationID uint `gorm:"not null;index;comment:关联的药品ID"`
Model
PigBatchID uint32 `gorm:"not null;index;comment:关联的猪批次ID"`
MedicationID uint32 `gorm:"not null;index;comment:关联的药品ID"`
Medication Medication `gorm:"foreignKey:MedicationID"` // 预加载药品信息
DosageUsed float32 `gorm:"not null;comment:使用的总剂量 (单位由药品决定,如g或ml)"`
TargetCount int `gorm:"not null;comment:用药对象数量"`
Reason MedicationReasonType `gorm:"size:20;not null;comment:用药原因"`
Description string `gorm:"size:255;comment:具体描述,如'治疗呼吸道病'"`
OperatorID uint `gorm:"comment:操作员ID"`
OperatorID uint32 `gorm:"comment:操作员ID"`
HappenedAt time.Time `gorm:"primaryKey;comment:用药时间"`
}