12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package model
- import (
- "fmt"
- "strings"
- pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
- )
- type FrozenSemenLog struct {
- Id int64 `json:"id"`
- PastureId int64 `json:"pastureId"`
- BullId string `json:"bullId"`
- CowIds string `json:"cowId"`
- Quantity int32 `json:"quantity"`
- MatingAt int64 `json:"matingAt"`
- OperationId int64 `json:"operationId"`
- OperationName string `json:"operationName"`
- Remarks string `json:"remarks"`
- CreatedAt int64 `json:"createdAt"`
- UpdatedAt int64 `json:"updatedAt"`
- }
- func (e *FrozenSemenLog) TableName() string {
- return "frozen_semen_log"
- }
- func NewEventFrozenSemenLog(pastureId int64, req *pasturePb.EventMating) *FrozenSemenLog {
- cowIds := ""
- for _, v := range req.CowIds {
- cowIds += fmt.Sprintf("%d,", v)
- }
- if len(cowIds) > 0 {
- cowIds = strings.TrimRight(cowIds, ",")
- }
- return &FrozenSemenLog{
- PastureId: pastureId,
- BullId: req.FrozenSemenNumber,
- CowIds: cowIds,
- OperationId: int64(req.OperationId),
- OperationName: req.OperationName,
- Quantity: req.FrozenSemenCount,
- MatingAt: int64(req.MatingAt),
- Remarks: req.Remarks,
- }
- }
|