package model import ( pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow" ) type CowPregnant struct { Id int64 `json:"id"` PastureId int64 `json:"pastureId"` CowId int64 `json:"cowId"` EarNumber string `json:"earNumber"` Lact int32 `json:"lact"` PregnancyAge int32 `json:"pregnancyAge"` CowType pasturePb.CowType_Kind `json:"cowType"` DateTime string `json:"dateTime"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } func (c *CowPregnant) TableName() string { return "cow_pregnant" } func NewCowPregnant(pastureId int64, cowInfo *Cow, dateTime string) *CowPregnant { return &CowPregnant{ PastureId: pastureId, CowId: cowInfo.Id, EarNumber: cowInfo.EarNumber, Lact: cowInfo.Lact, CowType: cowInfo.CowType, PregnancyAge: cowInfo.GetDaysPregnant(), DateTime: dateTime, } } type CowPregnantMonth struct { Month string `json:"month"` CowCount int32 `json:"cowCount"` }