123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package model
- import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
- type EventCalvingCalf struct {
- Id int64 `json:"id"`
- CalvingId int64 `json:"calving_id"`
- CowId int64 `json:"cow_id"`
- MotherId int64 `json:"mother_id"`
- EarNumber string `json:"ear_number"`
- Sex pasturePb.Genders_Kind `json:"sex"`
- Weight int64 `json:"weight"`
- IsLive pasturePb.IsShow_Kind `json:"is_live"`
- IsAdoption pasturePb.IsShow_Kind `json:"is_adoption"`
- PenId int64 `json:"pen_id"`
- Remarks string `json:"remarks"`
- CreatedAt int64 `json:"created_at"`
- UpdatedAt int64 `json:"updated_at"`
- }
- func (e *EventCalvingCalf) TableName() string {
- return "event_calving_calf"
- }
- func NewEventCalvingCalf(motherId, calvingId int64, req *pasturePb.CalvingEventRequest) []*EventCalvingCalf {
- calvingCalfList := make([]*EventCalvingCalf, 0)
- for _, v := range req.CalfItemList {
- calvingCalfList = append(calvingCalfList, &EventCalvingCalf{
- CowId: 0, // TODO: cowId
- EarNumber: "", // TODO: 耳号
- CalvingId: calvingId,
- PenId: 0, // TODO: penId
- Weight: int64(v.Weight * 100),
- Sex: v.Sex,
- MotherId: motherId,
- Remarks: v.Remarks,
- IsAdoption: v.IsAdoption,
- IsLive: v.IsLive,
- })
- }
- return calvingCalfList
- }
|