event_body_score.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package model
  2. import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  3. type EventBodyScore struct {
  4. Id int64 `json:"id"`
  5. PastureId int64 `json:"pastureId"`
  6. CowId int64 `json:"cowId"`
  7. EarNumber string `json:"earNumber"`
  8. Score int32 `json:"score"`
  9. Lact int32 `json:"lact"`
  10. DayAge int32 `json:"dayAge"`
  11. ScoreAt int64 `json:"scoreAt"`
  12. Remarks string `json:"remarks"`
  13. MessageId int64 `json:"messageId"`
  14. MessageName string `json:"messageName"`
  15. OperationId int64 `json:"operationId"`
  16. OperationName string `json:"operationName"`
  17. CreatedAt int64 `json:"createdAt"`
  18. UpdatedAt int64 `json:"updatedAt"`
  19. }
  20. func (e *EventBodyScore) TableName() string {
  21. return "event_body_score"
  22. }
  23. func NewEventBodyScore(cow *Cow, pastureId int64, currentUser *SystemUser, req *pasturePb.BodyScoreEventRequest) *EventBodyScore {
  24. return &EventBodyScore{
  25. PastureId: pastureId,
  26. CowId: cow.Id,
  27. EarNumber: cow.EarNumber,
  28. Score: req.Score,
  29. Lact: cow.Lact,
  30. DayAge: cow.GetDayAge(),
  31. ScoreAt: int64(req.ScoreAt),
  32. Remarks: req.Remarks,
  33. MessageId: currentUser.Id,
  34. MessageName: currentUser.Name,
  35. OperationId: int64(req.OperationId),
  36. OperationName: req.OperationName,
  37. }
  38. }