#4 v1.0

已關閉
xuyiping 請求將 1 次代碼提交從 xuyiping/feature/event 合併至 xuyiping/develop
共有 38 個文件被更改,包括 1455 次插入281 次删除
  1. 5 0
      http/route/pasture_api.go
  2. 0 1
      model/config_abortion_reasons.go
  3. 16 8
      model/config_breed_status.go
  4. 37 0
      model/config_calendar_type.go
  5. 37 0
      model/config_calving_analysis_method.go
  6. 37 0
      model/config_calving_level.go
  7. 37 0
      model/config_child_number.go
  8. 39 0
      model/config_cow_death_destination.go
  9. 32 8
      model/config_cow_kind.go
  10. 32 8
      model/config_cow_source.go
  11. 37 0
      model/config_disease_analysis_method.go
  12. 32 5
      model/config_disease_type.go
  13. 37 0
      model/config_dystocia_reason.go
  14. 37 0
      model/config_immunization_conditions.go
  15. 37 0
      model/config_immunization_cow_type.go
  16. 38 0
      model/config_lact.go
  17. 37 0
      model/config_lact_interval_symbol.go
  18. 39 0
      model/config_multi_factor_analysis_method.go
  19. 37 0
      model/config_neck_ring_isbind.go
  20. 37 0
      model/config_neck_ring_status.go
  21. 37 0
      model/config_pregnant_check_result.go
  22. 37 0
      model/config_sale_cow_analysis_method.go
  23. 37 0
      model/config_same_time_cow_type.go
  24. 37 0
      model/config_same_time_type.go
  25. 37 0
      model/config_single_factor_analysis_method.go
  26. 32 8
      model/config_transfer_pen_reason.go
  27. 5 2
      model/disease.go
  28. 1 1
      module/backend/analysis_more.go
  29. 245 36
      module/backend/config_data.go
  30. 23 3
      module/backend/config_data_base.go
  31. 297 188
      module/backend/config_data_breed.go
  32. 7 3
      module/backend/enum_map.go
  33. 1 1
      module/backend/enum_options.go
  34. 1 1
      module/backend/event_breed_more.go
  35. 1 1
      module/backend/event_check.go
  36. 5 1
      module/backend/pasture.go
  37. 10 5
      module/backend/prescription.go
  38. 2 1
      module/backend/sql.go

+ 5 - 0
http/route/pasture_api.go

