12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- package model
- import (
- "time"
- pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
- )
- type EventWeaning struct {
- Id int64 `json:"id"`
- CowId int64 `json:"cowId"`
- PlanDay string `json:"planDay"`
- EndDay string `json:"endDay"`
- RealityDay string `json:"realityDay"`
- Status pasturePb.IsShow_Kind `json:"status"`
- BeforePenId int32 `json:"beforePenId"`
- AfterPenId int32 `json:"afterPenId"`
- RealityDayAge int32 `json:"realityDayAge"`
- Remarks string `json:"remarks"`
- OperationId int32 `json:"operationId"`
- OperationName string `json:"operationName"`
- CreatedAt int64 `json:"createdAt"`
- UpdatedAt int64 `json:"updatedAt"`
- }
- func (c *EventWeaning) TableName() string {
- return "event_weaning"
- }
- func NewEventWeaning(cowId int64, planDay int64, penId int32) *EventWeaning {
- return &EventWeaning{
- CowId: cowId,
- PlanDay: time.Unix(planDay, 0).Format(LayoutDate2),
- EndDay: time.Unix(planDay, 0).Format(LayoutDate2),
- Status: pasturePb.IsShow_No,
- BeforePenId: penId,
- }
- }
- func NewEventWeaningList(cowList []*Cow, planDay int64) []*EventWeaning {
- var weaningList = make([]*EventWeaning, 0)
- for _, cow := range cowList {
- weaningList = append(weaningList, NewEventWeaning(cow.Id, planDay, cow.PenId))
- }
- return weaningList
- }
- type WeaningHeader struct {
- Id string `json:"id"`
- CowId string `json:"cowId"`
- DayAge string `json:"dayAge"`
- PlanDay string `json:"planDay"`
- Status string `json:"status"`
- PenName string `json:"penName"`
- }
- type WeaningBody struct {
- Id int64 `json:"id"`
- CowId int64 `json:"cowId"`
- DayAge int64 `json:"dayAge"`
- PlanDay string `json:"planDay"`
- Status pasturePb.IsShow_Kind `json:"status"`
- PenName string `json:"penName"`
- }
|