uint/uint64全部改为uint32
This commit is contained in:
@@ -2,8 +2,6 @@ package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
/*
|
||||
@@ -32,7 +30,7 @@ const (
|
||||
|
||||
// PigBatch 是猪批次的核心模型,代表了一群被共同管理的猪
|
||||
type PigBatch struct {
|
||||
gorm.Model
|
||||
Model
|
||||
BatchNumber string `gorm:"size:50;not null;uniqueIndex;comment:批次编号,如 2024-W25-A01"`
|
||||
OriginType PigBatchOriginType `gorm:"size:20;not null;comment:批次来源 (自繁, 外购)"`
|
||||
StartDate time.Time `gorm:"not null;comment:批次开始日期 (如转入日或购买日)"`
|
||||
@@ -65,14 +63,14 @@ const (
|
||||
|
||||
// PigBatchLog 记录了猪批次数量或状态的每一次变更
|
||||
type PigBatchLog struct {
|
||||
gorm.Model
|
||||
PigBatchID uint `gorm:"not null;index;comment:关联的猪批次ID"`
|
||||
Model
|
||||
PigBatchID uint32 `gorm:"not null;index;comment:关联的猪批次ID"`
|
||||
ChangeType LogChangeType `gorm:"size:20;not null;comment:变更类型"`
|
||||
ChangeCount int `gorm:"not null;comment:数量变化,负数表示减少"`
|
||||
Reason string `gorm:"size:255;comment:变更原因描述"`
|
||||
BeforeCount int `gorm:"not null;comment:变更前总数"`
|
||||
AfterCount int `gorm:"not null;comment:变更后总数"`
|
||||
OperatorID uint `gorm:"comment:操作员ID"`
|
||||
OperatorID uint32 `gorm:"comment:操作员ID"`
|
||||
HappenedAt time.Time `gorm:"primaryKey;comment:事件发生时间"`
|
||||
}
|
||||
|
||||
@@ -82,10 +80,10 @@ func (PigBatchLog) TableName() string {
|
||||
|
||||
// WeighingBatch 记录了一次批次称重的信息
|
||||
type WeighingBatch struct {
|
||||
gorm.Model
|
||||
Model
|
||||
WeighingTime time.Time `gorm:"primaryKey;comment:称重时间"`
|
||||
Description string `gorm:"size:255;comment:批次称重描述"`
|
||||
PigBatchID uint `gorm:"not null;index;comment:关联的猪批次ID"`
|
||||
PigBatchID uint32 `gorm:"not null;index;comment:关联的猪批次ID"`
|
||||
}
|
||||
|
||||
func (WeighingBatch) TableName() string {
|
||||
@@ -94,11 +92,11 @@ func (WeighingBatch) TableName() string {
|
||||
|
||||
// WeighingRecord 记录了单次称重信息
|
||||
type WeighingRecord struct {
|
||||
gorm.Model
|
||||
Model
|
||||
Weight float32 `gorm:"not null;comment:单只猪重量 (kg)"`
|
||||
WeighingBatchID uint `gorm:"not null;index;comment:关联的批次称重ID"`
|
||||
PenID uint `gorm:"not null;index;comment:所在猪圈ID"`
|
||||
OperatorID uint `gorm:"not null;comment:操作员ID"`
|
||||
WeighingBatchID uint32 `gorm:"not null;index;comment:关联的批次称重ID"`
|
||||
PenID uint32 `gorm:"not null;index;comment:所在猪圈ID"`
|
||||
OperatorID uint32 `gorm:"not null;comment:操作员ID"`
|
||||
Remark string `gorm:"size:255;comment:备注"`
|
||||
WeighingTime time.Time `gorm:"primaryKey;comment:称重时间"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user