@@ -15,14 +15,19 @@ func PastureManageAPI(opts ...func(engine *gin.Engine)) func(s *gin.Engine) {
 		pastureRoute := authRouteGroup(s, "/api/v1/pasture/")
 		pastureRoute.POST("/barn/list", pasture.SearchBarnList)
 		pastureRoute.POST("/barn/createOrUpdate", pasture.CreatedOrUpdateBarn)
+
 		pastureRoute.POST("/barn/type/list", pasture.SearchBarnTypeList)
 		pastureRoute.POST("/barn/type/createOrUpdate", pasture.CreatedOrUpdateBarnType)
+
 		pastureRoute.POST("/breed/status/list", pasture.SearchBreedStatusList)
 		pastureRoute.POST("/breed/status/createOrUpdate", pasture.CreatedOrUpdateBreedStatus)
+
 		pastureRoute.POST("/cow/kind/list", pasture.SearchCowKindList)
 		pastureRoute.POST("/cow/kind/createOrUpdate", pasture.CreatedOrUpdateCowKind)
+
 		pastureRoute.POST("/cow/status/list", pasture.SearchCowStatusList)
 		pastureRoute.POST("/cow/status/createOrUpdate", pasture.CreatedOrUpdateCowStatus)
+
 		pastureRoute.POST("/cow/type/list", pasture.SearchCowTypeList)
 		pastureRoute.POST("/cow/type/createOrUpdate", pasture.CreatedOrUpdateCowType)
 		pastureRoute.POST("/transfer/pen/reason/list", pasture.SearchTransferPenReasonList)

+ 0 - 1
model/config_abortion_reasons.go

@@ -8,7 +8,6 @@ type ConfigAbortionReasons struct {
 	Kind      pasturePb.AbortionReasons_Kind `json:"kind"`
 	Zh        string                         `json:"zh"`
 	En        string                         `json:"en"`
-	Category  pasturePb.PastureCategory_Kind `json:"category"`
 	Remarks   string                         `json:"remarks"`
 	IsShow    pasturePb.IsShow_Kind          `json:"is_show"`
 	CreatedAt int64                          `json:"created_at"`

+ 16 - 8
model/config_breed_status.go

@@ -2,15 +2,19 @@ package model
 
 import (
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"golang.org/x/text/language"
 )
 
 type ConfigBreedStatus struct {
-	Id        int64                 `json:"id"`
-	Name      string                `json:"name"`
-	Remarks   string                `json:"remarks"`
-	IsShow    pasturePb.IsShow_Kind `json:"is_show"`
-	CreatedAt int64                 `json:"created_at"`
-	UpdatedAt int64                 `json:"updated_at"`
+	Id        int64                      `json:"id"`
+	PastureId int64                      `json:"pastureId"`
+	Kind      pasturePb.BreedStatus_Kind `json:"kind"`
+	Zh        string                     `json:"zh"`
+	En        string                     `json:"en"`
+	Remarks   string                     `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind      `json:"isShow"`
+	CreatedAt int64                      `json:"createdAt"`
+	UpdatedAt int64                      `json:"updatedAt"`
 }
 
 func (c *ConfigBreedStatus) TableName() string {
@@ -19,12 +23,16 @@ func (c *ConfigBreedStatus) TableName() string {
 
 type ConfigBreedStatusSlice []*ConfigBreedStatus
 
-func (c ConfigBreedStatusSlice) ToPB() []*pasturePb.SearchBaseConfigList {
+func (c ConfigBreedStatusSlice) ToPB(lang string) []*pasturePb.SearchBaseConfigList {
 	res := make([]*pasturePb.SearchBaseConfigList, len(c))
 	for i, d := range c {
+		name := d.Zh
+		if lang == language.Chinese.String() {
+			name = d.En
+		}
 		res[i] = &pasturePb.SearchBaseConfigList{
 			Id:        int32(d.Id),
-			Name:      d.Name,
+			Name:      name,
 			Remarks:   d.Remarks,
 			IsShow:    d.IsShow,
 			CreatedAt: int32(d.CreatedAt),

+ 37 - 0
model/config_calendar_type.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigCalendarType struct {
+	Id        int32                       `json:"id"`
+	PastureId int64                       `json:"pastureId"`
+	Kind      pasturePb.CalendarType_Kind `json:"kind"`
+	Zh        string                      `json:"zh"`
+	En        string                      `json:"en"`
+	Remarks   string                      `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind       `json:"is_show"`
+	CreatedAt int64                       `json:"created_at"`
+	UpdatedAt int64                       `json:"updated_at"`
+}
+
+func (c *ConfigCalendarType) TableName() string {
+	return "config_calendar_type"
+}
+
+type ConfigCalendarTypeSlice []*ConfigCalendarType
+
+func (c ConfigCalendarTypeSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_calving_analysis_method.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigCalvingAnalysisMethod struct {
+	Id        int32                                `json:"id"`
+	PastureId int64                                `json:"pastureId"`
+	Kind      pasturePb.CalvingAnalysisMethod_Kind `json:"kind"`
+	Zh        string                               `json:"zh"`
+	En        string                               `json:"en"`
+	Remarks   string                               `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind                `json:"is_show"`
+	CreatedAt int64                                `json:"created_at"`
+	UpdatedAt int64                                `json:"updated_at"`
+}
+
+func (c *ConfigCalvingAnalysisMethod) TableName() string {
+	return "config_calving_analysis_method"
+}
+
+type ConfigCalvingAnalysisMethodSlice []*ConfigCalvingAnalysisMethod
+
+func (c ConfigCalvingAnalysisMethodSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_calving_level.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigCalvingLevel struct {
+	Id        int32                       `json:"id"`
+	PastureId int64                       `json:"pastureId"`
+	Kind      pasturePb.CalvingLevel_Kind `json:"kind"`
+	Zh        string                      `json:"zh"`
+	En        string                      `json:"en"`
+	Remarks   string                      `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind       `json:"is_show"`
+	CreatedAt int64                       `json:"created_at"`
+	UpdatedAt int64                       `json:"updated_at"`
+}
+
+func (c *ConfigCalvingLevel) TableName() string {
+	return "config_calving_level"
+}
+
+type ConfigCalvingLevelSlice []*ConfigCalvingLevel
+
+func (c ConfigCalvingLevelSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_child_number.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigChildNumber struct {
+	Id        int32                      `json:"id"`
+	PastureId int64                      `json:"pastureId"`
+	Kind      pasturePb.ChildNumber_Kind `json:"kind"`
+	Zh        string                     `json:"zh"`
+	En        string                     `json:"en"`
+	Remarks   string                     `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind      `json:"is_show"`
+	CreatedAt int64                      `json:"created_at"`
+	UpdatedAt int64                      `json:"updated_at"`
+}
+
+func (c *ConfigChildNumber) TableName() string {
+	return "config_child_number"
+}
+
+type ConfigChildNumberSlice []*ConfigChildNumber
+
+func (c ConfigChildNumberSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 39 - 0
model/config_cow_death_destination.go

@@ -0,0 +1,39 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+)
+
+type ConfigCowDeathDestination struct {
+	Id        int64                           `json:"id"`
+	PastureId int64                           `json:"pastureId"`
+	Kind      pasturePb.DeathDestination_Kind `json:"kind"`
+	Zh        string                          `json:"zh"`
+	En        string                          `json:"en"`
+	Remarks   string                          `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind           `json:"isShow"`
+	CreatedAt int64                           `json:"createdAt"`
+	UpdatedAt int64                           `json:"updatedAt"`
+}
+
+func (c *ConfigCowDeathDestination) TableName() string {
+	return "config_cow_death_destination"
+}
+
+type ConfigCowDeathDestinationSlice []*ConfigCowDeathDestination
+
+func (c ConfigCowDeathDestinationSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 32 - 8
model/config_cow_kind.go

@@ -2,15 +2,19 @@ package model
 
 import (
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"golang.org/x/text/language"
 )
 
 type ConfigCowKind struct {
-	Id        int64                 `json:"id"`
-	Name      string                `json:"name"`
-	Remarks   string                `json:"remarks"`
-	IsShow    pasturePb.IsShow_Kind `json:"is_show"`
-	CreatedAt int64                 `json:"created_at"`
-	UpdatedAt int64                 `json:"updated_at"`
+	Id        int64                  `json:"id"`
+	PastureId int64                  `json:"pastureId"`
+	Kind      pasturePb.CowKind_Kind `json:"kind"`
+	Zh        string                 `json:"zh"`
+	En        string                 `json:"en"`
+	Remarks   string                 `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind  `json:"isShow"`
+	CreatedAt int64                  `json:"createdAt"`
+	UpdatedAt int64                  `json:"updatedAt"`
 }
 
 func (c *ConfigCowKind) TableName() string {
@@ -19,12 +23,16 @@ func (c *ConfigCowKind) TableName() string {
 
 type ConfigCowKindSlice []*ConfigCowKind
 
-func (c ConfigCowKindSlice) ToPB() []*pasturePb.SearchBaseConfigList {
+func (c ConfigCowKindSlice) ToPB(lang string) []*pasturePb.SearchBaseConfigList {
 	res := make([]*pasturePb.SearchBaseConfigList, len(c))
 	for i, d := range c {
+		name := d.Zh
+		if lang == language.English.String() {
+			name = d.En
+		}
 		res[i] = &pasturePb.SearchBaseConfigList{
 			Id:        int32(d.Id),
-			Name:      d.Name,
+			Name:      name,
 			Remarks:   d.Remarks,
 			IsShow:    d.IsShow,
 			CreatedAt: int32(d.CreatedAt),
@@ -33,3 +41,19 @@ func (c ConfigCowKindSlice) ToPB() []*pasturePb.SearchBaseConfigList {
 	}
 	return res
 }
+
+func (c ConfigCowKindSlice) ToPB2(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 32 - 8
model/config_cow_source.go

@@ -2,15 +2,19 @@ package model
 
 import (
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"golang.org/x/text/language"
 )
 
 type ConfigCowSource struct {
-	Id        int64                 `json:"id"`
-	Name      string                `json:"name"`
-	Remarks   string                `json:"remarks"`
-	IsShow    pasturePb.IsShow_Kind `json:"is_show"`
-	CreatedAt int64                 `json:"created_at"`
-	UpdatedAt int64                 `json:"updated_at"`
+	Id        int64                    `json:"id"`
+	PastureId int64                    `json:"pastureId"`
+	Kind      pasturePb.CowSource_Kind `json:"kind"`
+	Zh        string                   `json:"zh"`
+	En        string                   `json:"en"`
+	Remarks   string                   `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind    `json:"isShow"`
+	CreatedAt int64                    `json:"createdAt"`
+	UpdatedAt int64                    `json:"updatedAt"`
 }
 
 func (c *ConfigCowSource) TableName() string {
@@ -19,12 +23,16 @@ func (c *ConfigCowSource) TableName() string {
 
 type ConfigCowSourceSlice []*ConfigCowSource
 
-func (c ConfigCowSourceSlice) ToPB() []*pasturePb.SearchBaseConfigList {
+func (c ConfigCowSourceSlice) ToPB(lang string) []*pasturePb.SearchBaseConfigList {
 	res := make([]*pasturePb.SearchBaseConfigList, len(c))
 	for i, d := range c {
+		name := d.Zh
+		if lang == language.English.String() {
+			name = d.En
+		}
 		res[i] = &pasturePb.SearchBaseConfigList{
 			Id:        int32(d.Id),
-			Name:      d.Name,
+			Name:      name,
 			Remarks:   d.Remarks,
 			IsShow:    d.IsShow,
 			CreatedAt: int32(d.CreatedAt),
@@ -33,3 +41,19 @@ func (c ConfigCowSourceSlice) ToPB() []*pasturePb.SearchBaseConfigList {
 	}
 	return res
 }
+
+func (c ConfigCowSourceSlice) ToPB2(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_disease_analysis_method.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigDiseaseAnalysisMethod struct {
+	Id        int32                                `json:"id"`
+	PastureId int64                                `json:"pastureId"`
+	Kind      pasturePb.DiseaseAnalysisMethod_Kind `json:"kind"`
+	Zh        string                               `json:"zh"`
+	En        string                               `json:"en"`
+	Remarks   string                               `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind                `json:"is_show"`
+	CreatedAt int64                                `json:"created_at"`
+	UpdatedAt int64                                `json:"updated_at"`
+}
+
+func (c *ConfigDiseaseAnalysisMethod) TableName() string {
+	return "config_disease_analysis_method"
+}
+
+type ConfigDiseaseAnalysisMethodSlice []*ConfigDiseaseAnalysisMethod
+
+func (c ConfigDiseaseAnalysisMethodSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 32 - 5
model/config_disease_type.go

@@ -2,11 +2,15 @@ package model
 
 import (
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"golang.org/x/text/language"
 )
 
 type ConfigDiseaseType struct {
 	Id        int64                 `json:"id"`
-	Name      string                `json:"name"`
+	PastureId int64                 `json:"pastureId"`
+	Kind      int32                 `json:"kind"`
+	Zh        string                `json:"Zh"`
+	En        string                `json:"En"`
 	Remarks   string                `json:"remarks"`
 	IsShow    pasturePb.IsShow_Kind `json:"is_show"`
 	CreatedAt int64                 `json:"created_at"`
@@ -19,12 +23,16 @@ func (c *ConfigDiseaseType) TableName() string {
 
 type ConfigDiseaseTypeSlice []*ConfigDiseaseType
 
-func (c ConfigDiseaseTypeSlice) ToPB() []*pasturePb.SearchBaseConfigList {
+func (c ConfigDiseaseTypeSlice) ToPB(lang string) []*pasturePb.SearchBaseConfigList {
 	res := make([]*pasturePb.SearchBaseConfigList, len(c))
 	for i, d := range c {
+		name := d.Zh
+		if lang == language.English.String() {
+			name = d.En
+		}
 		res[i] = &pasturePb.SearchBaseConfigList{
 			Id:        int32(d.Id),
-			Name:      d.Name,
+			Name:      name,
 			Remarks:   d.Remarks,
 			IsShow:    d.IsShow,
 			CreatedAt: int32(d.CreatedAt),
@@ -34,7 +42,7 @@ func (c ConfigDiseaseTypeSlice) ToPB() []*pasturePb.SearchBaseConfigList {
 	return res
 }
 
-func (c ConfigDiseaseTypeSlice) ToPB2(diseaseList []*Disease) []*pasturePb.ConfigOptionsList {
+func (c ConfigDiseaseTypeSlice) ToPB2(lang string, diseaseList []*Disease) []*pasturePb.ConfigOptionsList {
 	res := make([]*pasturePb.ConfigOptionsList, len(c))
 	for i, d := range c {
 		children := make([]*pasturePb.ConfigOptionsList, 0)
@@ -50,12 +58,31 @@ func (c ConfigDiseaseTypeSlice) ToPB2(diseaseList []*Disease) []*pasturePb.Confi
 				})
 			}
 		}
+		label := d.Zh
+		if lang == language.English.String() {
+			label = d.En
+		}
 		res[i] = &pasturePb.ConfigOptionsList{
 			Value:    int32(d.Id),
-			Label:    d.Name,
+			Label:    label,
 			Disabled: true,
 			Children: children,
 		}
 	}
 	return res
 }
+func (c ConfigDiseaseTypeSlice) ToPB3(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_dystocia_reason.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigDystociaReason struct {
+	Id        int32                         `json:"id"`
+	PastureId int64                         `json:"pastureId"`
+	Kind      pasturePb.DystociaReason_Kind `json:"kind"`
+	Zh        string                        `json:"zh"`
+	En        string                        `json:"en"`
+	Remarks   string                        `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind         `json:"is_show"`
+	CreatedAt int64                         `json:"created_at"`
+	UpdatedAt int64                         `json:"updated_at"`
+}
+
+func (c *ConfigDystociaReason) TableName() string {
+	return "config_dystocia_reason"
+}
+
+type ConfigDystociaReasonSlice []*ConfigDystociaReason
+
+func (c ConfigDystociaReasonSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_immunization_conditions.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigImmunizationConditions struct {
+	Id        int32                                 `json:"id"`
+	PastureId int64                                 `json:"pastureId"`
+	Kind      pasturePb.ImmunizationConditions_Kind `json:"kind"`
+	Zh        string                                `json:"zh"`
+	En        string                                `json:"en"`
+	Remarks   string                                `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind                 `json:"is_show"`
+	CreatedAt int64                                 `json:"created_at"`
+	UpdatedAt int64                                 `json:"updated_at"`
+}
+
+func (c *ConfigImmunizationConditions) TableName() string {
+	return "config_immunization_conditions"
+}
+
+type ConfigImmunizationConditionsSlice []*ConfigImmunizationConditions
+
+func (c ConfigImmunizationConditionsSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_immunization_cow_type.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigImmunizationCowType struct {
+	Id        int32                  `json:"id"`
+	PastureId int64                  `json:"pastureId"`
+	Kind      pasturePb.CowType_Kind `json:"kind"`
+	Zh        string                 `json:"zh"`
+	En        string                 `json:"en"`
+	Remarks   string                 `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind  `json:"is_show"`
+	CreatedAt int64                  `json:"created_at"`
+	UpdatedAt int64                  `json:"updated_at"`
+}
+
+func (c *ConfigImmunizationCowType) TableName() string {
+	return "config_immunization_cow_type"
+}
+
+type ConfigImmunizationCowTypeSlice []*ConfigImmunizationCowType
+
+func (c ConfigImmunizationCowTypeSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 38 - 0
model/config_lact.go

@@ -0,0 +1,38 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigLact struct {
+	Id        int32                          `json:"id"`
+	PastureId int64                          `json:"pastureId"`
+	Kind      int32                          `json:"kind"`
+	Zh        string                         `json:"zh"`
+	En        string                         `json:"en"`
+	Category  pasturePb.PastureCategory_Kind `json:"category"`
+	Remarks   string                         `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind          `json:"is_show"`
+	CreatedAt int64                          `json:"created_at"`
+	UpdatedAt int64                          `json:"updated_at"`
+}
+
+func (c *ConfigLact) TableName() string {
+	return "config_lact"
+}
+
+type ConfigLactSlice []*ConfigLact
+
+func (c ConfigLactSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    v.Kind,
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_lact_interval_symbol.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigLactIntervalSymbol struct {
+	Id        int32                        `json:"id"`
+	PastureId int64                        `json:"pastureId"`
+	Kind      pasturePb.CompareSymbol_Kind `json:"kind"`
+	Zh        string                       `json:"zh"`
+	En        string                       `json:"en"`
+	Remarks   string                       `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind        `json:"is_show"`
+	CreatedAt int64                        `json:"created_at"`
+	UpdatedAt int64                        `json:"updated_at"`
+}
+
+func (c *ConfigLactIntervalSymbol) TableName() string {
+	return "config_lact_interval_symbol"
+}
+
+type ConfigLactIntervalSymbolSlice []*ConfigLactIntervalSymbol
+
+func (c ConfigLactIntervalSymbolSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 39 - 0
model/config_multi_factor_analysis_method.go

@@ -0,0 +1,39 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigMultiFactorAnalysisMethod struct {
+	Id        int32                                    `json:"id"`
+	PastureId int64                                    `json:"pastureId"`
+	Kind      pasturePb.MultiFactorAnalysisMethod_Kind `json:"kind"`
+	Zh        string                                   `json:"zh"`
+	En        string                                   `json:"en"`
+	Props     string                                   `json:"props"`
+	Remarks   string                                   `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind                    `json:"is_show"`
+	CreatedAt int64                                    `json:"created_at"`
+	UpdatedAt int64                                    `json:"updated_at"`
+}
+
+func (c *ConfigMultiFactorAnalysisMethod) TableName() string {
+	return "config_multi_factor_analysis_method"
+}
+
+type ConfigMultiFactorAnalysisMethodSlice []*ConfigMultiFactorAnalysisMethod
+
+func (c ConfigMultiFactorAnalysisMethodSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+			Props:    v.Props,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_neck_ring_isbind.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigNeckRingIsBind struct {
+	Id        int32                         `json:"id"`
+	PastureId int64                         `json:"pastureId"`
+	Kind      pasturePb.NeckRingIsBind_Kind `json:"kind"`
+	Zh        string                        `json:"zh"`
+	En        string                        `json:"en"`
+	Remarks   string                        `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind         `json:"is_show"`
+	CreatedAt int64                         `json:"created_at"`
+	UpdatedAt int64                         `json:"updated_at"`
+}
+
+func (c *ConfigNeckRingIsBind) TableName() string {
+	return "config_neck_ring_isbind"
+}
+
+type ConfigNeckRingIsBindSlice []*ConfigNeckRingIsBind
+
+func (c ConfigNeckRingIsBindSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_neck_ring_status.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigNeckRingStatus struct {
+	Id        int32                         `json:"id"`
+	PastureId int64                         `json:"pastureId"`
+	Kind      pasturePb.NeckRingStatus_Kind `json:"kind"`
+	Zh        string                        `json:"zh"`
+	En        string                        `json:"en"`
+	Remarks   string                        `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind         `json:"is_show"`
+	CreatedAt int64                         `json:"created_at"`
+	UpdatedAt int64                         `json:"updated_at"`
+}
+
+func (c *ConfigNeckRingStatus) TableName() string {
+	return "config_neck_ring_status"
+}
+
+type ConfigNeckRingStatusSlice []*ConfigNeckRingStatus
+
+func (c ConfigNeckRingStatusSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_pregnant_check_result.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigPregnantCheckResult struct {
+	Id        int32                              `json:"id"`
+	PastureId int64                              `json:"pastureId"`
+	Kind      pasturePb.PregnantCheckResult_Kind `json:"kind"`
+	Zh        string                             `json:"zh"`
+	En        string                             `json:"en"`
+	Remarks   string                             `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind              `json:"is_show"`
+	CreatedAt int64                              `json:"created_at"`
+	UpdatedAt int64                              `json:"updated_at"`
+}
+
+func (c *ConfigPregnantCheckResult) TableName() string {
+	return "config_pregnant_check_result"
+}
+
+type ConfigPregnantCheckResultSlice []*ConfigPregnantCheckResult
+
+func (c ConfigPregnantCheckResultSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_sale_cow_analysis_method.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigSaleCowAnalysisMethod struct {
+	Id        int32                                `json:"id"`
+	PastureId int64                                `json:"pastureId"`
+	Kind      pasturePb.SaleCowAnalysisMethod_Kind `json:"kind"`
+	Zh        string                               `json:"zh"`
+	En        string                               `json:"en"`
+	Remarks   string                               `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind                `json:"is_show"`
+	CreatedAt int64                                `json:"created_at"`
+	UpdatedAt int64                                `json:"updated_at"`
+}
+
+func (c *ConfigSaleCowAnalysisMethod) TableName() string {
+	return "config_sale_cow_analysis_method"
+}
+
+type ConfigSaleCowAnalysisMethodSlice []*ConfigSaleCowAnalysisMethod
+
+func (c ConfigSaleCowAnalysisMethodSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_same_time_cow_type.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigSameTimeCowType struct {
+	Id        int32                          `json:"id"`
+	PastureId int64                          `json:"pastureId"`
+	Kind      pasturePb.SameTimeCowType_Kind `json:"kind"`
+	Zh        string                         `json:"zh"`
+	En        string                         `json:"en"`
+	Remarks   string                         `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind          `json:"is_show"`
+	CreatedAt int64                          `json:"created_at"`
+	UpdatedAt int64                          `json:"updated_at"`
+}
+
+func (c *ConfigSameTimeCowType) TableName() string {
+	return "config_same_time_cow_type"
+}
+
+type ConfigSameTimeCowTypeSlice []*ConfigSameTimeCowType
+
+func (c ConfigSameTimeCowTypeSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_same_time_type.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigSameTimeType struct {
+	Id        int32                       `json:"id"`
+	PastureId int64                       `json:"pastureId"`
+	Kind      pasturePb.SameTimeType_Kind `json:"kind"`
+	Zh        string                      `json:"zh"`
+	En        string                      `json:"en"`
+	Remarks   string                      `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind       `json:"is_show"`
+	CreatedAt int64                       `json:"created_at"`
+	UpdatedAt int64                       `json:"updated_at"`
+}
+
+func (c *ConfigSameTimeType) TableName() string {
+	return "config_same_time_type"
+}
+
+type ConfigSameTimeTypeSlice []*ConfigSameTimeType
+
+func (c ConfigSameTimeTypeSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 37 - 0
model/config_single_factor_analysis_method.go

@@ -0,0 +1,37 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type ConfigSingleFactorAnalysisMethod struct {
+	Id        int32                                     `json:"id"`
+	PastureId int64                                     `json:"pastureId"`
+	Kind      pasturePb.SingleFactorAnalysisMethod_Kind `json:"kind"`
+	Zh        string                                    `json:"zh"`
+	En        string                                    `json:"en"`
+	Remarks   string                                    `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind                     `json:"is_show"`
+	CreatedAt int64                                     `json:"created_at"`
+	UpdatedAt int64                                     `json:"updated_at"`
+}
+
+func (c *ConfigSingleFactorAnalysisMethod) TableName() string {
+	return "config_single_factor_analysis_method"
+}
+
+type ConfigSingleFactorAnalysisMethodSlice []*ConfigSingleFactorAnalysisMethod
+
+func (c ConfigSingleFactorAnalysisMethodSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 32 - 8
model/config_transfer_pen_reason.go

@@ -2,15 +2,19 @@ package model
 
 import (
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"golang.org/x/text/language"
 )
 
 type ConfigTransferPenReason struct {
-	Id        int64                 `json:"id"`
-	Name      string                `json:"name"`
-	Remarks   string                `json:"remarks"`
-	IsShow    pasturePb.IsShow_Kind `json:"is_show"`
-	CreatedAt int64                 `json:"created_at"`
-	UpdatedAt int64                 `json:"updated_at"`
+	Id        int64                            `json:"id"`
+	PastureId int64                            `json:"pastureId"`
+	Kind      pasturePb.TransferPenReason_Kind `json:"kind"`
+	Zh        string                           `json:"zh"`
+	En        string                           `json:"en"`
+	Remarks   string                           `json:"remarks"`
+	IsShow    pasturePb.IsShow_Kind            `json:"isShow"`
+	CreatedAt int64                            `json:"createdAt"`
+	UpdatedAt int64                            `json:"updatedAt"`
 }
 
 func (c *ConfigTransferPenReason) TableName() string {
@@ -19,12 +23,16 @@ func (c *ConfigTransferPenReason) TableName() string {
 
 type ConfigTransferPenReasonSlice []*ConfigTransferPenReason
 
-func (c ConfigTransferPenReasonSlice) ToPB() []*pasturePb.SearchBaseConfigList {
+func (c ConfigTransferPenReasonSlice) ToPB(lang string) []*pasturePb.SearchBaseConfigList {
 	res := make([]*pasturePb.SearchBaseConfigList, len(c))
 	for i, d := range c {
+		name := d.Zh
+		if lang == language.English.String() {
+			name = d.En
+		}
 		res[i] = &pasturePb.SearchBaseConfigList{
 			Id:        int32(d.Id),
-			Name:      d.Name,
+			Name:      name,
 			Remarks:   d.Remarks,
 			IsShow:    d.IsShow,
 			CreatedAt: int32(d.CreatedAt),
@@ -33,3 +41,19 @@ func (c ConfigTransferPenReasonSlice) ToPB() []*pasturePb.SearchBaseConfigList {
 	}
 	return res
 }
+
+func (c ConfigTransferPenReasonSlice) ToPB2(lang string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label := v.Zh
+		if lang == "en" {
+			label = v.En
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 5 - 2
model/disease.go

@@ -26,7 +26,7 @@ func (d *Disease) TableName() string {
 
 type DiseaseSlice []*Disease
 
-func (d DiseaseSlice) ToPB(user []*SystemUser, diseaseTypeList []*ConfigDiseaseType) []*pasturePb.SearchDiseaseList {
+func (d DiseaseSlice) ToPB(lang string, user []*SystemUser, diseaseTypeList []*ConfigDiseaseType) []*pasturePb.SearchDiseaseList {
 	res := make([]*pasturePb.SearchDiseaseList, len(d))
 	for i, dl := range d {
 		operationName, diseaseTypeName := "", ""
@@ -39,7 +39,10 @@ func (d DiseaseSlice) ToPB(user []*SystemUser, diseaseTypeList []*ConfigDiseaseT
 
 		for _, dt := range diseaseTypeList {
 			if dt.Id == int64(dl.DiseaseType) {
-				diseaseTypeName = dt.Name
+				diseaseTypeName = dt.Zh
+				if lang == "en" {
+					diseaseTypeName = dt.En
+				}
 				break
 			}
 		}

+ 1 - 1
module/backend/analysis_more.go

@@ -175,7 +175,7 @@ func (s *StoreEntry) CowBehaviorDistribution(ctx context.Context, req *pasturePb
 		},
 	}
 
-	breedStatus := s.BreedStatusEnumList()
+	breedStatus := s.BreedStatusEnumList(userModel, "")
 	for _, v := range breedStatus {
 		if v.Value == int32(pasturePb.BreedStatus_Abort) ||
 			v.Value == int32(pasturePb.BreedStatus_Calving) ||

+ 245 - 36
module/backend/config_data.go

@@ -3,7 +3,10 @@ package backend
 import (
 	"kpt-pasture/model"
 
+	"go.uber.org/zap"
+
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"gitee.com/xuyiping_admin/pkg/logger/zaplog"
 )
 
 func (s *StoreEntry) BarnTypeEnumList(excludeTypes []pasturePb.PenType_Kind) []*pasturePb.ConfigOptionsList {
@@ -28,8 +31,25 @@ func (s *StoreEntry) BarnTypeEnumList(excludeTypes []pasturePb.PenType_Kind) []*
 	return barnTypeList
 }
 
-func (s *StoreEntry) BreedStatusEnumList() []*pasturePb.ConfigOptionsList {
-	breedStatusList := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) BreedStatusEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigSaleCowAnalysisMethod, 0)
+	pref := s.DB.Model(new(model.ConfigSaleCowAnalysisMethod)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.SaleCowAnalysisMethod_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.SaleCowAnalysisMethod_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("LactIntervalSymbolEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigSaleCowAnalysisMethodSlice(dataList).ToPB(userModel.Language)
+	/*breedStatusList := make([]*pasturePb.ConfigOptionsList, 0)
 	breedStatusList = append(breedStatusList, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.BreedStatus_UnBreed),
 		Label:    "未配",
@@ -59,11 +79,29 @@ func (s *StoreEntry) BreedStatusEnumList() []*pasturePb.ConfigOptionsList {
 		Label:    "禁配",
 		Disabled: true,
 	})
-	return breedStatusList
+	return breedStatusList*/
 }
 
-func (s *StoreEntry) CowKindEnumList() []*pasturePb.ConfigOptionsList {
-	cowKindList := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) CowKindEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigCowKind, 0)
+	pref := s.DB.Model(new(model.ConfigCowKind)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.CowKind_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.CowKind_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("CowKindEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigCowKindSlice(dataList).ToPB2(userModel.Language)
+
+	/*cowKindList := make([]*pasturePb.ConfigOptionsList, 0)
 	cowKindList = append(cowKindList, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.CowKind_XMTEN),
 		Label:    "西门塔尔牛",
@@ -89,11 +127,28 @@ func (s *StoreEntry) CowKindEnumList() []*pasturePb.ConfigOptionsList {
 		Label:    "和牛",
 		Disabled: true,
 	})
-	return cowKindList
+	return cowKindList*/
 }
 
-func (s *StoreEntry) CowSourceEnumList() []*pasturePb.ConfigOptionsList {
-	cowSourceList := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) CowSourceEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigCowSource, 0)
+	pref := s.DB.Model(new(model.ConfigCowSource)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.CowSource_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.CowSource_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("CowKindEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigCowSourceSlice(dataList).ToPB2(userModel.Language)
+	/*cowSourceList := make([]*pasturePb.ConfigOptionsList, 0)
 	cowSourceList = append(cowSourceList, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.CowSource_Calving),
 		Label:    "产犊",
@@ -107,7 +162,7 @@ func (s *StoreEntry) CowSourceEnumList() []*pasturePb.ConfigOptionsList {
 		Label:    "购买",
 		Disabled: true,
 	})
-	return cowSourceList
+	return cowSourceList*/
 }
 
 func (s *StoreEntry) CowTypeEnumList(optionName, isAll string) []*pasturePb.ConfigOptionsList {
@@ -164,8 +219,25 @@ func (s *StoreEntry) CowTypeEnumList(optionName, isAll string) []*pasturePb.Conf
 	return cowTypeList
 }
 
-func (s *StoreEntry) SameTimeCowTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) SameTimeCowTypeEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigSameTimeCowType, 0)
+	pref := s.DB.Model(new(model.ConfigSameTimeCowType)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.SameTimeCowType_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.SameTimeCowType_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("ConfigSameTimeCowType", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigSameTimeCowTypeSlice(dataList).ToPB(userModel.Language)
+	/*cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
 			Value:    int32(pasturePb.SameTimeCowType_Invalid),
@@ -182,11 +254,28 @@ func (s *StoreEntry) SameTimeCowTypeEnumList(isAll string) []*pasturePb.ConfigOp
 		Label:    "成母牛",
 		Disabled: true,
 	})
-	return cowTypeList
+	return cowTypeList*/
 }
 
-func (s *StoreEntry) SameTimeTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) SameTimeTypeEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigSameTimeType, 0)
+	pref := s.DB.Model(new(model.ConfigSameTimeType)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.SameTimeType_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.SameTimeType_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("SameTimeTypeEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigSameTimeTypeSlice(dataList).ToPB(userModel.Language)
+	/*cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
 			Value:    int32(pasturePb.SameTimeType_Invalid),
@@ -211,11 +300,28 @@ func (s *StoreEntry) SameTimeTypeEnumList(isAll string) []*pasturePb.ConfigOptio
 		Label:    "TAI输精",
 		Disabled: true,
 	})
-	return cowTypeList
+	return cowTypeList*/
 }
 
-func (s *StoreEntry) ImmunizationCowTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) ImmunizationCowTypeEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigImmunizationCowType, 0)
+	pref := s.DB.Model(new(model.ConfigImmunizationCowType)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.CowKind_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.CowKind_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("SameTimeTypeEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigImmunizationCowTypeSlice(dataList).ToPB(userModel.Language)
+	/*cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
 	cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.CowType_Lactating_Calf),
 		Label:    "犊牛",
@@ -245,11 +351,28 @@ func (s *StoreEntry) ImmunizationCowTypeEnumList(isAll string) []*pasturePb.Conf
 		Label:    "种公牛",
 		Disabled: true,
 	})
-	return cowTypeList
+	return cowTypeList*/
 }
 
-func (s *StoreEntry) ImmunizationConditionsEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) ImmunizationConditionsEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigImmunizationConditions, 0)
+	pref := s.DB.Model(new(model.ConfigImmunizationConditions)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.ImmunizationConditions_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.ImmunizationConditions_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("ImmunizationConditionsEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigImmunizationConditionsSlice(dataList).ToPB(userModel.Language)
+	/*cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
 			Value:    int32(pasturePb.ImmunizationConditions_Invalid),
@@ -278,11 +401,28 @@ func (s *StoreEntry) ImmunizationConditionsEnumList(isAll string) []*pasturePb.C
 		Label:    "基于其他疫苗之后",
 		Disabled: true,
 	})
-	return cowTypeList
+	return cowTypeList*/
 }
 
-func (s *StoreEntry) TransferPenEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	transferPenList := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) TransferPenEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigTransferPenReason, 0)
+	pref := s.DB.Model(new(model.ConfigTransferPenReason)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.TransferPenReason_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.TransferPenReason_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("TransferPenEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigTransferPenReasonSlice(dataList).ToPB2(userModel.Language)
+	/*transferPenList := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		transferPenList = append(transferPenList, &pasturePb.ConfigOptionsList{
 			Value:    int32(pasturePb.TransferPenReason_Invalid),
@@ -311,11 +451,29 @@ func (s *StoreEntry) TransferPenEnumList(isAll string) []*pasturePb.ConfigOption
 		Label:    "过抗转群",
 		Disabled: true,
 	})
-	return transferPenList
+	return transferPenList*/
 }
 
-func (s *StoreEntry) ChildNumberEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) ChildNumberEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigChildNumber, 0)
+	pref := s.DB.Model(new(model.ConfigChildNumber)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.ChildNumber_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.ChildNumber_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("ChildNumberEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigChildNumberSlice(dataList).ToPB(userModel.Language)
+
+	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
 			&pasturePb.ConfigOptionsList{
@@ -342,11 +500,28 @@ func (s *StoreEntry) ChildNumberEnumList(isAll string) []*pasturePb.ConfigOption
 			Label:    "四胎",
 			Disabled: true,
 		})
-	return configOptions
+	return configOptions*/
 }
 
-func (s *StoreEntry) CalvingLevelEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) CalvingLevelEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigCalvingLevel, 0)
+	pref := s.DB.Model(new(model.ConfigCalvingLevel)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.CalvingLevel_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.CalvingLevel_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("CalvingLevelEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigCalvingLevelSlice(dataList).ToPB(userModel.Language)
+	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
 			&pasturePb.ConfigOptionsList{
@@ -373,11 +548,28 @@ func (s *StoreEntry) CalvingLevelEnumList(isAll string) []*pasturePb.ConfigOptio
 			Label:    "剖腹产",
 			Disabled: true,
 		})
-	return configOptions
+	return configOptions*/
 }
 
-func (s *StoreEntry) DystociaReasonEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) DystociaReasonEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigDystociaReason, 0)
+	pref := s.DB.Model(new(model.ConfigDystociaReason)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.DystociaReason_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.DystociaReason_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("CalvingLevelEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigDystociaReasonSlice(dataList).ToPB(userModel.Language)
+	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
 			&pasturePb.ConfigOptionsList{
@@ -408,11 +600,28 @@ func (s *StoreEntry) DystociaReasonEnumList(isAll string) []*pasturePb.ConfigOpt
 			Label:    "母牛亚健康状态",
 			Disabled: true,
 		})
-	return configOptions
+	return configOptions*/
 }
 
-func (s *StoreEntry) PregnantCheckResultEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) PregnantCheckResultEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigPregnantCheckResult, 0)
+	pref := s.DB.Model(new(model.ConfigPregnantCheckResult)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.PregnantCheckResult_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.PregnantCheckResult_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("PregnantCheckResultEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigPregnantCheckResultSlice(dataList).ToPB(userModel.Language)
+	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
 			&pasturePb.ConfigOptionsList{
@@ -430,5 +639,5 @@ func (s *StoreEntry) PregnantCheckResultEnumList(isAll string) []*pasturePb.Conf
 		Label:    "无胎",
 		Disabled: true,
 	})
-	return configOptions
+	return configOptions*/
 }

+ 23 - 3
module/backend/config_data_base.go

@@ -3,6 +3,9 @@ package backend
 import (
 	"kpt-pasture/model"
 
+	"gitee.com/xuyiping_admin/pkg/logger/zaplog"
+	"go.uber.org/zap"
+
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
 )
 
@@ -396,8 +399,25 @@ func (s *StoreEntry) CowOutReasonList(isAll string) []*pasturePb.ConfigOptionsLi
 	return configOptions
 }
 
-func (s *StoreEntry) CowDeathDestinationList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) CowDeathDestinationList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigCowDeathDestination, 0)
+	pref := s.DB.Model(new(model.ConfigCowDeathDestination)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.PregnantCheckResult_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.PregnantCheckResult_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("CowDeathDestinationList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigCowDeathDestinationSlice(dataList).ToPB(userModel.Language)
+	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
 			&pasturePb.ConfigOptionsList{
@@ -419,5 +439,5 @@ func (s *StoreEntry) CowDeathDestinationList(isAll string) []*pasturePb.ConfigOp
 		Label:    "其他",
 		Disabled: true,
 	})
-	return configOptions
+	return configOptions*/
 }

+ 297 - 188
module/backend/config_data_breed.go

@@ -8,137 +8,194 @@ import (
 	"go.uber.org/zap"
 )
 
-func (s *StoreEntry) LactEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) LactEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	configLactList := make([]*model.ConfigLact, 0)
+	pref := s.DB.Model(new(model.ConfigLact)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
 	if isAll == model.IsAllYes {
-		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-			Value:    int32(0),
-			Label:    "全部",
-			Disabled: true,
-		})
+		pref = pref.Where("kind >= ?", 0)
+	} else {
+		pref = pref.Where("kind > ?", 0)
 	}
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(1),
-		Label:    "1",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(2),
-		Label:    "2",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(3),
-		Label:    "3",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(4),
-		Label:    ">3",
-		Disabled: true,
-	})
-	return configOptions
+
+	if err := pref.Order("kind ASC").
+		Find(&configLactList).Error; err != nil {
+		zaplog.Error("LactEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigLactSlice(configLactList).ToPB(userModel.Language)
+	/*
+		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
+				Value:    int32(1),
+				Label:    "1",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(2),
+				Label:    "2",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(3),
+				Label:    "3",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(4),
+				Label:    ">3",
+				Disabled: true,
+			})
+			return configOptions
+	*/
 }
 
-func (s *StoreEntry) DiseaseAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) DiseaseAnalysisMethodEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigDiseaseAnalysisMethod, 0)
+	pref := s.DB.Model(new(model.ConfigDiseaseAnalysisMethod)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
 	if isAll == model.IsAllYes {
-		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.DiseaseAnalysisMethod_Invalid),
-			Label:    "全部",
-			Disabled: true,
-		})
+		pref = pref.Where("kind >= ?", pasturePb.DiseaseAnalysisMethod_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.DiseaseAnalysisMethod_Invalid)
 	}
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DiseaseAnalysisMethod_Months),
-		Label:    "按月份",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DiseaseAnalysisMethod_Disease_Category),
-		Label:    "疾病分类",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DiseaseAnalysisMethod_Disease),
-		Label:    "疾病名称",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DiseaseAnalysisMethod_Operator),
-		Label:    "兽医",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DiseaseAnalysisMethod_Prescription),
-		Label:    "处方",
-		Disabled: true,
-	})
-	return configOptions
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("DiseaseAnalysisMethodEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigDiseaseAnalysisMethodSlice(dataList).ToPB(userModel.Language)
+	/*
+		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.DiseaseAnalysisMethod_Months),
+				Label:    "按月份",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.DiseaseAnalysisMethod_Disease_Category),
+				Label:    "疾病分类",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.DiseaseAnalysisMethod_Disease),
+				Label:    "疾病名称",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.DiseaseAnalysisMethod_Operator),
+				Label:    "兽医",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.DiseaseAnalysisMethod_Prescription),
+				Label:    "处方",
+				Disabled: true,
+			})
+			return configOptions
+	*/
 }
 
