package model import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow" type EventDeparture struct { Id int64 `json:"id"` PastureId int64 `json:"pastureId"` CowId int64 `json:"cowId"` Lact int32 `json:"lact"` DayAge int32 `json:"dayAge"` DepartureAt int64 `json:"departureAt"` DepartureType pasturePb.DepartureType_Kind `json:"departureType"` ReasonId int32 `json:"reasonId"` ReasonName string `json:"reasonName"` Remarks string `json:"remarks"` Weight int32 `json:"weight"` OperationId int64 `json:"operationId"` OperationName string `json:"operationName"` MessageId int64 `json:"messageId"` MessageName string `json:"messageName"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } func (e *EventDeparture) TableName() string { return "event_departure" } func NewEventDeparture(pastureId int64, cow *Cow, req *pasturePb.EventDeparture, reasonName string, currentUser, operationUser *SystemUser) *EventDeparture { return &EventDeparture{ PastureId: pastureId, CowId: cow.Id, Lact: cow.Lact, DayAge: cow.GetDayAge(), DepartureAt: int64(req.DepartureAt), DepartureType: req.DepartureType, ReasonId: req.DepartureReasonKind, ReasonName: reasonName, Remarks: req.Remarks, OperationId: operationUser.Id, OperationName: operationUser.Name, MessageId: currentUser.Id, MessageName: currentUser.Name, } } type EventDepartureModel struct { EventDeparture *EventDeparture Cow *Cow DepartureAt int64 }