package model import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow" type EventBodyScore struct { Id int64 `json:"id"` PastureId int64 `json:"pastureId"` CowId int64 `json:"cowId"` EarNumber string `json:"earNumber"` Score int32 `json:"score"` Lact int32 `json:"lact"` DayAge int32 `json:"dayAge"` ScoreAt int64 `json:"scoreAt"` Remarks string `json:"remarks"` MessageId int64 `json:"messageId"` MessageName string `json:"messageName"` OperationId int64 `json:"operationId"` OperationName string `json:"operationName"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } func (e *EventBodyScore) TableName() string { return "event_body_score" } func NewEventBodyScore(cow *Cow, pastureId int64, currentUser *SystemUser, req *pasturePb.BodyScoreEventRequest) *EventBodyScore { return &EventBodyScore{ PastureId: pastureId, CowId: cow.Id, EarNumber: cow.EarNumber, Score: req.Score, Lact: cow.Lact, DayAge: cow.GetDayAge(), ScoreAt: int64(req.ScoreAt), Remarks: req.Remarks, MessageId: currentUser.Id, MessageName: currentUser.Name, OperationId: int64(req.OperationId), OperationName: req.OperationName, } }