package model import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow" type EventWeight struct { ID int64 `json:"id"` CowId int64 `json:"cowId"` EarNumber string `json:"earNumber"` DayAge int32 `json:"dayAge"` LactationDay int64 `json:"lactationDay"` PenId int32 `json:"penId"` Lact int32 `json:"lact"` Weight int32 `json:"weight"` Height int32 `json:"height"` WeightAt int64 `json:"weightAt"` Remarks string `json:"remarks"` OperationId int32 `json:"operationId"` OperationName string `json:"operationName"` MessageId int64 `json:"messageId"` MessageName string `json:"messageName"` CreatedAt int64 `json:"created_at"` UpdatedAt int64 `json:"updated_at"` } func (c *EventWeight) TableName() string { return "event_weight" } func NewEventWeight(cow *Cow, currentUser *SystemUser, weight, height int32, req *pasturePb.EventWeight) *EventWeight { return &EventWeight{ CowId: cow.Id, EarNumber: cow.EarNumber, Weight: weight, Height: height, Lact: cow.Lact, DayAge: cow.GetDayAge(), WeightAt: int64(req.WeightAt), Remarks: req.Remarks, MessageId: currentUser.Id, MessageName: currentUser.Name, OperationId: req.OperationId, OperationName: req.OperationName, } }