cow_pregnant.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package model
  2. import (
  3. pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  4. )
  5. type CowPregnant struct {
  6. Id int64 `json:"id"`
  7. PastureId int64 `json:"pastureId"`
  8. CowId int64 `json:"cowId"`
  9. EarNumber string `json:"earNumber"`
  10. Lact int32 `json:"lact"`
  11. PregnancyAge int32 `json:"pregnancyAge"`
  12. CowType pasturePb.CowType_Kind `json:"cowType"`
  13. DateTime string `json:"dateTime"`
  14. CreatedAt int64 `json:"createdAt"`
  15. UpdatedAt int64 `json:"updatedAt"`
  16. }
  17. func (c *CowPregnant) TableName() string {
  18. return "cow_pregnant"
  19. }
  20. func NewCowPregnant(pastureId int64, cowInfo *Cow, dateTime string) *CowPregnant {
  21. return &CowPregnant{
  22. PastureId: pastureId,
  23. CowId: cowInfo.Id,
  24. EarNumber: cowInfo.EarNumber,
  25. Lact: cowInfo.Lact,
  26. CowType: cowInfo.CowType,
  27. PregnancyAge: cowInfo.GetDaysPregnant(),
  28. DateTime: dateTime,
  29. }
  30. }
  31. type CowPregnantMonth struct {
  32. Month string `json:"month"`
  33. CowCount int32 `json:"cowCount"`
  34. }