12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- package model
- import (
- operationPb "gitee.com/xuyiping_admin/go_proto/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"`
- Prefit int64 `json:"prefit"`
- IsShow operationPb.IsShow_Kind `json:"is_show"`
- IsModify operationPb.IsShow_Kind `json:"is_modify"`
- 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),
- PreFit: int32(v.Prefit),
- IsModify: v.IsModify,
- Sort: v.Sort,
- CreatedAtFormat: time.Unix(v.CreatedAt, 0).Format(LayoutTime),
- }
- }
- return res
- }
|