-func (s *StoreEntry) diseaseTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) diseaseTypeEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configDiseaseTypeList := make([]*model.ConfigDiseaseType, 0)
-	configOptionsList := make([]*pasturePb.ConfigOptionsList, 0)
-	if err := s.DB.Where("is_show = ?", pasturePb.IsShow_Ok).Find(&configDiseaseTypeList).Error; err != nil {
+	if err := s.DB.Model(new(model.ConfigDiseaseType)).
+		Where("pasture_id = ?", userModel.AppPasture.Id).
+		Where("is_show = ?", pasturePb.IsShow_Ok).
+		Find(&configDiseaseTypeList).Error; err != nil {
 		zaplog.Error("diseaseTypeEnumList", zap.Any("Find", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
 
-	for _, v := range configDiseaseTypeList {
-		configOptionsList = append(configOptionsList, &pasturePb.ConfigOptionsList{
-			Value:    int32(v.Id),
-			Label:    v.Name,
-			Disabled: true,
-		})
-	}
-	return configOptionsList
+	return model.ConfigDiseaseTypeSlice(configDiseaseTypeList).ToPB3(userModel.Language)
 }
 
-func (s *StoreEntry) SingleFactorAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Cycle),
-		Label:    "按周期分析",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Months),
-		Label:    "按月份分析",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Mating_Times),
-		Label:    "按配种次数分析",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Method),
-		Label:    "按配种方式分析",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Company),
-		Label:    "按育种公司分析",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Operation),
-		Label:    "按兽医人员分析",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Mating_Interval),
-		Label:    "按配种间隔分析",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Bull),
-		Label:    "按公牛号分析",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Cycle),
-		Label:    "按配种周期分析",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Week),
-		Label:    "按星期分析",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Lact),
-		Label:    "按胎次分析",
-		Disabled: true,
-	})
-	return configOptions
+func (s *StoreEntry) SingleFactorAnalysisMethodEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigSingleFactorAnalysisMethod, 0)
+	pref := s.DB.Model(new(model.ConfigSingleFactorAnalysisMethod)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.DiseaseAnalysisMethod_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.DiseaseAnalysisMethod_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("SingleFactorAnalysisMethodEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigSingleFactorAnalysisMethodSlice(dataList).ToPB(userModel.Language)
+
+	/*
+		func (s *StoreEntry) SingleFactorAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+			configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+			configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Cycle),
+				Label:    "按周期分析",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Months),
+				Label:    "按月份分析",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Mating_Times),
+				Label:    "按配种次数分析",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Method),
+				Label:    "按配种方式分析",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Company),
+				Label:    "按育种公司分析",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Operation),
+				Label:    "按兽医人员分析",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Mating_Interval),
+				Label:    "按配种间隔分析",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Bull),
+				Label:    "按公牛号分析",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Cycle),
+				Label:    "按配种周期分析",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Week),
+				Label:    "按星期分析",
+				Disabled: true,
+			}, &pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Lact),
+				Label:    "按胎次分析",
+				Disabled: true,
+			})
+			return configOptions
+	*/
 }
 
-func (s *StoreEntry) LactIntervalSymbolEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) LactIntervalSymbolEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigLactIntervalSymbol, 0)
+	pref := s.DB.Model(new(model.ConfigLactIntervalSymbol)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.CompareSymbol_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.CompareSymbol_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("LactIntervalSymbolEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigLactIntervalSymbolSlice(dataList).ToPB(userModel.Language)
+
+	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.CompareSymbol_Less_Than),
 		Label:    "<",
@@ -176,11 +233,28 @@ func (s *StoreEntry) LactIntervalSymbolEnumList(isAll string) []*pasturePb.Confi
 		Label:    "不包含",
 		Disabled: true,
 	})
