40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// PigPurchase 记录了猪只采购信息
|
|
type PigPurchase struct {
|
|
Model
|
|
PigBatchID uint32 `gorm:"not null;index;comment:关联的猪批次ID"`
|
|
PurchaseDate time.Time `gorm:"primaryKey;comment:采购日期"`
|
|
Supplier string `gorm:"comment:供应商"`
|
|
Quantity int `gorm:"not null;comment:采购数量"`
|
|
UnitPrice float32 `gorm:"not null;comment:单价"`
|
|
TotalPrice float32 `gorm:"not null;comment:总价"`
|
|
Remarks string `gorm:"size:255;comment:备注"`
|
|
OperatorID uint32 `gorm:"comment:操作员ID"`
|
|
}
|
|
|
|
func (PigPurchase) TableName() string {
|
|
return "pig_purchases"
|
|
}
|
|
|
|
// PigSale 记录了猪只销售信息
|
|
type PigSale struct {
|
|
Model
|
|
PigBatchID uint32 `gorm:"not null;index;comment:关联的猪批次ID"`
|
|
SaleDate time.Time `gorm:"primaryKey;comment:销售日期"`
|
|
Buyer string `gorm:"comment:购买方"`
|
|
Quantity int `gorm:"not null;comment:销售数量"`
|
|
UnitPrice float32 `gorm:"not null;comment:单价"`
|
|
TotalPrice float32 `gorm:"not null;comment:总价"`
|
|
Remarks string `gorm:"size:255;comment:备注"`
|
|
OperatorID uint32 `gorm:"comment:操作员ID"`
|
|
}
|
|
|
|
func (PigSale) TableName() string {
|
|
return "pig_sales"
|
|
}
|