partpurchase.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package model
  2. type PartPurchase struct {
  3. Id int64 `gorm:"column:id"`
  4. BigId int64 `gorm:"column:bigId"`
  5. PastureId int64 `gorm:"column:pastureId"`
  6. PartId int64 `gorm:"column:partId"`
  7. PartName string `gorm:"column:partName"`
  8. PartCode string `gorm:"column:partCode"`
  9. Amount int64 `gorm:"column:amount"`
  10. Note string `gorm:"column:note"`
  11. IsStorage int32 `gorm:"column:isStorage"`
  12. Specification string `gorm:"column:specification"`
  13. Purpose string `gorm:"column:purpose"`
  14. Unit string `gorm:"column:unit"`
  15. BrandId int64 `gorm:"column:brandId"`
  16. StorageAmount float64 `gorm:"column:storageAmount"`
  17. Price string `gorm:"column:price"`
  18. ContractId string `gorm:"column:contractId"`
  19. }
  20. func (p *PartPurchase) TableName() string {
  21. return "partpurchase"
  22. }
  23. func NewPartPurchase(
  24. bigId, pastureId, partId, brandId, amount int64,
  25. contractId, partCode, partName, specification, unit, purpose, price string,
  26. storageAmount float64,
  27. ) *PartPurchase {
  28. return &PartPurchase{
  29. BigId: bigId,
  30. PastureId: pastureId,
  31. PartId: partId,
  32. PartName: partName,
  33. PartCode: partCode,
  34. Amount: amount,
  35. Note: "",
  36. IsStorage: 1,
  37. Specification: specification,
  38. Purpose: purpose,
  39. Unit: unit,
  40. BrandId: brandId,
  41. StorageAmount: storageAmount,
  42. Price: price,
  43. ContractId: contractId,
  44. }
  45. }