-	return configOptions
+	return configOptions*/
 }
 
-func (s *StoreEntry) MultiFactorAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) MultiFactorAnalysisMethodEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigMultiFactorAnalysisMethod, 0)
+	pref := s.DB.Model(new(model.ConfigMultiFactorAnalysisMethod)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.CompareSymbol_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.CompareSymbol_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("LactIntervalSymbolEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigMultiFactorAnalysisMethodSlice(dataList).ToPB(userModel.Language)
+	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Months),
 		Label:    "月份",
@@ -217,11 +291,28 @@ func (s *StoreEntry) MultiFactorAnalysisMethodEnumList(isAll string) []*pastureP
 		Props:    "exposeEstrusType",
 		Disabled: true,
 	})
-	return configOptions
+	return configOptions*/
 }
 
-func (s *StoreEntry) SaleCowAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) SaleCowAnalysisMethodEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigSaleCowAnalysisMethod, 0)
+	pref := s.DB.Model(new(model.ConfigSaleCowAnalysisMethod)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.CompareSymbol_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.CompareSymbol_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("LactIntervalSymbolEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigSaleCowAnalysisMethodSlice(dataList).ToPB(userModel.Language)
+	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.SaleCowAnalysisMethod_Months),
 		Label:    "月份",
@@ -231,11 +322,28 @@ func (s *StoreEntry) SaleCowAnalysisMethodEnumList(isAll string) []*pasturePb.Co
 		Label:    "经销商",
 		Disabled: true,
 	})
