| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 | 
							- package model
 
- import (
 
- 	operationPb "kpt-tmr-group/proto/go/backend/operation"
 
- 	"time"
 
- )
 
- type FeedFormulaDetail struct {
 
- 	Id                  int64                   `json:"id"`
 
- 	PastureId           int64                   `json:"pasture_id"`
 
- 	PastureName         string                  `json:"pasture_name"`
 
- 	PastureDataId       int64                   `json:"pasture_data_id"`
 
- 	FeedFormulaId       int64                   `json:"feed_formula_id"`
 
- 	ForageId            int64                   `json:"forage_id"`
 
- 	ForageName          string                  `json:"forage_name"`
 
- 	ForageGroupName     string                  `json:"forage_group_name"`
 
- 	Weight              int32                   `json:"weight"`
 
- 	StirDelay           int32                   `json:"stir_delay"`
 
- 	AllowError          int32                   `json:"allow_error"`
 
- 	IsShow              operationPb.IsShow_Kind `json:"is_show"`
 
- 	IsLockCowCountRatio operationPb.IsShow_Kind `json:"is_lock_cow_count_ratio"`
 
- 	Sort                int32                   `json:"sort"`
 
- 	CreatedAt           int64                   `json:"created_at"`
 
- 	UpdatedAt           int64                   `json:"updated_at"`
 
- }
 
- func (f *FeedFormulaDetail) TableName() string {
 
- 	return "feed_formula_detail"
 
- }
 
- type FeedFormulaDetailSlice []*FeedFormulaDetail
 
- func (f FeedFormulaDetailSlice) ToPB() []*operationPb.AddFeedFormulaDetail {
 
- 	res := make([]*operationPb.AddFeedFormulaDetail, len(f))
 
- 	for i, v := range f {
 
- 		res[i] = &operationPb.AddFeedFormulaDetail{
 
- 			Id:              int32(v.Id),
 
- 			FeedFormulaId:   int32(v.FeedFormulaId),
 
- 			ForageId:        int32(v.ForageId),
 
- 			ForageName:      v.ForageName,
 
- 			ForageGroupName: v.ForageGroupName,
 
- 			Weight:          float32(v.Weight / 100),
 
- 			StirDelay:       v.StirDelay,
 
- 			AllowError:      v.AllowError,
 
- 			CreatedAt:       int32(v.CreatedAt),
 
- 			CreatedAtFormat: time.Unix(v.CreatedAt, 0).Format(LayoutTime),
 
- 		}
 
- 	}
 
- 	return res
 
- }
 
 
  |