partpurchase.go 1.5 KB

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