-	return configOptions
+	return configOptions*/
 }
 
-func (s *StoreEntry) NeckRingIsBindEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) NeckRingIsBindEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigNeckRingIsBind, 0)
+	pref := s.DB.Model(new(model.ConfigNeckRingStatus)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.NeckRingIsBind_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.NeckRingIsBind_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("NeckRingIsBindEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigNeckRingIsBindSlice(dataList).ToPB(userModel.Language)
+	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
 			&pasturePb.ConfigOptionsList{
@@ -253,11 +361,28 @@ func (s *StoreEntry) NeckRingIsBindEnumList(isAll string) []*pasturePb.ConfigOpt
 		Label:    "未绑定",
 		Disabled: true,
 	})
-	return configOptions
+	return configOptions*/
 }
 
-func (s *StoreEntry) NeckRingStatusEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) NeckRingStatusEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigNeckRingStatus, 0)
+	pref := s.DB.Model(new(model.ConfigNeckRingStatus)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.NeckRingStatus_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.NeckRingStatus_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("NeckRingStatusEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigNeckRingStatusSlice(dataList).ToPB(userModel.Language)
+	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
 			&pasturePb.ConfigOptionsList{
@@ -275,11 +400,28 @@ func (s *StoreEntry) NeckRingStatusEnumList(isAll string) []*pasturePb.ConfigOpt
 		Label:    "异常",
 		Disabled: true,
 	})
-	return configOptions
+	return configOptions*/
 }
 
