| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 | 
							- package model
 
- import (
 
- 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
 
- )
 
- type EventForbiddenMating struct {
 
- 	Id                         int64                                 `json:"id"`
 
- 	PastureId                  int64                                 `json:"pastureId"`
 
- 	CowId                      int64                                 `json:"cowId"`
 
- 	EarNumber                  string                                `json:"earNumber"`
 
- 	DayAge                     int32                                 `json:"dayAge"`
 
- 	ForbiddenMatingAt          int64                                 `json:"forbiddenMatingAt"`
 
- 	ForbiddenMatingReasonsKind pasturePb.ForbiddenMatingReasons_Kind `json:"forbiddenMatingReasonsKind"`
 
- 	ForbiddenMatingReasonsName string                                `json:"forbiddenMatingReasonsName"`
 
- 	UnForbiddenMatingAt        int64                                 `json:"unForbiddenMatingAt"`
 
- 	OperationId                int64                                 `json:"operationId"`
 
- 	OperationName              string                                `json:"operationName"`
 
- 	UnForbiddenOperationId     int64                                 `json:"unForbiddenOperationId"`
 
- 	UnForbiddenOperationName   string                                `json:"unForbiddenOperationName"`
 
- 	Remarks                    string                                `json:"remarks"`
 
- 	IsShow                     pasturePb.IsShow_Kind                 `json:"isShow"`
 
- 	MessageId                  int64                                 `json:"messageId"`
 
- 	MessageName                string                                `json:"messageName"`
 
- 	CreatedAt                  int64                                 `json:"createdAt"`
 
- 	UpdatedAt                  int64                                 `json:"updatedAt"`
 
- }
 
- func (e *EventForbiddenMating) TableName() string {
 
- 	return "event_forbidden_mating"
 
- }
 
- func (e *EventForbiddenMating) UnForbiddenMatingUpdate(unForbiddenMatingAt int64, currentUser *SystemUser) {
 
- 	e.UnForbiddenMatingAt = unForbiddenMatingAt
 
- 	e.IsShow = pasturePb.IsShow_No
 
- 	e.UnForbiddenOperationId = currentUser.Id
 
- 	e.UnForbiddenOperationName = currentUser.Name
 
- }
 
- func NewEventForbiddenMating(pastureId int64, cow *Cow, forbiddenMatingAt int64, forbiddenMatingReasonsKind pasturePb.ForbiddenMatingReasons_Kind,
 
- 	forbiddenMatingReasonsName, remarks string, operationUser, currentUser *SystemUser) *EventForbiddenMating {
 
- 	return &EventForbiddenMating{
 
- 		PastureId:                  pastureId,
 
- 		CowId:                      cow.Id,
 
- 		EarNumber:                  cow.EarNumber,
 
- 		DayAge:                     cow.GetEventDayAge(forbiddenMatingAt),
 
- 		ForbiddenMatingAt:          forbiddenMatingAt,
 
- 		ForbiddenMatingReasonsKind: forbiddenMatingReasonsKind,
 
- 		ForbiddenMatingReasonsName: forbiddenMatingReasonsName,
 
- 		OperationId:                operationUser.Id,
 
- 		OperationName:              operationUser.Name,
 
- 		Remarks:                    remarks,
 
- 		MessageId:                  currentUser.Id,
 
- 		MessageName:                currentUser.Name,
 
- 		IsShow:                     pasturePb.IsShow_Ok,
 
- 	}
 
- }
 
- type EventForbiddenMatingSlice []*EventForbiddenMating
 
- func (e EventForbiddenMatingSlice) ToPB() []*pasturePb.ForbiddenMatingItem {
 
- 	res := make([]*pasturePb.ForbiddenMatingItem, len(e))
 
- 	for i, v := range e {
 
- 		res[i] = &pasturePb.ForbiddenMatingItem{
 
- 			Id:                         int32(v.Id),
 
- 			CowId:                      int32(v.CowId),
 
- 			EarNumber:                  v.EarNumber,
 
- 			ForbiddenMatingAt:          int32(v.ForbiddenMatingAt),
 
- 			ForbiddenMatingReasonsKind: v.ForbiddenMatingReasonsKind,
 
- 			ForbiddenMatingReasonsName: v.ForbiddenMatingReasonsName,
 
- 			Remarks:                    v.Remarks,
 
- 			OperationId:                int32(v.OperationId),
 
- 			OperationName:              v.OperationName,
 
- 			CreatedAt:                  int32(v.CreatedAt),
 
- 			UpdatedAt:                  int32(v.UpdatedAt),
 
- 		}
 
- 	}
 
- 	return res
 
- }
 
- type EventForbiddenMatingItem struct {
 
- 	Cow                        *Cow                                  `json:"cow"`
 
- 	ForbiddenMatingAt          int64                                 `json:"forbiddenMatingAt"`
 
- 	ForbiddenMatingReasonsKind pasturePb.ForbiddenMatingReasons_Kind `json:"forbiddenMatingReasonsKind"`
 
- 	ForbiddenMatingReasonsName string                                `json:"forbiddenMatingReasonsName"`
 
- 	Remarks                    string                                `json:"remarks"`
 
- 	OperationUser              *SystemUser                           `json:"operationUser"`
 
- 	MessageUser                *SystemUser                           `json:"messageUser"`
 
- }
 
 
  |