event_body_score.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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:"cow_id"`
  6. EarNumber string `json:"ear_number"`
  7. Score int32 `json:"score"`
  8. Lact int32 `json:"lact"`
  9. DayAge int32 `json:"day_age"`
  10. ScoreAt int64 `json:"score_at"`
  11. Remarks string `json:"remarks"`
  12. StaffMemberId int64 `json:"staff_member_id"`
  13. OperationId int64 `json:"operation_id"`
  14. CreatedAt int64 `json:"created_at"`
  15. UpdatedAt int64 `json:"updated_at"`
  16. }
  17. func (e *EventBodyScore) TableName() string {
  18. return "event_body_score"
  19. }
  20. func NewEventBodyScore(cow *Cow, operationId int64, req *pasturePb.BodyScoreEventRequest) *EventBodyScore {
  21. return &EventBodyScore{
  22. CowId: cow.Id,
  23. EarNumber: cow.EarNumber,
  24. Score: req.Score,
  25. Lact: cow.Lact,
  26. DayAge: cow.GetDayAge(),
  27. ScoreAt: int64(req.ScoreAt),
  28. Remarks: req.Remarks,
  29. StaffMemberId: int64(req.StaffMemberId),
  30. OperationId: operationId,
  31. }
  32. }