package model import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow" type EventWeight struct { ID int64 `json:"id"` CowId int64 `json:"cow_id"` EarNumber string `json:"ear_number"` DayAge int32 `json:"day_age"` LactationDay int64 `json:"lactation_day"` PenId int32 `json:"pen_id"` Lact int32 `json:"lact"` Weight int32 `json:"weight"` WeightAt int64 `json:"weight_at"` Remarks string `json:"remarks"` OperationId int32 `json:"operation_id"` StaffMemberId int32 `json:"staff_member_id"` CreatedAt int64 `json:"created_at"` UpdatedAt int64 `json:"updated_at"` } func (c *EventWeight) TableName() string { return "event_weight" } func NewEventWeight(cow *Cow, systemUser *SystemUser, weight int32, req *pasturePb.EventWeight) *EventWeight { return &EventWeight{ CowId: cow.Id, EarNumber: cow.EarNumber, Weight: weight, Lact: cow.Lact, DayAge: cow.GetDayAge(), WeightAt: int64(req.WeightAt), Remarks: req.Remarks, StaffMemberId: req.StaffMemberId, OperationId: int32(systemUser.Id), } }