config_multi_factor_analysis_method.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package model
  2. import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  3. type ConfigMultiFactorAnalysisMethod struct {
  4. Id int32 `json:"id"`
  5. PastureId int64 `json:"pastureId"`
  6. Kind pasturePb.MultiFactorAnalysisMethod_Kind `json:"kind"`
  7. Zh string `json:"zh"`
  8. En string `json:"en"`
  9. Props string `json:"props"`
  10. Remarks string `json:"remarks"`
  11. IsShow pasturePb.IsShow_Kind `json:"is_show"`
  12. CreatedAt int64 `json:"created_at"`
  13. UpdatedAt int64 `json:"updated_at"`
  14. }
  15. func (c *ConfigMultiFactorAnalysisMethod) TableName() string {
  16. return "config_multi_factor_analysis_method"
  17. }
  18. type ConfigMultiFactorAnalysisMethodSlice []*ConfigMultiFactorAnalysisMethod
  19. func (c ConfigMultiFactorAnalysisMethodSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
  20. res := make([]*pasturePb.ConfigOptionsList, 0)
  21. for _, v := range c {
  22. label := v.Zh
  23. if lang == "en" {
  24. label = v.En
  25. }
  26. res = append(res, &pasturePb.ConfigOptionsList{
  27. Value: int32(v.Kind),
  28. Label: label,
  29. Disabled: true,
  30. Props: v.Props,
  31. })
  32. }
  33. return res
  34. }