package model import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow" type EventSaleCow struct { Id int64 `json:"id"` PastureId int64 `json:"pastureId"` SaleId int64 `json:"saleId"` CowId int64 `json:"cowId"` EarNumber string `json:"earNumber"` Lact int32 `json:"lact"` PregnancyAge int32 `json:"pregnancyAge"` BreedStatus pasturePb.BreedStatus_Kind `json:"breedStatus"` LactationAge int32 `json:"lactationAge"` CalvingAge int32 `json:"calvingAge"` AdmissionAge int32 `json:"admissionAge"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } func (e *EventSaleCow) TableName() string { return "event_sale_cow" } func NewEventSaleCow(pastureId int64, saleId int64, cowInfo *Cow) *EventSaleCow { return &EventSaleCow{ PastureId: pastureId, SaleId: saleId, CowId: cowInfo.Id, Lact: cowInfo.Lact, EarNumber: cowInfo.EarNumber, PregnancyAge: cowInfo.PregnancyAge, BreedStatus: cowInfo.BreedStatus, LactationAge: cowInfo.LactationAge, AdmissionAge: cowInfo.AdmissionAge, } } func NewEventSaleCowList(pastureId int64, saleId int64, cowList []*Cow) []*EventSaleCow { res := make([]*EventSaleCow, 0) for _, cow := range cowList { res = append(res, NewEventSaleCow(pastureId, saleId, cow)) } return res }