| 12345678910111213141516171819202122232425262728293031323334353637383940414243 | 
							- package model
 
- import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
 
- const DefaultFocusIndicators = "all_cow,output_number,input_number,fatten_cattle_number,sales_volume"
 
- type IndicatorsDetails struct {
 
- 	Id           int64                        `json:"id"`
 
- 	Kind         string                       `json:"kind"`
 
- 	Name         string                       `json:"name"`
 
- 	CategoryType pasturePb.IndicatorType_Kind `json:"categoryType"`
 
- 	CategoryName string                       `json:"categoryName"`
 
- 	Unit         string                       `json:"unit"`
 
- 	Zh           string                       `json:"zh"`
 
- 	CreatedAt    int64                        `json:"createdAt"`
 
- 	UpdatedAt    int64                        `json:"updatedAt"`
 
- }
 
- func (IndicatorsDetails) TableName() string {
 
- 	return "indicators_details"
 
- }
 
- type IndicatorsDetailsSlice []*IndicatorsDetails
 
- func (i IndicatorsDetailsSlice) ToPB(userFocusIndicators []string) []*pasturePb.FocusIndicatorsSetData {
 
- 	res := make([]*pasturePb.FocusIndicatorsSetData, 0)
 
- 	for _, v := range i {
 
- 		isShow := pasturePb.IsShow_No
 
- 		for _, useIndicators := range userFocusIndicators {
 
- 			if useIndicators == v.Kind {
 
- 				isShow = pasturePb.IsShow_Ok
 
- 			}
 
- 		}
 
- 		res = append(res, &pasturePb.FocusIndicatorsSetData{
 
- 			Name:              v.Name,
 
- 			Kind:              v.Kind,
 
- 			IndicatorTypeKind: v.CategoryType,
 
- 			IndicatorTypeName: v.CategoryName,
 
- 			IsShow:            isShow,
 
- 		})
 
- 	}
 
- 	return res
 
- }
 
 
  |