-func CalendarTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) CalendarTypeEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigCalendarType, 0)
+	pref := s.DB.Model(new(model.ConfigCalendarType)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.CalendarType_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.CalendarType_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("CalendarTypeEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigCalendarTypeSlice(dataList).ToPB(userModel.Language)
+	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 			Value:    int32(pasturePb.CalendarType_Invalid),
@@ -324,11 +466,11 @@ func CalendarTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 		Label:    "干奶",
 		Disabled: true,
 	})
-	return configOptions
+	return configOptions*/
 }
 
-func (s *StoreEntry) AbortionReasonsEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	/*configAbortionReasonList := make([]*model.ConfigAbortionReasons, 0)
+func (s *StoreEntry) AbortionReasonsEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigAbortionReasons, 0)
 	pref := s.DB.Model(new(model.ConfigAbortionReasons)).
 		Where("is_show =? ", pasturePb.IsShow_Ok).
 		Where("pasture_id =? ", userModel.AppPasture.Id)
@@ -339,66 +481,33 @@ func (s *StoreEntry) AbortionReasonsEnumList(isAll string) []*pasturePb.ConfigOp
 	}
 
 	if err := pref.Order("kind ASC").
-		Find(&configAbortionReasonList).Error; err != nil {
-		return nil, xerr.WithStack(err)
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("AbortionReasonsEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
 
-	return model.ConfigAbortionReasonsSlice(configAbortionReasonList).ToPB(userModel.Language)*/
+	return model.ConfigAbortionReasonsSlice(dataList).ToPB(userModel.Language)
+}
 
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) CalvingAnalysisMethodEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigCalvingAnalysisMethod, 0)
+	pref := s.DB.Model(new(model.ConfigCalvingAnalysisMethod)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
 	if isAll == model.IsAllYes {
-		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.AbortionReasons_Invalid),
-			Label:    "全部",
-			Disabled: true,
-		})
+		pref = pref.Where("kind >= ?", pasturePb.CalvingAnalysisMethod_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.CalvingAnalysisMethod_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("CalvingAnalysisMethodEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.AbortionReasons_Mechanical_Abortion),
-		Label:    "机械性流产",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.AbortionReasons_Malnutrition_Abortion),
-		Label:    "营养不良流产",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.AbortionReasons_Mycotoxin_Abortion),
-		Label:    "霉菌毒素流产",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.AbortionReasons_Habitual_Abortion),
-		Label:    "习惯性流产",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.AbortionReasons_Brucellosis_Abortion),
-		Label:    "布病流产",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.AbortionReasons_Inflammatory_Abortion),
-		Label:    "产道炎症性流产",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.AbortionReasons_Heat_Stress_Abortion),
-		Label:    "热应激流产",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.AbortionReasons_Infectious_Abortion),
-		Label:    "传染病性流产",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.AbortionReasons_Unknown),
-		Label:    "未知原因",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.AbortionReasons_Other),
-		Label:    "其他",
-		Disabled: true,
-	})
-	return configOptions
-}
 
