123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- 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"`
- 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,
- 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"`
- }
|