package model import "fmt" type PartPurchase struct { Id int64 `gorm:"column:id"` BigId int64 `gorm:"column:bigId"` PastureId int64 `gorm:"column:pastureId"` PartId int64 `gorm:"column:partId"` PartName string `gorm:"column:partName"` PartCode string `gorm:"column:partCode"` Amount int64 `gorm:"column:amount"` Note string `gorm:"column:note"` IsStorage int32 `gorm:"column:isStorage"` Specification string `gorm:"column:specification"` Purpose string `gorm:"column:purpose"` Unit string `gorm:"column:unit"` BrandId int64 `gorm:"column:brandId"` StorageAmount float64 `gorm:"column:storageAmount"` Price string `gorm:"column:price"` ContractId string `gorm:"column:contractId"` } func (p *PartPurchase) TableName() string { return "partpurchase" } func NewPartPurchase( bigId, pastureId, partId, brandId, amount, contractId int64, partCode, partName, specification, unit, purpose, price string, storageAmount float64, ) *PartPurchase { return &PartPurchase{ BigId: bigId, PastureId: pastureId, PartId: partId, PartName: partName, PartCode: partCode, Amount: amount, Note: "", IsStorage: 1, Specification: specification, Purpose: purpose, Unit: unit, BrandId: brandId, StorageAmount: storageAmount, Price: price, ContractId: fmt.Sprintf("%d", contractId), } }