12345678910111213141516171819202122232425262728293031323334353637383940 |
- package model
- type IndicatorsCow struct {
- Id int64 `json:"id"`
- PastureId int64 `json:"pastureId"`
- IndicatorsId int64 `json:"indicatorsId"`
- DateTime string `json:"dateTime"`
- CowId int64 `json:"cowId"`
- EarNumber string `json:"earNumber"`
- Lact int32 `json:"lact"`
- AdmissionAge int32 `json:"admissionAge"`
- CalvingAge int32 `json:"calvingAge"`
- CreatedAt int64 `json:"createdAt"`
- UpdatedAt int64 `json:"updatedAt"`
- }
- func (i *IndicatorsCow) TableName() string {
- return "indicator_cow"
- }
- func NewIndicatorsCow(pastureId int64, indicatorsId int64, dateTime string, cowInfo *Cow) *IndicatorsCow {
- return &IndicatorsCow{
- PastureId: pastureId,
- IndicatorsId: indicatorsId,
- DateTime: dateTime,
- CowId: cowInfo.Id,
- EarNumber: cowInfo.EarNumber,
- Lact: cowInfo.Lact,
- AdmissionAge: cowInfo.AdmissionAge,
- CalvingAge: cowInfo.CalvingAge,
- }
- }
- func NewIndicatorsCowList(pastureId int64, indicatorsId int64, dataTime string, cowList []*Cow) []*IndicatorsCow {
- res := make([]*IndicatorsCow, 0)
- for _, cow := range cowList {
- res = append(res, NewIndicatorsCow(pastureId, indicatorsId, dataTime, cow))
- }
- return res
- }
|