-func (s *StoreEntry) CalvingAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	return model.ConfigCalvingAnalysisMethodSlice(dataList).ToPB(userModel.Language)
+	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 			Value:    int32(pasturePb.CalvingAnalysisMethod_Invalid),
@@ -415,5 +524,5 @@ func (s *StoreEntry) CalvingAnalysisMethodEnumList(isAll string) []*pasturePb.Co
 		Label:    "按照品种统计",
 		Disabled: true,
 	})
-	return configOptions
+	return configOptions*/
 }

+ 7 - 3
module/backend/enum_map.go

@@ -1,6 +1,10 @@
 package backend
 
-import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+import (
+	"kpt-pasture/model"
+
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+)
 
 func (s *StoreEntry) DrugCategoryMaps() map[pasturePb.DrugCategory_Kind]string {
 	res := make(map[pasturePb.DrugCategory_Kind]string)
@@ -139,9 +143,9 @@ func CalendarTypeMap() map[pasturePb.CalendarType_Kind]string {
 	return res
 }
 
-func (s *StoreEntry) AbortionReasonsMap() map[pasturePb.AbortionReasons_Kind]string {
+func (s *StoreEntry) AbortionReasonsMap(userModel *model.UserModel) map[pasturePb.AbortionReasons_Kind]string {
 	res := make(map[pasturePb.AbortionReasons_Kind]string)
-	for _, v := range s.AbortionReasonsEnumList("") {
+	for _, v := range s.AbortionReasonsEnumList(userModel, "") {
 		res[pasturePb.AbortionReasons_Kind(v.Value)] = v.Label
 	}
 	return res

+ 1 - 1
module/backend/enum_options.go

@@ -84,7 +84,7 @@ func (s *StoreEntry) DiseaseTypeOptions(ctx context.Context, isChildren string)
 	return &pasturePb.ConfigOptionsListResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
-		Data: model.ConfigDiseaseTypeSlice(diseaseTypeList).ToPB2(diseaseList),
+		Data: model.ConfigDiseaseTypeSlice(diseaseTypeList).ToPB2(userModel.Language, diseaseList),
 	}, nil
 }
 

+ 1 - 1
module/backend/event_breed_more.go

@@ -74,7 +74,7 @@ func (s *StoreEntry) PregnantCheckCreateBatch(ctx context.Context, req *pastureP
 		return xerr.WithStack(err)
 	}
 
-	abortionReasonsMap := s.AbortionReasonsMap()
+	abortionReasonsMap := s.AbortionReasonsMap(userModel)
 	matingResultMap := s.MatingResultMap()
 
 	if err = s.DB.Transaction(func(tx *gorm.DB) error {

+ 1 - 1
module/backend/event_check.go

@@ -520,7 +520,7 @@ func (s *StoreEntry) AbortionEventDataCheck(ctx context.Context, userModel *mode
 		}
 
 		item.OperationName = operationUser.Name
-		item.AbortionReasonsName = s.AbortionReasonsMap()[item.AbortionReasons]
+		item.AbortionReasonsName = s.AbortionReasonsMap(userModel)[item.AbortionReasons]
 		newEventAbortion := model.NewEventAbortion(userModel.AppPasture.Id, cow, item, pasturePb.IsShow_No)
 		abortionCheckBatchModelList = append(abortionCheckBatchModelList, &AbortionCheckBatchModel{
 			EventAbortion: newEventAbortion,

+ 5 - 1
module/backend/pasture.go

@@ -138,6 +138,10 @@ func (s *StoreEntry) CreateOrUpdateBarnType(ctx context.Context, req *pasturePb.
 }
 
 func (s *StoreEntry) SearchBreedStatusList(ctx context.Context, req *pasturePb.SearchNameRequest, pagination *pasturePb.PaginationModel) (*pasturePb.SearchBaseConfigResponse, error) {
+	userModel, err := s.GetUserModel(ctx)
+	if err != nil {
+		return nil, xerr.WithStack(err)
+	}
 	breedStatusList := make([]*model.ConfigBreedStatus, 0)
 	var count int64 = 0
 
@@ -155,7 +159,7 @@ func (s *StoreEntry) SearchBreedStatusList(ctx context.Context, req *pasturePb.S
 		Code: http.StatusOK,
 		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
-			List:     model.ConfigBreedStatusSlice(breedStatusList).ToPB(),
+			List:     model.ConfigBreedStatusSlice(breedStatusList).ToPB(userModel.Language),
 			Total:    int32(count),
 			PageSize: pagination.PageSize,
 			Page:     pagination.Page,

+ 10 - 5
module/backend/prescription.go

@@ -9,6 +9,8 @@ import (
 	"strconv"
 	"strings"
 
+	"golang.org/x/text/language"
+
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
 	"gitee.com/xuyiping_admin/pkg/xerr"
 	"gorm.io/gorm"
@@ -134,13 +136,13 @@ func (s *StoreEntry) SearchDiseaseList(ctx context.Context, req *pasturePb.Searc
 	}
 
 	systemUserList, _ := s.SystemUserList(ctx, pastureId)
-	diseaseTypeList, _ := s.DiseaseTypeList(ctx)
+	diseaseTypeList, _ := s.DiseaseTypeList(pastureId)
 
 	return &pasturePb.SearchDiseaseResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
 		Data: &pasturePb.SearchDiseaseData{
-			List:     model.DiseaseSlice(diseaseList).ToPB(systemUserList, diseaseTypeList),
+			List:     model.DiseaseSlice(diseaseList).ToPB(userModel.Language, systemUserList, diseaseTypeList),
 			Total:    int32(count),
 			PageSize: pagination.PageSize,
 			Page:     pagination.Page,
@@ -163,11 +165,14 @@ func (s *StoreEntry) CreateOrUpdateDisease(ctx context.Context, req *pasturePb.S
 		}
 	}
 
-	diseaseTypeList, _ := s.DiseaseTypeList(ctx)
+	diseaseTypeList, _ := s.DiseaseTypeList(userModel.AppPasture.Id)
 	if req.DiseaseTypeId > 0 {
 		for _, v := range diseaseTypeList {
 			if int32(v.Id) == req.DiseaseTypeId {
-				req.DiseaseTypeName = v.Name
+				req.DiseaseTypeName = v.Zh
+				if userModel.Language == language.English.String() {
+					req.DiseaseTypeName = v.En
+				}
 			}
 		}
 	}
@@ -212,7 +217,7 @@ func (s *StoreEntry) SearchDiseaseTypeList(ctx context.Context, req *pasturePb.S
 		Code: http.StatusOK,
 		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
-			List:     model.ConfigDiseaseTypeSlice(diseaseTypeList).ToPB(),
+			List:     model.ConfigDiseaseTypeSlice(diseaseTypeList).ToPB(userModel.Language),
 			Total:    int32(count),
 			PageSize: pagination.PageSize,
 			Page:     pagination.Page,

+ 2 - 1
module/backend/sql.go

@@ -362,9 +362,10 @@ func (s *StoreEntry) GetDrugsById(ctx context.Context, pastureId, drugsId int64)
 	return drugs, nil
 }
 
-func (s *StoreEntry) DiseaseTypeList(ctx context.Context) ([]*model.ConfigDiseaseType, error) {
+func (s *StoreEntry) DiseaseTypeList(pastureId int64) ([]*model.ConfigDiseaseType, error) {
 	diseaseTypeList := make([]*model.ConfigDiseaseType, 0)
 	if err := s.DB.Model(new(model.ConfigDiseaseType)).
+		Where("pasture_id = ?", pastureId).
 		Where("is_show = ?", pasturePb.IsShow_Ok).
 		Find(&diseaseTypeList).Error; err != nil {
 		return nil, xerr.WithStack(err)