| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 | package modelimport (	operationPb "kpt-tmr-group/proto/go/backend/operation"	"time")type FeedFormula struct {	Id                 int64                                 `json:"id"`	Name               string                                `json:"name"`	Colour             string                                `json:"colour"`	EncodeNumber       string                                `json:"encode_number"`	CattleCategoryId   operationPb.CattleCategoryParent_Kind `json:"cattle_category_id"`	CattleCategoryName string                                `json:"cattle_category_name"`	FormulaTypeId      int32                                 `json:"formula_type_id"`	FormulaTypeName    string                                `json:"formula_type_name"`	DataSourceId       operationPb.DataSource_Kind           `json:"data_source_id"`	DataSourceName     string                                `json:"data_source_name"`	Remarks            string                                `json:"remarks"`	Version            int64                                 `json:"version"`	PastureId          int64                                 `json:"pasture_id"`	PastureName        string                                `json:"pasture_name"`	PastureDataId      int64                                 `json:"pasture_data_id"`	IsShow             operationPb.IsShow_Kind               `json:"is_show"`	IsModify           operationPb.IsShow_Kind               `json:"is_modify"`	IsDelete           operationPb.IsShow_Kind               `json:"is_delete"`	CreatedAt          int64                                 `json:"created_at"`	UpdatedAt          int64                                 `json:"updated_at"`}func (f *FeedFormula) TableName() string {	return "feed_formula"}func NewFeedFormula(req *operationPb.AddFeedFormulaRequest) *FeedFormula {	return &FeedFormula{		Name:               req.Name,		Colour:             req.Colour,		EncodeNumber:       req.EncodeNumber,		CattleCategoryId:   req.CattleCategoryId,		CattleCategoryName: req.CattleCategoryName,		FormulaTypeId:      req.FormulaTypeId,		FormulaTypeName:    req.FormulaTypeName,		DataSourceId:       req.DataSourceId,		DataSourceName:     req.DataSourceName,		Remarks:            req.Remarks,		Version:            0,		PastureId:          0,		PastureName:        "",		IsShow:             req.IsShow,		IsDelete:           operationPb.IsShow_OK,		IsModify:           operationPb.IsShow_OK,	}}type FeedFormulaSlice []*FeedFormulafunc (f FeedFormulaSlice) ToPB() []*operationPb.AddFeedFormulaRequest {	res := make([]*operationPb.AddFeedFormulaRequest, len(f))	for i, v := range f {		res[i] = &operationPb.AddFeedFormulaRequest{			Id:                 int32(v.Id),			Name:               v.Name,			Colour:             v.Colour,			EncodeNumber:       v.EncodeNumber,			CattleCategoryId:   v.CattleCategoryId,			CattleCategoryName: v.CattleCategoryName,			FormulaTypeId:      v.FormulaTypeId,			FormulaTypeName:    v.FormulaTypeName,			DataSourceName:     v.DataSourceName,			DataSourceId:       v.DataSourceId,			Remarks:            v.Remarks,			Version:            int32(v.Version),			PastureName:        v.PastureName,			IsShow:             v.IsShow,			IsModify:           v.IsModify,			CreatedAt:          int32(v.CreatedAt),			CreatedAtFormat:    time.Unix(v.CreatedAt, 0).Format(LayoutTime),		}	}	return res}type DistributeData struct {	PastureList     []*GroupPasture	FeedFormulaList []*FeedFormula}
 |