|
@@ -3,37 +3,42 @@ package model
|
|
|
import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
|
|
|
|
|
|
type EventEstrus struct {
|
|
|
- Id int64 `json:"id"`
|
|
|
- CowId int64 `json:"cowId"`
|
|
|
- DayAge int32 `json:"dayAge"`
|
|
|
- Lact int8 `json:"lact"`
|
|
|
- LactationDays int32 `json:"lactationDays"`
|
|
|
- EstrusAt int64 `json:"estrusAt"`
|
|
|
- Remarks string `json:"remarks"`
|
|
|
- OperationId int64 `json:"operationId"`
|
|
|
- OperationName string `json:"operationName"`
|
|
|
- MessageId int64 `json:"messageId"`
|
|
|
- MessageName string `json:"messageName"`
|
|
|
- CreatedAt int64 `json:"createdAt"`
|
|
|
- UpdatedAt int64 `json:"updatedAt"`
|
|
|
+ Id int64 `json:"id"`
|
|
|
+ CowId int64 `json:"cowId"`
|
|
|
+ DayAge int32 `json:"dayAge"`
|
|
|
+ Lact int8 `json:"lact"`
|
|
|
+ LactationDays int32 `json:"lactationDays"`
|
|
|
+ EstrusAt int64 `json:"estrusAt"`
|
|
|
+ UnMatingReasons pasturePb.UnMatingReasons_Kind `json:"unMatingReasons"`
|
|
|
+ UnMatingReasonsName string `json:"unMatingReasonsName"`
|
|
|
+ IsMating pasturePb.IsShow_Kind `json:"isMating"`
|
|
|
+ Remarks string `json:"remarks"`
|
|
|
+ OperationId int64 `json:"operationId"`
|
|
|
+ OperationName string `json:"operationName"`
|
|
|
+ MessageId int64 `json:"messageId"`
|
|
|
+ MessageName string `json:"messageName"`
|
|
|
+ CreatedAt int64 `json:"createdAt"`
|
|
|
+ UpdatedAt int64 `json:"updatedAt"`
|
|
|
}
|
|
|
|
|
|
func (e *EventEstrus) TableName() string {
|
|
|
return "event_estrus"
|
|
|
}
|
|
|
|
|
|
-func NewEventEstrus(cow *Cow, currentUser *SystemUser, req *pasturePb.EventEstrus) *EventEstrus {
|
|
|
+func NewEventEstrus(cow *Cow, currentUser *SystemUser, operation *SystemUser, req *pasturePb.EventEstrus) *EventEstrus {
|
|
|
return &EventEstrus{
|
|
|
- CowId: cow.Id,
|
|
|
- DayAge: cow.GetDayAge(),
|
|
|
- Lact: int8(cow.Lact),
|
|
|
- LactationDays: cow.GetLactationDays(),
|
|
|
- EstrusAt: int64(req.EstrusAt),
|
|
|
- Remarks: req.Remarks,
|
|
|
- MessageId: currentUser.Id,
|
|
|
- MessageName: currentUser.Name,
|
|
|
- OperationId: int64(req.OperationId),
|
|
|
- OperationName: req.OperationName,
|
|
|
+ CowId: cow.Id,
|
|
|
+ DayAge: cow.GetDayAge(),
|
|
|
+ Lact: int8(cow.Lact),
|
|
|
+ LactationDays: cow.GetLactationDays(),
|
|
|
+ EstrusAt: int64(req.EstrusAt),
|
|
|
+ Remarks: req.Remarks,
|
|
|
+ IsMating: req.IsMathing,
|
|
|
+ UnMatingReasons: req.UnMatingReasons,
|
|
|
+ MessageId: currentUser.Id,
|
|
|
+ MessageName: currentUser.Name,
|
|
|
+ OperationId: operation.Id,
|
|
|
+ OperationName: operation.Name,
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -43,19 +48,21 @@ func (e EstrusSlice) ToPB() []*pasturePb.SearchEstrusList {
|
|
|
res := make([]*pasturePb.SearchEstrusList, len(e))
|
|
|
for i, v := range e {
|
|
|
res[i] = &pasturePb.SearchEstrusList{
|
|
|
- Id: int32(v.Id),
|
|
|
- CowId: int32(v.CowId),
|
|
|
- DayAge: v.DayAge,
|
|
|
- Lact: int32(v.Lact),
|
|
|
- EstrusAt: int32(v.EstrusAt),
|
|
|
- LactationDays: v.LactationDays,
|
|
|
- MessengerId: int32(v.MessageId),
|
|
|
- MessengerName: v.MessageName,
|
|
|
- Remarks: v.Remarks,
|
|
|
- OperationId: int32(v.OperationId),
|
|
|
- OperationName: v.OperationName,
|
|
|
- CreatedAt: int32(v.CreatedAt),
|
|
|
- UpdatedAt: int32(v.UpdatedAt),
|
|
|
+ Id: int32(v.Id),
|
|
|
+ CowId: int32(v.CowId),
|
|
|
+ DayAge: v.DayAge,
|
|
|
+ Lact: int32(v.Lact),
|
|
|
+ EstrusAt: int32(v.EstrusAt),
|
|
|
+ IsMathing: v.IsMating,
|
|
|
+ UnMatingReasonsName: v.UnMatingReasonsName,
|
|
|
+ LactationDays: v.LactationDays,
|
|
|
+ MessengerId: int32(v.MessageId),
|
|
|
+ MessengerName: v.MessageName,
|
|
|
+ Remarks: v.Remarks,
|
|
|
+ OperationId: int32(v.OperationId),
|
|
|
+ OperationName: v.OperationName,
|
|
|
+ CreatedAt: int32(v.CreatedAt),
|
|
|
+ UpdatedAt: int32(v.UpdatedAt),
|
|
|
}
|
|
|
}
|
|
|
return res
|