event_body_score.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. CowId int64 `json:"cowId"`
  6. EarNumber string `json:"earNumber"`
  7. Score int32 `json:"score"`
  8. Lact int32 `json:"lact"`
  9. DayAge int32 `json:"dayAge"`
  10. ScoreAt int64 `json:"scoreAt"`
  11. Remarks string `json:"remarks"`
  12. MessageId int64 `json:"messageId"`
  13. MessageName string `json:"messageName"`
  14. OperationId int64 `json:"operationId"`
  15. OperationName string `json:"operationName"`
  16. CreatedAt int64 `json:"createdAt"`
  17. UpdatedAt int64 `json:"updatedAt"`
  18. }
  19. func (e *EventBodyScore) TableName() string {
  20. return "event_body_score"
  21. }
  22. func NewEventBodyScore(cow *Cow, currentSystemUser *SystemUser, req *pasturePb.BodyScoreEventRequest) *EventBodyScore {
  23. return &EventBodyScore{
  24. CowId: cow.Id,
  25. EarNumber: cow.EarNumber,
  26. Score: req.Score,
  27. Lact: cow.Lact,
  28. DayAge: cow.GetDayAge(),
  29. ScoreAt: int64(req.ScoreAt),
  30. Remarks: req.Remarks,
  31. MessageId: currentSystemUser.Id,
  32. MessageName: currentSystemUser.Name,
  33. OperationId: int64(req.OperationId),
  34. OperationName: req.OperationName,
  35. }
  36. }