123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- package model
- import (
- pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
- )
- type CowSameTimeDetail struct {
- Id int64 `json:"id"`
- CowId int64 `json:"cowId"`
- PenId int32 `json:"penId"`
- PenName string `json:"penName"`
- Lact int32 `json:"lact"`
- SameTimeId int64 `json:"sameTimeId"`
- SameTimeType pasturePb.SameTimeType_Kind `json:"sameTimeType"`
- PlanDay string `json:"planDay"`
- EndDay string `json:"endDay"`
- RealityDay string `json:"realityDay"`
- Status pasturePb.IsShow_Kind `json:"status"`
- DrugsId int64 `json:"drugsId"`
- Unit pasturePb.Unit_Kind `json:"unit"`
- Usage int32 `json:"usage"`
- OperationId int64 `json:"operationId"`
- OperationName string `json:"operationName"`
- CreatedAt int64 `json:"createdAt"`
- UpdatedAt int64 `json:"updatedAt"`
- }
- func (s *CowSameTimeDetail) TableName() string {
- return "cow_same_time_detail"
- }
- func NewCowSameTimeDetailList(cowList []*Cow, sameTimeId int64, planTime string, sameTimeType pasturePb.SameTimeType_Kind) []*CowSameTimeDetail {
- res := make([]*CowSameTimeDetail, len(cowList))
- for i, cow := range cowList {
- res[i] = &CowSameTimeDetail{
- CowId: cow.Id,
- Lact: cow.Lact,
- PenId: cow.PenId,
- SameTimeId: sameTimeId,
- SameTimeType: sameTimeType,
- Status: pasturePb.IsShow_No,
- PlanDay: planTime,
- EndDay: planTime,
- }
- }
- return res
- }
- type SameTimeHeader struct {
- Id string `json:"id"`
- CowId string `json:"cowId"`
- CowType string `json:"cowType"`
- CowTypeName string `json:"cowTypeName"`
- BreedStatus string `json:"breedStatus"`
- BreedStatusName string `json:"breedStatusName"`
- PenId string `json:"penId"`
- PenName string `json:"penName"`
- Lact string `json:"lact"`
- CalvingAge string `json:"calvingAge"`
- AbortionAge string `json:"abortionAge"`
- DayAge string `json:"dayAge"`
- Status string `json:"status"`
- }
- type SameTimeBody struct {
- Id int64 `json:"id"`
- CowId int64 `json:"cowId"`
- BreedStatus pasturePb.BreedStatus_Kind `json:"breedStatus"`
- BreedStatusName string `json:"breedStatusName"`
- CowType pasturePb.CowType_Kind `json:"cowType"`
- CowTypeName string `json:"cowTypeName"`
- PenId int32 `json:"penId"`
- PenName string `json:"penName"`
- Lact int32 `json:"lact"`
- CalvingAge int32 `json:"calvingAge"`
- AbortionAge int32 `json:"abortionAge"`
- DayAge int32 `json:"dayAge"`
- Status pasturePb.IsShow_Kind `json:"status"`
- }
- type SameTimeBodySlice []*SameTimeBody
- func (s SameTimeBodySlice) ToPB(
- cowTypeMap map[pasturePb.CowType_Kind]string,
- breedStatusMap map[pasturePb.BreedStatus_Kind]string,
- penMap map[int32]*Pen,
- ) []*SameTimeBody {
- res := make([]*SameTimeBody, len(s))
- for i, v := range s {
- res[i] = &SameTimeBody{
- Id: v.Id,
- CowId: v.CowId,
- CowType: v.CowType,
- CowTypeName: cowTypeMap[v.CowType],
- BreedStatus: v.BreedStatus,
- BreedStatusName: breedStatusMap[v.BreedStatus],
- PenName: penMap[v.PenId].Name,
- PenId: v.PenId,
- Lact: v.Lact,
- CalvingAge: v.CalvingAge,
- AbortionAge: v.AbortionAge,
- DayAge: v.DayAge,
- Status: v.Status,
- }
- }
- return res
- }
|