event_weaning.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package model
  2. import (
  3. "time"
  4. pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  5. )
  6. type EventWeaning struct {
  7. Id int64 `json:"id"`
  8. CowId int64 `json:"cowId"`
  9. PlanDay string `json:"planDay"`
  10. EndDay string `json:"endDay"`
  11. RealityDay string `json:"realityDay"`
  12. Status pasturePb.IsShow_Kind `json:"status"`
  13. BeforePenId int32 `json:"beforePenId"`
  14. AfterPenId int32 `json:"afterPenId"`
  15. RealityDayAge int32 `json:"realityDayAge"`
  16. Remarks string `json:"remarks"`
  17. OperationId int32 `json:"operationId"`
  18. OperationName string `json:"operationName"`
  19. CreatedAt int64 `json:"createdAt"`
  20. UpdatedAt int64 `json:"updatedAt"`
  21. }
  22. func (c *EventWeaning) TableName() string {
  23. return "event_weaning"
  24. }
  25. func NewEventWeaning(cowId int64, planDay int64, penId int32) *EventWeaning {
  26. return &EventWeaning{
  27. CowId: cowId,
  28. PlanDay: time.Unix(planDay, 0).Format(LayoutDate2),
  29. EndDay: time.Unix(planDay, 0).Format(LayoutDate2),
  30. Status: pasturePb.IsShow_No,
  31. BeforePenId: penId,
  32. }
  33. }
  34. func NewEventWeaningList(cowList []*Cow, planDay int64) []*EventWeaning {
  35. var weaningList = make([]*EventWeaning, 0)
  36. for _, cow := range cowList {
  37. weaningList = append(weaningList, NewEventWeaning(cow.Id, planDay, cow.PenId))
  38. }
  39. return weaningList
  40. }
  41. type WeaningHeader struct {
  42. Id string `json:"id"`
  43. CowId string `json:"cowId"`
  44. DayAge string `json:"dayAge"`
  45. PlanDay string `json:"planDay"`
  46. Status string `json:"status"`
  47. PenName string `json:"penName"`
  48. }
  49. type WeaningBody struct {
  50. Id int64 `json:"id"`
  51. CowId int64 `json:"cowId"`
  52. DayAge int64 `json:"dayAge"`
  53. PlanDay string `json:"planDay"`
  54. Status pasturePb.IsShow_Kind `json:"status"`
  55. PenName string `json:"penName"`
  56. }