#4 v1.0

已關閉
xuyiping 請求將 4 次代碼提交從 xuyiping/feature/event 合併至 xuyiping/develop
共有 65 個文件被更改,包括 2338 次插入1240 次删除
  1. 5 0
      http/route/pasture_api.go
  2. 94 1
      locales/en.json
  3. 150 1
      locales/zh.json
  4. 0 1
      model/config_abortion_reasons.go
  5. 29 8
      model/config_barn_type.go
  6. 29 8
      model/config_breed_status.go
  7. 37 0
      model/config_calendar_type.go
  8. 37 0
      model/config_calving_analysis_method.go
  9. 38 0
      model/config_calving_level.go
  10. 38 0
      model/config_child_number.go
  11. 38 0
      model/config_cow_death_destination.go
  12. 29 8
      model/config_cow_kind.go
  13. 38 0
      model/config_cow_out_reason.go
  14. 38 0
      model/config_cow_purpose.go
  15. 29 8
      model/config_cow_source.go
  16. 34 8
      model/config_cow_type.go
  17. 38 0
      model/config_death_reason.go
  18. 37 0
      model/config_disease_analysis_method.go
  19. 32 5
      model/config_disease_type.go
  20. 38 0
      model/config_dystocia_reason.go
  21. 38 0
      model/config_event_category.go
  22. 38 0
      model/config_immunization_conditions.go
  23. 38 0
      model/config_indicators_category.go
  24. 38 0
      model/config_lact.go
  25. 37 0
      model/config_lact_interval_symbol.go
  26. 38 0
      model/config_mating_result.go
  27. 39 0
      model/config_multi_factor_analysis_method.go
  28. 37 0
      model/config_neck_ring_isbind.go
  29. 37 0
      model/config_neck_ring_status.go
  30. 38 0
      model/config_pregnant_check_result.go
  31. 38 0
      model/config_sale_cow_analysis_method.go
  32. 38 0
      model/config_same_time_cow_type.go
  33. 38 0
      model/config_same_time_type.go
  34. 37 0
      model/config_single_factor_analysis_method.go
  35. 29 8
      model/config_transfer_pen_reason.go
  36. 5 2
      model/disease.go
  37. 1 1
      module/backend/analysis_cow.go
  38. 2 2
      module/backend/analysis_more.go
  39. 4 4
      module/backend/analysis_other.go
  40. 3 3
      module/backend/calendar.go
  41. 6 6
      module/backend/calendar_more.go
  42. 227 375
      module/backend/config_data.go
  43. 113 359
      module/backend/config_data_base.go
  44. 297 185
      module/backend/config_data_breed.go
  45. 11 11
      module/backend/config_data_extend.go
  46. 16 16
      module/backend/config_data_other.go
  47. 16 16
      module/backend/cow.go
  48. 7 7
      module/backend/dashboard.go
  49. 100 104
      module/backend/enum_map.go
  50. 40 14
      module/backend/enum_options.go
  51. 5 5
      module/backend/event_base.go
  52. 1 1
      module/backend/event_base_more.go
  53. 1 1
      module/backend/event_breed.go
  54. 6 6
      module/backend/event_breed_more.go
  55. 5 5
      module/backend/event_check.go
  56. 14 10
      module/backend/event_cow_log.go
  57. 4 4
      module/backend/event_health.go
  58. 15 15
      module/backend/goods.go
  59. 4 4
      module/backend/indicators.go
  60. 2 2
      module/backend/neck_ring_warning.go
  61. 34 8
      module/backend/pasture.go
  62. 14 9
      module/backend/prescription.go
  63. 2 1
      module/backend/sql.go
  64. 5 1
      module/backend/test_service.go
  65. 12 7
      module/backend/work.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)

+ 94 - 1
locales/en.json

@@ -96,5 +96,98 @@
   "goods.frozenSemenNotExist": "The frozen semen information does not exist!",
   "goods.frozenSemenNotEnough": "Insufficient quantity of frozen semen!",
   "pasture.dealerNotExist": "This dealer information was not found!",
-  "pasture.dealerError": "Dealer data exception!"
+  "pasture.dealerError": "Dealer data exception!",
+  "config.saleCowAnalysisMethod0":"All",
+  "config.saleCowAnalysisMethod1":"Month",
+  "config.saleCowAnalysisMethod2":"Dealer",
+  "config.barnType0": "All",
+  "config.barnType1": "Calve Barn",
+  "config.barnType2": "Weaning Barn",
+  "config.barnType3": "Nurturing Barn",
+  "config.barnType4": "Youth Barn",
+  "config.barnType5": "Lactation Barn",
+  "config.barnType6": "Perinatal Barn",
+  "config.barnType7": "Dry Dairy Barn",
+  "config.barnType8": "Disease Barn",
+  "config.barnType9": "Out Barn",
+  "config.barnType10": "Segregate Barn",
+  "config.barnType11": "Bull Barn",
+  "config.barnType12": "Reserve Barn",
+  "config.breedStatus0": "All",
+  "config.breedStatus1": "UnBreed",
+  "config.breedStatus2": "Breeding",
+  "config.breedStatus3": "Pregnant",
+  "config.breedStatus4": "Empty",
+  "config.breedStatus5": "Calving",
+  "config.breedStatus6": "Abortion",
+  "config.breedStatus7": "NoMating",
+  "config.cowKind0": "All",
+  "config.cowKind1": "Holstein",
+  "config.cowKind2": "Jersey",
+  "config.cowKind3": "Sanhe",
+  "config.cowKind4": "Xinjiang Brown",
+  "config.cowKind5": "Yak",
+  "config.cowKind6": "Simmental",
+  "config.cowKind7": "Angus",
+  "config.cowKind8": "Charolais",
+  "config.cowKind9": "Limousin",
+  "config.cowKind10": "Hereford",
+  "config.cowKind11": "Wagyu",
+  "config.cowKind12": "Huaxi",
+  "config.cowSource0": "All",
+  "config.cowSource1": "Calving",
+  "config.cowSource2": "Transfer In",
+  "config.cowSource3": "Buy",
+  "config.sameTimeCowType0": "All",
+  "config.sameTimeCowType1": "Empty",
+  "config.sameTimeCowType2": "Breeding Calf",
+  "config.sameTimeType0": "All",
+  "config.sameTimeType1": "PG1",
+  "config.sameTimeType2": "PG2",
+  "config.sameTimeType3": "RnGH",
+  "config.sameTimeType4": "TAI",
+  "config.cowType0": "All",
+  "config.cowType1": "Lactating Calf",
+  "config.cowType2": "Weaned Calf",
+  "config.cowType3": "Youth Calf",
+  "config.cowType4": "Fattening Calf",
+  "config.cowType5": "Reserve Calf",
+  "config.cowType6": "Breeding Calf",
+  "config.cowType7": "Bull",
+  "config.immunizationConditions0": "All",
+  "config.immunizationConditions1": "Day Age",
+  "config.immunizationConditions2": "Postpartum days",
+  "config.immunizationConditions3": "Pregnancy days",
+  "config.immunizationConditions4": "Month",
+  "config.immunizationConditions5": "Admission days",
+  "config.immunizationConditions6": "After Other Vaccines",
+  "config.transferPenReason0": "All",
+  "config.transferPenReason1": "Normal Transfer",
+  "config.transferPenReason2": "Feed Transfer",
+  "config.transferPenReason3": "Dry Milk Transfer",
+  "config.transferPenReason4": "Pregnant Transfer",
+  "config.transferPenReason5": "Overantibody Transfer",
+  "config.childNumber0": "All",
+  "config.childNumber1": "One",
+  "config.childNumber2": "Two",
+  "config.childNumber3": "Three",
+  "config.childNumber4": "Four",
+  "config.calvingLevel0": "All",
+  "config.calvingLevel1": "Natural Childbirth",
+  "config.calvingLevel2": "Artificial midwifery(1-2)",
+  "config.calvingLevel3": "Artificial midwifery(3)",
+  "config.calvingLevel4": "Cesarean",
+  "config.dystociaReason0": "All",
+  "config.dystociaReason1": "Malposition",
+  "config.dystociaReason2": "Fetal Overgrowth",
+  "config.dystociaReason3": "Uterine Atony",
+  "config.dystociaReason4": "Pelvic Stenosis",
+  "config.dystociaReason5": "SubHealth",
+  "config.pregnantCheckResult0": "All",
+  "config.pregnantCheckResult1": "Pregnant",
+  "config.pregnantCheckResult2": "UnPregnant",
+  "config.cowDeathDestination0": "All",
+  "config.cowDeathDestination1": "NuisanceLess",
+  "config.cowDeathDestination2": "Slaughterhouse",
+  "config.cowDeathDestination3": "Other"
 }

+ 150 - 1
locales/zh.json

@@ -96,5 +96,154 @@
   "goods.frozenSemenNotExist": "该冻精信息不存在!",
   "goods.frozenSemenNotEnough": "冻精数量不足!",
   "pasture.dealerNotExist": "未找到该经销商信息!",
-  "pasture.dealerError": "经销商数据异常!"
+  "pasture.dealerError": "经销商数据异常!",
+  "config.saleCowAnalysisMethod0":"全部",
+  "config.saleCowAnalysisMethod1":"月份",
+  "config.saleCowAnalysisMethod2":"经销商",
+  "config.barnType0": "全部",
+  "config.barnType1": "犊牛牛舍",
+  "config.barnType2": "断奶牛舍",
+  "config.barnType3": "育成牛舍",
+  "config.barnType4": "青年牛舍",
+  "config.barnType5": "泌乳牛舍",
+  "config.barnType6": "围产牛舍",
+  "config.barnType7": "干奶牛舍",
+  "config.barnType8": "病牛牛舍",
+  "config.barnType9": "淘汰牛舍",
+  "config.barnType10": "隔离牛舍",
+  "config.barnType11": "公牛牛舍",
+  "config.barnType12": "后备牛舍",
+  "config.breedStatus0": "全部",
+  "config.breedStatus1": "未配",
+  "config.breedStatus2": "已配未检",
+  "config.breedStatus3": "怀孕",
+  "config.breedStatus4": "空怀",
+  "config.breedStatus5": "产犊",
+  "config.breedStatus6": "流产",
+  "config.breedStatus7": "禁配",
+  "config.cowKind0": "全部",
+  "config.cowKind1": "荷斯坦",
+  "config.cowKind2": "娟姗牛",
+  "config.cowKind3": "三河牛",
+  "config.cowKind4": "新疆褐牛",
+  "config.cowKind5": "牦牛",
+  "config.cowKind6": "西门塔尔牛",
+  "config.cowKind7": "安格斯牛",
+  "config.cowKind8": "夏洛莱牛",
+  "config.cowKind9": "利木赞牛",
+  "config.cowKind10": "海福特牛",
+  "config.cowKind11": "和牛",
+  "config.cowKind12": "华西牛",
+  "config.cowSource0": "全部",
+  "config.cowSource1": "产犊",
+  "config.cowSource2": "调入",
+  "config.cowSource3": "购买",
+  "config.sameTimeCowType0": "全部",
+  "config.sameTimeCowType1": "空怀牛",
+  "config.sameTimeCowType2": "成母牛",
+  "config.sameTimeType0": "全部",
+  "config.sameTimeType1": "PG保健",
+  "config.sameTimeType2": "PG同期",
+  "config.sameTimeType3": "RnGH",
+  "config.sameTimeType4": "配种",
+  "config.cowType0": "全部",
+  "config.cowType1": "犊牛",
+  "config.cowType2": "育成牛",
+  "config.cowType3": "青年牛",
+  "config.cowType4": "育肥牛",
+  "config.cowType5": "后备牛",
+  "config.cowType6": "成母牛",
+  "config.cowType7": "种公牛",
+  "config.immunizationConditions0": "全部",
+  "config.immunizationConditions1": "日龄",
+  "config.immunizationConditions2": "产后天数",
+  "config.immunizationConditions3": "怀孕天数",
+  "config.immunizationConditions4": "月份",
+  "config.immunizationConditions5": "入场天数",
+  "config.immunizationConditions6": "基于其他疫苗之后",
+  "config.transferPenReason0": "全部",
+  "config.transferPenReason1": "正常转群",
+  "config.transferPenReason2": "饲喂转群",
+  "config.transferPenReason3": "干奶转群",
+  "config.transferPenReason4": "怀孕转群",
+  "config.transferPenReason5": "过抗转群",
+  "config.childNumber0": "全部",
+  "config.childNumber1": "单胎",
+  "config.childNumber2": "双胎",
+  "config.childNumber3": "三胎",
+  "config.childNumber4": "四胎",
+  "config.calvingLevel0": "全部",
+  "config.calvingLevel1": "自然分娩",
+  "config.calvingLevel2": "人工助产(1-2人)",
+  "config.calvingLevel3": "人工助产(3人以上)",
+  "config.calvingLevel4": "剖腹产",
+  "config.dystociaReason0": "全部",
+  "config.dystociaReason1": "胎位不正",
+  "config.dystociaReason2": "胎儿过大",
+  "config.dystociaReason3": "子宫收缩无力",
+  "config.dystociaReason4": "盆骨狭小",
+  "config.dystociaReason5": "母牛亚健康状态",
+  "config.pregnantCheckResult0": "全部",
+  "config.pregnantCheckResult1": "有胎",
+  "config.pregnantCheckResult2": "无胎",
+  "config.cowDeathDestination0": "全部",
+  "config.cowDeathDestination1": "无公害处理",
+  "config.cowDeathDestination2": "屠宰场",
+  "config.cowDeathDestination3": "其他",
+  "config.cowOutReason0": "全部",
+  "config.cowOutReason1": "呼吸系统疾病",
+  "config.cowOutReason2": "营养代谢疾病",
+  "config.cowOutReason3": "繁殖疾病",
+  "config.cowOutReason4": "乳房疾病",
+  "config.cowOutReason5": "久配不孕",
+  "config.cowOutReason6": "多次流产",
+  "config.cowOutReason7": "久治不愈",
+  "config.cowOutReason8": "产后瘫痪",
+  "config.cowOutReason9": "乳房炎",
+  "config.cowOutReason10": "蹄病",
+  "config.cowOutReason11": "先天畸形",
+  "config.cowOutReason12": "发育不良",
+  "config.cowOutReason13": "疝气",
+  "config.cowOutReason14": "月龄过大",
+  "config.cowOutReason15": "体重过肥",
+  "config.cowOutReason16": "其他疾病",
+  "config.cowOutReason17": "弱仔",
+  "config.cowOutReason18": "恶癖牛",
+  "config.cowOutReason19": "低产",
+  "config.cowOutReason20": "生长缓慢",
+  "config.cowOutReason99": "其他",
+  "config.cowOutReason100": "未知原因",
+  "config.cowPurpose0": "全部",
+  "config.cowPurpose1": "繁殖",
+  "config.cowPurpose2": "育肥",
+  "config.indicatorsCategory0": "全部",
+  "config.indicatorsCategory1": "基本指标",
+  "config.indicatorsCategory2": "繁殖指标",
+  "config.indicatorsCategory3": "健康指标",
+  "config.indicatorsCategory4": "饲喂指标",
+  "config.indicatorsCategory5": "犊牛指标",
+  "config.indicatorsCategory6": "育肥指标",
+  "config.matingResult0": "全部",
+  "config.matingResult1": "未知",
+  "config.matingResult2": "复配",
+  "config.matingResult3": "怀孕",
+  "config.matingResult4": "空怀",
+  "config.matingResult5": "流产",
+  "config.deathReason0": "全部",
+  "config.deathReason1": "消化性疾病",
+  "config.deathReason2": "呼吸性疾病",
+  "config.deathReason3": "繁殖性疾病",
+  "config.deathReason4": "繁殖性疾病",
+  "config.deathReason5": "繁殖性疾病",
+  "config.deathReason6": "难产",
+  "config.deathReason7": "意外死亡",
+  "config.deathReason8": "热应激",
+  "config.deathReason9": "外伤",
+  "config.deathReason10": "肺炎",
+  "config.deathReason11": "腹泻",
+  "config.deathReason13": "酮病",
+  "config.deathReason14": "酸中毒",
+  "config.deathReason15": "瘤胃积食",
+  "config.deathReason16": "肠扭转",
+  "config.deathReason99": "其他"
 }

+ 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"`

+ 29 - 8
model/config_barn_type.go

@@ -2,15 +2,18 @@ package model
 
 import (
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
 )
 
 type ConfigPenType 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.PenType_Kind `json:"kind"`
+	I18NFieldTag string                 `json:"I18NFieldTag"`
+	Remarks      string                 `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind  `json:"isShow"`
+	CreatedAt    int64                  `json:"createdAt"`
+	UpdatedAt    int64                  `json:"updatedAt"`
 }
 
 func (c *ConfigPenType) TableName() string {
@@ -19,12 +22,15 @@ func (c *ConfigPenType) TableName() string {
 
 type ConfigBarnTypeSlice []*ConfigPenType
 
-func (c ConfigBarnTypeSlice) ToPB() []*pasturePb.SearchBaseConfigList {
+func (c ConfigBarnTypeSlice) ToPB(userModel *UserModel) []*pasturePb.SearchBaseConfigList {
 	res := make([]*pasturePb.SearchBaseConfigList, len(c))
 	for i, d := range c {
+		name, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: d.I18NFieldTag,
+		})
 		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 +39,18 @@ func (c ConfigBarnTypeSlice) ToPB() []*pasturePb.SearchBaseConfigList {
 	}
 	return res
 }
+
+func (c ConfigBarnTypeSlice) ToPB2(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 29 - 8
model/config_breed_status.go

@@ -2,15 +2,18 @@ package model
 
 import (
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
 )
 
 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"`
+	I18NFieldTag string                     `json:"i18NFieldTag"`
+	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 +22,15 @@ func (c *ConfigBreedStatus) TableName() string {
 
 type ConfigBreedStatusSlice []*ConfigBreedStatus
 
-func (c ConfigBreedStatusSlice) ToPB() []*pasturePb.SearchBaseConfigList {
+func (c ConfigBreedStatusSlice) ToPB(userModel *UserModel) []*pasturePb.SearchBaseConfigList {
 	res := make([]*pasturePb.SearchBaseConfigList, len(c))
 	for i, d := range c {
+		name, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: d.I18NFieldTag,
+		})
 		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 +39,18 @@ func (c ConfigBreedStatusSlice) ToPB() []*pasturePb.SearchBaseConfigList {
 	}
 	return res
 }
+
+func (c ConfigBreedStatusSlice) ToPB2(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 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
+}

+ 38 - 0
model/config_calving_level.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigCalvingLevel struct {
+	Id           int32                       `json:"id"`
+	PastureId    int64                       `json:"pastureId"`
+	Kind         pasturePb.CalvingLevel_Kind `json:"kind"`
+	I18NFieldTag string                      `json:"i18nFieldTag"`
+	Remarks      string                      `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind       `json:"isShow"`
+	CreatedAt    int64                       `json:"createdAt"`
+	UpdatedAt    int64                       `json:"updatedAt"`
+}
+
+func (c *ConfigCalvingLevel) TableName() string {
+	return "config_calving_level"
+}
+
+type ConfigCalvingLevelSlice []*ConfigCalvingLevel
+
+func (c ConfigCalvingLevelSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 38 - 0
model/config_child_number.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigChildNumber struct {
+	Id           int32                      `json:"id"`
+	PastureId    int64                      `json:"pastureId"`
+	Kind         pasturePb.ChildNumber_Kind `json:"kind"`
+	I18NFieldTag string                     `json:"i18nFieldTag"`
+	Remarks      string                     `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind      `json:"isShow"`
+	CreatedAt    int64                      `json:"createdAt"`
+	UpdatedAt    int64                      `json:"updatedAt"`
+}
+
+func (c *ConfigChildNumber) TableName() string {
+	return "config_child_number"
+}
+
+type ConfigChildNumberSlice []*ConfigChildNumber
+
+func (c ConfigChildNumberSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		name, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    name,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 38 - 0
model/config_cow_death_destination.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigCowDeathDestination struct {
+	Id           int64                           `json:"id"`
+	PastureId    int64                           `json:"pastureId"`
+	Kind         pasturePb.DeathDestination_Kind `json:"kind"`
+	I18NFieldTag string                          `json:"i18NFieldTag"`
+	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(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 29 - 8
model/config_cow_kind.go

@@ -2,15 +2,18 @@ package model
 
 import (
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
 )
 
 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"`
+	I18NFieldTag string                 `json:"i18nFieldTag"`
+	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 +22,15 @@ func (c *ConfigCowKind) TableName() string {
 
 type ConfigCowKindSlice []*ConfigCowKind
 
-func (c ConfigCowKindSlice) ToPB() []*pasturePb.SearchBaseConfigList {
+func (c ConfigCowKindSlice) ToPB(userModel *UserModel) []*pasturePb.SearchBaseConfigList {
 	res := make([]*pasturePb.SearchBaseConfigList, len(c))
 	for i, d := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: d.I18NFieldTag,
+		})
 		res[i] = &pasturePb.SearchBaseConfigList{
 			Id:        int32(d.Id),
-			Name:      d.Name,
+			Name:      label,
 			Remarks:   d.Remarks,
 			IsShow:    d.IsShow,
 			CreatedAt: int32(d.CreatedAt),
@@ -33,3 +39,18 @@ func (c ConfigCowKindSlice) ToPB() []*pasturePb.SearchBaseConfigList {
 	}
 	return res
 }
+
+func (c ConfigCowKindSlice) ToPB2(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 38 - 0
model/config_cow_out_reason.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigCowOutReason struct {
+	Id           int64                     `json:"id"`
+	PastureId    int64                     `json:"pastureId"`
+	Kind         pasturePb.OutReasons_Kind `json:"kind"`
+	I18NFieldTag string                    `json:"i18nFieldTag"`
+	Remarks      string                    `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind     `json:"isShow"`
+	CreatedAt    int64                     `json:"createdAt"`
+	UpdatedAt    int64                     `json:"updatedAt"`
+}
+
+func (c *ConfigCowOutReason) TableName() string {
+	return "config_cow_out_reason"
+}
+
+type ConfigCowOutReasonSlice []*ConfigCowOutReason
+
+func (c ConfigCowOutReasonSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 38 - 0
model/config_cow_purpose.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigCowPurpose struct {
+	Id           int64                  `json:"id"`
+	PastureId    int64                  `json:"pastureId"`
+	Kind         pasturePb.Purpose_Kind `json:"kind"`
+	I18NFieldTag string                 `json:"i18nFieldTag"`
+	Remarks      string                 `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind  `json:"isShow"`
+	CreatedAt    int64                  `json:"createdAt"`
+	UpdatedAt    int64                  `json:"updatedAt"`
+}
+
+func (c *ConfigCowPurpose) TableName() string {
+	return "config_cow_purpose"
+}
+
+type ConfigCowPurposeSlice []*ConfigCowPurpose
+
+func (c ConfigCowPurposeSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 29 - 8
model/config_cow_source.go

@@ -2,15 +2,18 @@ package model
 
 import (
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
 )
 
 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"`
+	I18NFieldTag string                   `json:"i18NFieldTag"`
+	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 +22,15 @@ func (c *ConfigCowSource) TableName() string {
 
 type ConfigCowSourceSlice []*ConfigCowSource
 
-func (c ConfigCowSourceSlice) ToPB() []*pasturePb.SearchBaseConfigList {
+func (c ConfigCowSourceSlice) ToPB(userModel *UserModel) []*pasturePb.SearchBaseConfigList {
 	res := make([]*pasturePb.SearchBaseConfigList, len(c))
 	for i, d := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: d.I18NFieldTag,
+		})
 		res[i] = &pasturePb.SearchBaseConfigList{
 			Id:        int32(d.Id),
-			Name:      d.Name,
+			Name:      label,
 			Remarks:   d.Remarks,
 			IsShow:    d.IsShow,
 			CreatedAt: int32(d.CreatedAt),
@@ -33,3 +39,18 @@ func (c ConfigCowSourceSlice) ToPB() []*pasturePb.SearchBaseConfigList {
 	}
 	return res
 }
+
+func (c ConfigCowSourceSlice) ToPB2(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 34 - 8
model/config_cow_type.go

@@ -2,15 +2,17 @@ package model
 
 import (
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
 )
 
 type ConfigCowType 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"`
+	Kind         pasturePb.CowType_Kind `json:"kind"`
+	I18NFieldTag string                 `json:"I18NFieldTag"`
+	Remarks      string                 `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind  `json:"isShow"`
+	CreatedAt    int64                  `json:"createdAt"`
+	UpdatedAt    int64                  `json:"updatedAt"`
 }
 
 func (c *ConfigCowType) TableName() string {
@@ -19,12 +21,15 @@ func (c *ConfigCowType) TableName() string {
 
 type ConfigCowTypeSlice []*ConfigCowType
 
-func (c ConfigCowTypeSlice) ToPB() []*pasturePb.SearchBaseConfigList {
+func (c ConfigCowTypeSlice) ToPB(userModel *UserModel) []*pasturePb.SearchBaseConfigList {
 	res := make([]*pasturePb.SearchBaseConfigList, len(c))
 	for i, d := range c {
+		name, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: d.I18NFieldTag,
+		})
 		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 +38,24 @@ func (c ConfigCowTypeSlice) ToPB() []*pasturePb.SearchBaseConfigList {
 	}
 	return res
 }
+
+func (c ConfigCowTypeSlice) ToPB2(userModel *UserModel, optionName string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+
+		if optionName == "breed" {
+			if v.Kind == pasturePb.CowType_Breeding_Calf || v.Kind == pasturePb.CowType_Reserve_Calf {
+				continue
+			}
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 38 - 0
model/config_death_reason.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigDeathReason struct {
+	Id           int64                      `json:"id"`
+	PastureId    int64                      `json:"pastureId"`
+	Kind         pasturePb.DeathReason_Kind `json:"kind"`
+	I18NFieldTag string                     `json:"I18NFieldTag"`
+	Remarks      string                     `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind      `json:"isShow"`
+	CreatedAt    int64                      `json:"createdAt"`
+	UpdatedAt    int64                      `json:"updatedAt"`
+}
+
+func (c *ConfigDeathReason) TableName() string {
+	return "config_death_reason"
+}
+
+type ConfigDeathReasonSlice []*ConfigDeathReason
+
+func (c ConfigDeathReasonSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		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
+}

+ 38 - 0
model/config_dystocia_reason.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigDystociaReason struct {
+	Id           int32                         `json:"id"`
+	PastureId    int64                         `json:"pastureId"`
+	Kind         pasturePb.DystociaReason_Kind `json:"kind"`
+	I18NFieldTag string                        `json:"i18nFieldTag"`
+	Remarks      string                        `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind         `json:"isShow"`
+	CreatedAt    int64                         `json:"createdAt"`
+	UpdatedAt    int64                         `json:"updatedAt"`
+}
+
+func (c *ConfigDystociaReason) TableName() string {
+	return "config_dystocia_reason"
+}
+
+type ConfigDystociaReasonSlice []*ConfigDystociaReason
+
+func (c ConfigDystociaReasonSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 38 - 0
model/config_event_category.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigEventCategory struct {
+	Id           int32                        `json:"id"`
+	PastureId    int64                        `json:"pastureId"`
+	Kind         pasturePb.EventCategory_Kind `json:"kind"`
+	I18NFieldTag string                       `json:"i18nFieldTag"`
+	Remarks      string                       `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind        `json:"isShow"`
+	CreatedAt    int64                        `json:"createdAt"`
+	UpdatedAt    int64                        `json:"updatedAt"`
+}
+
+func (c *ConfigEventCategory) TableName() string {
+	return "config_event_category"
+}
+
+type ConfigEventCategorySlice []*ConfigEventCategory
+
+func (c ConfigEventCategorySlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 38 - 0
model/config_immunization_conditions.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigImmunizationConditions struct {
+	Id           int32                                 `json:"id"`
+	PastureId    int64                                 `json:"pastureId"`
+	Kind         pasturePb.ImmunizationConditions_Kind `json:"kind"`
+	I18NFieldTag string                                `json:"i18nFieldTag"`
+	Remarks      string                                `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind                 `json:"isShow"`
+	CreatedAt    int64                                 `json:"createdAt"`
+	UpdatedAt    int64                                 `json:"updatedAt"`
+}
+
+func (c *ConfigImmunizationConditions) TableName() string {
+	return "config_immunization_conditions"
+}
+
+type ConfigImmunizationConditionsSlice []*ConfigImmunizationConditions
+
+func (c ConfigImmunizationConditionsSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 38 - 0
model/config_indicators_category.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigIndicatorsCategory struct {
+	Id           int64                        `json:"id"`
+	PastureId    int64                        `json:"pastureId"`
+	Kind         pasturePb.IndicatorType_Kind `json:"kind"`
+	I18NFieldTag string                       `json:"I18NFieldTag"`
+	Remarks      string                       `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind        `json:"isShow"`
+	CreatedAt    int64                        `json:"createdAt"`
+	UpdatedAt    int64                        `json:"updatedAt"`
+}
+
+func (c *ConfigIndicatorsCategory) TableName() string {
+	return "config_indicators_category"
+}
+
+type ConfigIndicatorsCategorySlice []*ConfigIndicatorsCategory
+
+func (c ConfigIndicatorsCategorySlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		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
+}

+ 38 - 0
model/config_mating_result.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigMatingResult struct {
+	Id           int64                       `json:"id"`
+	PastureId    int64                       `json:"pastureId"`
+	Kind         pasturePb.MatingResult_Kind `json:"kind"`
+	I18NFieldTag string                      `json:"I18NFieldTag"`
+	Remarks      string                      `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind       `json:"isShow"`
+	CreatedAt    int64                       `json:"createdAt"`
+	UpdatedAt    int64                       `json:"updatedAt"`
+}
+
+func (c *ConfigMatingResult) TableName() string {
+	return "config_mating_result"
+}
+
+type ConfigMatingResultSlice []*ConfigMatingResult
+
+func (c ConfigMatingResultSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		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
+}

+ 38 - 0
model/config_pregnant_check_result.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigPregnantCheckResult struct {
+	Id           int32                              `json:"id"`
+	PastureId    int64                              `json:"pastureId"`
+	Kind         pasturePb.PregnantCheckResult_Kind `json:"kind"`
+	I18NFieldTag string                             `json:"i18nFieldTag"`
+	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(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 38 - 0
model/config_sale_cow_analysis_method.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigSaleCowAnalysisMethod struct {
+	Id           int32                                `json:"id"`
+	PastureId    int64                                `json:"pastureId"`
+	Kind         pasturePb.SaleCowAnalysisMethod_Kind `json:"kind"`
+	I18NFieldTag string                               `json:"i18NFieldTag"`
+	Remarks      string                               `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind                `json:"isShow"`
+	CreatedAt    int64                                `json:"createdAt"`
+	UpdatedAt    int64                                `json:"updatedAt"`
+}
+
+func (c *ConfigSaleCowAnalysisMethod) TableName() string {
+	return "config_sale_cow_analysis_method"
+}
+
+type ConfigSaleCowAnalysisMethodSlice []*ConfigSaleCowAnalysisMethod
+
+func (c ConfigSaleCowAnalysisMethodSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    label,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 38 - 0
model/config_same_time_cow_type.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigSameTimeCowType struct {
+	Id           int32                          `json:"id"`
+	PastureId    int64                          `json:"pastureId"`
+	Kind         pasturePb.SameTimeCowType_Kind `json:"kind"`
+	I18NFieldTag string                         `json:"I18NFieldTag"`
+	Remarks      string                         `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind          `json:"isShow"`
+	CreatedAt    int64                          `json:"createdAt"`
+	UpdatedAt    int64                          `json:"updatedAt"`
+}
+
+func (c *ConfigSameTimeCowType) TableName() string {
+	return "config_same_time_cow_type"
+}
+
+type ConfigSameTimeCowTypeSlice []*ConfigSameTimeCowType
+
+func (c ConfigSameTimeCowTypeSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		name, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    name,
+			Disabled: true,
+		})
+	}
+	return res
+}

+ 38 - 0
model/config_same_time_type.go

@@ -0,0 +1,38 @@
+package model
+
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
+
+type ConfigSameTimeType struct {
+	Id           int32                       `json:"id"`
+	PastureId    int64                       `json:"pastureId"`
+	Kind         pasturePb.SameTimeType_Kind `json:"kind"`
+	I18NFieldTag string                      `json:"I18NFieldTag"`
+	Remarks      string                      `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind       `json:"isShow"`
+	CreatedAt    int64                       `json:"createdAt"`
+	UpdatedAt    int64                       `json:"updatedAt"`
+}
+
+func (c *ConfigSameTimeType) TableName() string {
+	return "config_same_time_type"
+}
+
+type ConfigSameTimeTypeSlice []*ConfigSameTimeType
+
+func (c ConfigSameTimeTypeSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		name, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(v.Kind),
+			Label:    name,
+			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
+}

+ 29 - 8
model/config_transfer_pen_reason.go

@@ -2,15 +2,18 @@ package model
 
 import (
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
 )
 
 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"`
+	I18NFieldTag string                           `json:"i18nFieldTag"`
+	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 +22,15 @@ func (c *ConfigTransferPenReason) TableName() string {
 
 type ConfigTransferPenReasonSlice []*ConfigTransferPenReason
 
-func (c ConfigTransferPenReasonSlice) ToPB() []*pasturePb.SearchBaseConfigList {
+func (c ConfigTransferPenReasonSlice) ToPB(userModel *UserModel) []*pasturePb.SearchBaseConfigList {
 	res := make([]*pasturePb.SearchBaseConfigList, len(c))
 	for i, d := range c {
+		name, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: d.I18NFieldTag,
+		})
 		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 +39,18 @@ func (c ConfigTransferPenReasonSlice) ToPB() []*pasturePb.SearchBaseConfigList {
 	}
 	return res
 }
+
+func (c ConfigTransferPenReasonSlice) ToPB2(userModel *UserModel) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	for _, v := range c {
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18NFieldTag,
+		})
+		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_cow.go

@@ -208,7 +208,7 @@ func (s *StoreEntry) TwentyOnePregnantDetail(ctx context.Context, req *pasturePb
 		return nil, xerr.WithStack(err)
 	}
 
-	cowTypeMap := s.CowTypeMap()
+	cowTypeMap := s.CowTypeMap(userModel)
 	switch req.Type {
 	case pasturePb.TwentyOnePregnantType_ShouldBreed:
 		shouldBreedCowList, _ := s.TwentyOnePregnantShouldBreedList(pastureId, req.CowType, stopBreedingDay, middleDay)

+ 2 - 2
module/backend/analysis_more.go

@@ -72,7 +72,7 @@ func (s *StoreEntry) PenBehaviorDaily(ctx context.Context, req *pasturePb.BarnMo
 			headers = append(headers, v.Name)
 		}
 	} else {
-		behaviorEnumList := s.Behavior("")
+		behaviorEnumList := s.Behavior(userModel, "")
 		for _, v := range behaviorEnumList {
 			headers = append(headers, v.Label)
 		}
@@ -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) ||

+ 4 - 4
module/backend/analysis_other.go

@@ -48,8 +48,8 @@ func (s *StoreEntry) PregnancyReport(ctx context.Context, req *pasturePb.Pregnan
 		return nil, xerr.WithStack(err)
 	}
 
-	pregnantCheckResultMap := s.PregnantCheckResultMap()
-	pregnantCheckMethodMap := s.PregnantCheckMethodMap()
+	pregnantCheckResultMap := s.PregnantCheckResultMap(userModel)
+	pregnantCheckMethodMap := s.PregnantCheckMethodMap(userModel)
 	return &pasturePb.PregnancyReportResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
@@ -148,7 +148,7 @@ func (s *StoreEntry) CalvingReport(ctx context.Context, req *pasturePb.CalvingRe
 		}
 	}
 
-	cowKindMap := s.CowKindMap()
+	cowKindMap := s.CowKindMap(userModel)
 	for _, v := range eventCalving1 {
 		if req.AnalysisMethod == pasturePb.CalvingAnalysisMethod_CowKind {
 			v.StatisticMethod = cowKindMap[v.CowKind]
@@ -254,7 +254,7 @@ func (s *StoreEntry) DiseaseCureReport(ctx context.Context, req *pasturePb.Disea
 		case pasturePb.DiseaseAnalysisMethod_Months:
 			v.StatisticMethod = v.Months
 		case pasturePb.DiseaseAnalysisMethod_Disease_Category:
-			diseaseTypeMap := s.DiseaseTypeMap()
+			diseaseTypeMap := s.DiseaseTypeMap(userModel)
 			v.StatisticMethod = diseaseTypeMap[v.DiseaseType]
 		case pasturePb.DiseaseAnalysisMethod_Disease:
 			v.StatisticMethod = v.DiseaseName

+ 3 - 3
module/backend/calendar.go

@@ -168,7 +168,7 @@ func (s *StoreEntry) CalendarToDoList(ctx context.Context, req *pasturePb.Calend
 		dMap[v.CalendarTypeKind] = v.Count
 	}
 
-	list, total := Paginate(calendarToDoList, req, pagination)
+	list, total := s.Paginate(userModel, calendarToDoList, req, pagination)
 	return &pasturePb.CalendarToDoResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
@@ -358,8 +358,8 @@ func (s *StoreEntry) SameTimeCowList(ctx context.Context, req *pasturePb.ItemsRe
 		Find(&sameTimeBodyList).Error; err != nil {
 		return nil, xerr.WithStack(err)
 	}
-	breedStatusMap := s.CowBreedStatusMap()
-	sameTimeTypeMap := s.SameTimeTypeMap()
+	breedStatusMap := s.CowBreedStatusMap(userModel)
+	sameTimeTypeMap := s.SameTimeTypeMap(userModel)
 	return &pasturePb.SameTimeItemResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",

+ 6 - 6
module/backend/calendar_more.go

@@ -47,7 +47,7 @@ func (s *StoreEntry) CalvingCowList(ctx context.Context, req *pasturePb.ItemsReq
 		return nil, xerr.WithStack(err)
 	}
 
-	breedStatusMap := s.CowBreedStatusMap()
+	breedStatusMap := s.CowBreedStatusMap(userModel)
 	for _, v := range calvingItems {
 		breedStatusName := ""
 		if breedStatus, ok := breedStatusMap[v.BreedStatus]; ok {
@@ -121,7 +121,7 @@ func (s *StoreEntry) DryMilkCowList(ctx context.Context, req *pasturePb.ItemsReq
 		return nil, xerr.WithStack(err)
 	}
 
-	breedStatusMap := s.CowBreedStatusMap()
+	breedStatusMap := s.CowBreedStatusMap(userModel)
 	for _, v := range dryMilkItems {
 		breedStatusName := ""
 		if breedStatus, ok := breedStatusMap[v.BreedStatus]; ok {
@@ -187,7 +187,7 @@ func (s *StoreEntry) TreatmentCowList(ctx context.Context, req *pasturePb.ItemsR
 		Code: http.StatusOK,
 		Msg:  "ok",
 		Data: &pasturePb.EventCowDiseaseData{
-			List:       model.EventCowDiseaseSlice(diseaseItems).ToPB(s.HealthStatusMap()),
+			List:       model.EventCowDiseaseSlice(diseaseItems).ToPB(s.HealthStatusMap(userModel)),
 			Total:      int32(count),
 			PageSize:   pagination.PageSize,
 			Page:       pagination.Page,
@@ -211,11 +211,11 @@ func (s *StoreEntry) WorkOrderCowList(ctx context.Context, req *pasturePb.ItemsR
 }
 
 // Paginate 函数用于对切片进行分页
-func Paginate(slice []*pasturePb.CalendarToDoList, req *pasturePb.CalendarToDoRequest, pagination *pasturePb.PaginationModel) ([]*pasturePb.CalendarToDoList, int32) {
+func (s *StoreEntry) Paginate(userModel *model.UserModel, slice []*pasturePb.CalendarToDoList, req *pasturePb.CalendarToDoRequest, pagination *pasturePb.PaginationModel) ([]*pasturePb.CalendarToDoList, int32) {
 	newSlice := make([]*pasturePb.CalendarToDoList, 0)
 
 	if req.CalendarType > 0 {
-		calendarTypeName := CalendarTypeMap()[req.CalendarType]
+		calendarTypeName := s.CalendarTypeMap(userModel)[req.CalendarType]
 		if len(calendarTypeName) > 0 {
 			re := regexp.MustCompile(`[a-zA-Z]`) // 使用正则表达式替换匹配的字母为空字符串
 			calendarTypeName = re.ReplaceAllString(calendarTypeName, "")
@@ -307,7 +307,7 @@ func (s *StoreEntry) TaskDetail(ctx context.Context, req *pasturePb.CalendarToDo
 		return nil, xerr.WithStack(err)
 	}
 
-	calendarToDoList, _ = Paginate(calendarToDoList, req, pagination)
+	calendarToDoList, _ = s.Paginate(userModel, calendarToDoList, req, pagination)
 	taskItemsList := make([]*pasturePb.TaskItems, 0)
 	for _, v := range calendarToDoList {
 		if v.CalendarType == pasturePb.CalendarType_Disease {

+ 227 - 375
module/backend/config_data.go

@@ -3,24 +3,47 @@ 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 {
-	allBarnTypes := s.BarnTypeMap()
+func (s *StoreEntry) BarnTypeEnumList(userModel *model.UserModel, excludeTypes []pasturePb.PenType_Kind, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigPenType, 0)
+	pref := s.DB.Model(new(model.ConfigPenType)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.PenType_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.PenType_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("BarnTypeEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	allBarnTypes := model.ConfigBarnTypeSlice(dataList).ToPB2(userModel)
 	barnTypeList := make([]*pasturePb.ConfigOptionsList, 0)
-	for v1 := range allBarnTypes {
+	if len(excludeTypes) == 0 || excludeTypes == nil {
+		return allBarnTypes
+	}
+
+	for _, v1 := range allBarnTypes {
 		var info bool
 		for _, v2 := range excludeTypes {
-			if v1 == v2 {
+			if v1.Value == int32(v2) {
 				info = true
 				break
 			}
 		}
 		if !info {
 			barnTypeList = append(barnTypeList, &pasturePb.ConfigOptionsList{
-				Value:    int32(v1),
-				Label:    allBarnTypes[v1],
+				Value:    v1.Value,
+				Label:    v1.Label,
 				Disabled: true,
 			})
 		}
@@ -28,417 +51,246 @@ func (s *StoreEntry) BarnTypeEnumList(excludeTypes []pasturePb.PenType_Kind) []*
 	return barnTypeList
 }
 
-func (s *StoreEntry) BreedStatusEnumList() []*pasturePb.ConfigOptionsList {
-	breedStatusList := make([]*pasturePb.ConfigOptionsList, 0)
-	breedStatusList = append(breedStatusList, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.BreedStatus_UnBreed),
-		Label:    "未配",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.BreedStatus_Breeding),
-		Label:    "已配未检",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.BreedStatus_Pregnant),
-		Label:    "怀孕",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.BreedStatus_Empty),
-		Label:    "空怀",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.BreedStatus_Calving),
-		Label:    "产犊",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.BreedStatus_Abort),
-		Label:    "流产",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.BreedStatus_No_Mating),
-		Label:    "禁配",
-		Disabled: true,
-	})
-	return breedStatusList
+func (s *StoreEntry) BreedStatusEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigBreedStatus, 0)
+	pref := s.DB.Model(new(model.ConfigBreedStatus)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", pasturePb.BreedStatus_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.BreedStatus_Invalid)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("ConfigBreedStatus", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigBreedStatusSlice(dataList).ToPB2(userModel)
 }
 
-func (s *StoreEntry) CowKindEnumList() []*pasturePb.ConfigOptionsList {
-	cowKindList := make([]*pasturePb.ConfigOptionsList, 0)
-	cowKindList = append(cowKindList,
-		&pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CowKind_JSN),
-			Label:    "娟姗牛",
-			Disabled: true,
-		},
-		&pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CowKind_XMTEN),
-			Label:    "西门塔尔牛",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CowKind_AGSN),
-			Label:    "安格斯牛",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CowKind_XNLN),
-			Label:    "夏洛莱牛",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CowKind_LMZN),
-			Label:    "利木赞牛",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CowKind_HFTN),
-			Label:    "海福特牛",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CowKind_HN),
-			Label:    "和牛",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CowKind_HX),
-			Label:    "华西牛",
-			Disabled: true,
-		})
-	return cowKindList
+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)
 }
 
-func (s *StoreEntry) CowSourceEnumList() []*pasturePb.ConfigOptionsList {
-	cowSourceList := make([]*pasturePb.ConfigOptionsList, 0)
-	cowSourceList = append(cowSourceList, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowSource_Calving),
-		Label:    "产犊",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowSource_Transfer_In),
-		Label:    "调入",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowSource_Buy),
-		Label:    "购买",
-		Disabled: true,
-	})
-	return cowSourceList
+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)
 }
 
-func (s *StoreEntry) CowTypeEnumList(optionName, isAll string) []*pasturePb.ConfigOptionsList {
-	cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) CowTypeEnumList(userModel *model.UserModel, optionName, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigCowType, 0)
+	pref := s.DB.Model(new(model.ConfigCowType)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
 	if isAll == model.IsAllYes {
-		cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CowType_Invalid),
-			Label:    "全部",
-			Disabled: true,
-		})
+		pref = pref.Where("kind >= ?", pasturePb.CowType_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.CowType_Invalid)
 	}
-	if optionName == "breed" {
-		cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CowType_Reserve_Calf),
-			Label:    "后备牛",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CowType_Breeding_Calf),
-			Label:    "成母牛",
-			Disabled: true,
-		})
-		return cowTypeList
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("CowKindEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
 
-	cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowType_Lactating_Calf),
-		Label:    "哺乳犊牛",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowType_Weaned_Calf),
-		Label:    "育成牛",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowType_Youth_Calf),
-		Label:    "青年牛",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowType_Fattening_Calf),
-		Label:    "育肥牛",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowType_Reserve_Calf),
-		Label:    "后备牛",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowType_Breeding_Calf),
-		Label:    "成母牛",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowType_Breeding_Bull),
-		Label:    "种公牛",
-		Disabled: true,
-	})
-	return cowTypeList
+	return model.ConfigCowTypeSlice(dataList).ToPB2(userModel, optionName)
 }
 
-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 {
-		cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.SameTimeCowType_Invalid),
-			Label:    "全部",
-			Disabled: true,
-		})
+		pref = pref.Where("kind >= ?", pasturePb.SameTimeCowType_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.SameTimeCowType_Invalid)
 	}
-	cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SameTimeCowType_Empty),
-		Label:    "空怀牛",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SameTimeCowType_Breeding_Calf),
-		Label:    "成母牛",
-		Disabled: true,
-	})
-	return cowTypeList
+
+	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)
 }
 
-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 {
-		cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.SameTimeType_Invalid),
-			Label:    "全部",
-			Disabled: true,
-		})
+		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)
 	}
-	cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SameTimeType_PGBJ),
-		Label:    "PG保健",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SameTimeType_PGTQ),
-		Label:    "PG同期",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SameTimeType_RnGH),
-		Label:    "RnGH",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SameTimeType_TAI),
-		Label:    "TAI输精",
-		Disabled: true,
-	})
-	return cowTypeList
+
+	return model.ConfigSameTimeTypeSlice(dataList).ToPB(userModel)
 }
 
-func (s *StoreEntry) ImmunizationCowTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
-	cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowType_Lactating_Calf),
-		Label:    "犊牛",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowType_Weaned_Calf),
-		Label:    "育成牛",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowType_Youth_Calf),
-		Label:    "青年牛",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowType_Fattening_Calf),
-		Label:    "育肥牛",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowType_Reserve_Calf),
-		Label:    "后备牛",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowType_Breeding_Calf),
-		Label:    "成母牛",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CowType_Breeding_Bull),
-		Label:    "种公牛",
-		Disabled: true,
-	})
-	return cowTypeList
+func (s *StoreEntry) ImmunizationCowTypeEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	return s.CowTypeEnumList(userModel, "", isAll)
 }
 
-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 {
-		cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.ImmunizationConditions_Invalid),
-			Label:    "全部",
-			Disabled: true,
-		})
+		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)
 	}
-	cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.ImmunizationConditions_Days_Age),
-		Label:    "日龄",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.ImmunizationConditions_Days_After_Delivery),
-		Label:    "产后天数",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.ImmunizationConditions_Days_Of_Pregnancy),
-		Label:    "怀孕天数",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.ImmunizationConditions_Admission_Days),
-		Label:    "入场天数",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.ImmunizationConditions_Other_Vaccine_After),
-		Label:    "基于其他疫苗之后",
-		Disabled: true,
-	})
-	return cowTypeList
+
+	return model.ConfigImmunizationConditionsSlice(dataList).ToPB(userModel)
 }
 
-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 {
-		transferPenList = append(transferPenList, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.TransferPenReason_Invalid),
-			Label:    "全部",
-			Disabled: true,
-		})
+		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)
 	}
-	transferPenList = append(transferPenList, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.TransferPenReason_Normal),
-		Label:    "正常转群",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.TransferPenReason_Feed),
-		Label:    "饲喂转群",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.TransferPenReason_Dry_Milk),
-		Label:    "干奶转群",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.TransferPenReason_Pregnant),
-		Label:    "怀孕转群",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.TransferPenReason_Overantibody),
-		Label:    "过抗转群",
-		Disabled: true,
-	})
-	return transferPenList
+
+	return model.ConfigTransferPenReasonSlice(dataList).ToPB2(userModel)
 }
 
-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 {
-		configOptions = append(configOptions,
-			&pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.ChildNumber_Invalid),
-				Label:    "全部",
-				Disabled: true,
-			})
+		pref = pref.Where("kind >= ?", pasturePb.ChildNumber_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.ChildNumber_Invalid)
 	}
-	configOptions = append(configOptions,
-		&pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.ChildNumber_One),
-			Label:    "单胎",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.ChildNumber_Two),
-			Label:    "双胎",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.ChildNumber_Three),
-			Label:    "三胎",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.ChildNumber_Four),
-			Label:    "四胎",
-			Disabled: true,
-		})
-	return configOptions
+
+	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)
 }
 
-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 {
-		configOptions = append(configOptions,
-			&pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.CalvingLevel_Invalid),
-				Label:    "全部",
-				Disabled: true,
-			})
+		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)
 	}
-	configOptions = append(configOptions,
-		&pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CalvingLevel_Natural_Childbirth),
-			Label:    "自然分娩",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CalvingLevel_Artificial_Midwifery1),
-			Label:    "人工助产(1-2人)",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CalvingLevel_Artificial_Midwifery2),
-			Label:    "人工助产(3人以上)",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CalvingLevel_Caesarean_Section),
-			Label:    "剖腹产",
-			Disabled: true,
-		})
-	return configOptions
+
+	return model.ConfigCalvingLevelSlice(dataList).ToPB(userModel)
 }
 
-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 {
-		configOptions = append(configOptions,
-			&pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.DystociaReason_Invalid),
-				Label:    "全部",
-				Disabled: true,
-			})
+		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)
 	}
-	configOptions = append(configOptions,
-		&pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.DystociaReason_Malposition),
-			Label:    "胎位不正",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.DystociaReason_Fetal_Overgrowth),
-			Label:    "胎儿过大",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.DystociaReason_Uterine_Atony),
-			Label:    "子宫收缩无力",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.DystociaReason_Pelvic_Stenosis),
-			Label:    "盆骨狭小",
-			Disabled: true,
-		}, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.DystociaReason_Sub_Health),
-			Label:    "母牛亚健康状态",
-			Disabled: true,
-		})
-	return configOptions
+
+	return model.ConfigDystociaReasonSlice(dataList).ToPB(userModel)
 }
 
-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 {
-		configOptions = append(configOptions,
-			&pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.PregnantCheckResult_Invalid),
-				Label:    "全部",
-				Disabled: true,
-			})
+		pref = pref.Where("kind >= ?", pasturePb.PregnantCheckResult_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.PregnantCheckResult_Invalid)
 	}
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.PregnantCheckResult_Pregnant),
-		Label:    "有胎",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.PregnantCheckResult_UnPregnant),
-		Label:    "无胎",
-		Disabled: true,
-	})
-	return configOptions
+
+	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)
 }

+ 113 - 359
module/backend/config_data_base.go

@@ -3,301 +3,93 @@ 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"
 )
 
-func (s *StoreEntry) OutReasonEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) DeathReasonEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigDeathReason, 0)
+	pref := s.DB.Model(new(model.ConfigDeathReason)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
 	if isAll == model.IsAllYes {
-		configOptions = append(configOptions,
-			&pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.OutReasons_Invalid),
-				Label:    "全部",
-				Disabled: true,
-			})
+		pref = pref.Where("kind >= ?", pasturePb.DeathReason_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.DeathReason_Invalid)
 	}
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Respiratory_System_Disease),
-		Label:    "呼吸系统疾病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Nutritional_Metabolic_Disease),
-		Label:    "营养代谢疾病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Breeding_Disease),
-		Label:    "繁殖疾病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Breast_Disease),
-		Label:    "乳房疾病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Long_Term_infertility),
-		Label:    "久配不孕",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Multiple_Miscarriages),
-		Label:    "多次流产",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Long_Treatment_Without_Recovery),
-		Label:    "久治不愈",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Postpartum_Paralysis),
-		Label:    "产后瘫痪",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Mastitis),
-		Label:    "乳房炎",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Hoof_Disease),
-		Label:    "蹄病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Congenital_Malformation),
-		Label:    "先天畸形",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Congenital_Malformation),
-		Label:    "先天畸形",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Dysplasia),
-		Label:    "发育不良",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Hernia),
-		Label:    "疝气",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Excessive_Age),
-		Label:    "月龄过大",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Excessive_Age),
-		Label:    "月龄过大",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Excessive_Weight),
-		Label:    "体重过肥",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Other_Disease),
-		Label:    "其他疾病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Weak_Child),
-		Label:    "弱仔",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Obsessive_Bull),
-		Label:    "恶癖牛",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Low_Milk),
-		Label:    "低产",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Slow_Growing),
-		Label:    "生长缓慢",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Other),
-		Label:    "其他",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Unknown),
-		Label:    "未知原因",
-		Disabled: true,
-	})
-	return configOptions
-}
 
-func (s *StoreEntry) DeathReasonEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
-	if isAll == model.IsAllYes {
-		configOptions = append(configOptions,
-			&pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.DeathReason_Invalid),
-				Label:    "全部",
-				Disabled: true,
-			})
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("DeathReasonEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Digestive_System_Diseases),
-		Label:    "消化性疾病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Respiratory_System_Diseases),
-		Label:    "呼吸性疾病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Reproductive_System_Diseases),
-		Label:    "繁殖性疾病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Metabolic_System_Diseases),
-		Label:    "代谢性疾病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Infectious_Diseases),
-		Label:    "传染性疾病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Difficult_Birth),
-		Label:    "难产",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Accident_Dead),
-		Label:    "意外死亡",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Stress),
-		Label:    "应激",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Trauma),
-		Label:    "外伤",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Pneumonia),
-		Label:    "肺炎",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Diarrhea),
-		Label:    "腹泻",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Ketosis),
-		Label:    "酮症",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Acidosis),
-		Label:    "酸中毒",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Rumina_Impaction),
-		Label:    "瘤胃积食",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Intestinal_Torsion),
-		Label:    "肠扭转",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathReason_Other),
-		Label:    "其他",
-		Disabled: true,
-	})
-	return configOptions
+
+	return model.ConfigDeathReasonSlice(dataList).ToPB(userModel)
 }
 
-func (s *StoreEntry) MatingResultEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) MatingResultEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigMatingResult, 0)
+	pref := s.DB.Model(new(model.ConfigMatingResult)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
 	if isAll == model.IsAllYes {
-		configOptions = append(configOptions,
-			&pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.MatingResult_Invalid),
-				Label:    "全部",
-				Disabled: true,
-			})
+		pref = pref.Where("kind >= ?", pasturePb.MatingResult_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.MatingResult_Invalid)
 	}
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.MatingResult_Unknown),
-		Label:    "未知",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.MatingResult_ReMatch),
-		Label:    "复配",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.MatingResult_Pregnant),
-		Label:    "怀孕",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.MatingResult_Empty),
-		Label:    "空怀",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.MatingResult_Abort),
-		Label:    "流产",
-		Disabled: true,
-	})
-	return configOptions
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("MatingResultEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigMatingResultSlice(dataList).ToPB(userModel)
 }
 
-func (s *StoreEntry) EventCategoryEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) EventCategoryEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigEventCategory, 0)
+	pref := s.DB.Model(new(model.ConfigEventCategory)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
 	if isAll == model.IsAllYes {
-		configOptions = append(configOptions,
-			&pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.EventCategory_Invalid),
-				Label:    "全部",
-				Disabled: true,
-			})
+		pref = pref.Where("kind >= ?", pasturePb.EventCategory_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.EventCategory_Invalid)
 	}
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.EventCategory_Base),
-		Label:    "基础事件",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.EventCategory_Breed),
-		Label:    "繁殖事件",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.EventCategory_Health),
-		Label:    "兽医事件",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.EventCategory_Other),
-		Label:    "其他事件",
-		Disabled: true,
-	})
-	return configOptions
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("EventCategoryEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigEventCategorySlice(dataList).ToPB(userModel)
 }
 
-func (s *StoreEntry) IndicatorsCategoryEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) IndicatorsCategoryEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigIndicatorsCategory, 0)
+	pref := s.DB.Model(new(model.ConfigIndicatorsCategory)).
+		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 >= ?", pasturePb.IndicatorType_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.IndicatorType_Invalid)
 	}
 
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.IndicatorType_Basic),
-		Label:    "基本指标",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.IndicatorType_Breed),
-		Label:    "繁殖指标",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.IndicatorType_Health),
-		Label:    "健康指标",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.IndicatorType_Feed),
-		Label:    "饲喂指标",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.IndicatorType_Calf),
-		Label:    "犊牛指标",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.IndicatorType_Fatten),
-		Label:    "育肥指标",
-		Disabled: true,
-	})
-	return configOptions
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("IndicatorsCategoryEnumList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigIndicatorsCategorySlice(dataList).ToPB(userModel)
 }
 
-func (s *StoreEntry) IndicatorsDetailsList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) IndicatorsDetailsList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -324,100 +116,62 @@ func (s *StoreEntry) IndicatorsDetailsList(isAll string) []*pasturePb.ConfigOpti
 	return configOptions
 }
 
-func (s *StoreEntry) CowPurposeList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) CowPurposeList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigCowPurpose, 0)
+	pref := s.DB.Model(new(model.ConfigCowPurpose)).
+		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 >= ?", pasturePb.Purpose_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.Purpose_Invalid)
 	}
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.Purpose_Breeding),
-		Label:    "繁殖",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.Purpose_Fatten),
-		Label:    "育肥",
-		Disabled: true,
-	})
-	return configOptions
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("CowPurposeList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigCowPurposeSlice(dataList).ToPB(userModel)
 }
 
-func (s *StoreEntry) CowOutReasonList(isAll string) []*pasturePb.ConfigOptionsList {
-	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+func (s *StoreEntry) CowOutReasonEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
+	dataList := make([]*model.ConfigCowOutReason, 0)
+	pref := s.DB.Model(new(model.ConfigCowOutReason)).
+		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 >= ?", pasturePb.OutReasons_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.OutReasons_Invalid)
 	}
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Respiratory_System_Disease),
-		Label:    "呼吸系统疾病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Nutritional_Metabolic_Disease),
-		Label:    "营养代谢疾病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Breeding_Disease),
-		Label:    "繁殖疾病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Breast_Disease),
-		Label:    "乳房疾病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Hoof_Disease),
-		Label:    "蹄病",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Low_Milk),
-		Label:    "低产",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Slow_Growing),
-		Label:    "生长缓慢",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Slow_Growing),
-		Label:    "生长缓慢",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.OutReasons_Other),
-		Label:    "其他原因",
-		Disabled: true,
-	})
-	return configOptions
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("CowOutReasonList", zap.Any("err", err))
+		return make([]*pasturePb.ConfigOptionsList, 0)
+	}
+
+	return model.ConfigCowOutReasonSlice(dataList).ToPB(userModel)
 }
 
-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 {
-		configOptions = append(configOptions,
-			&pasturePb.ConfigOptionsList{
-				Value:    int32(0),
-				Label:    "全部",
-				Disabled: true,
-			})
+		pref = pref.Where("kind >= ?", pasturePb.DeathDestination_Invalid)
+	} else {
+		pref = pref.Where("kind > ?", pasturePb.DeathDestination_Invalid)
 	}
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathDestination_NuisanceLess),
-		Label:    "无公害处理",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathDestination_Slaughterhouse),
-		Label:    "屠宰场",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.DeathDestination_Other),
-		Label:    "其他",
-		Disabled: true,
-	})
-	return configOptions
+
+	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)
 }

+ 297 - 185
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)
+	/*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,7 +400,27 @@ func (s *StoreEntry) NeckRingStatusEnumList(isAll string) []*pasturePb.ConfigOpt
 		Label:    "异常",
 		Disabled: true,
 	})
-	return configOptions
+	return configOptions*/
+}
+
+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)
 }
 
 func CalendarTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
@@ -327,8 +472,8 @@ func CalendarTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	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 +484,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)
 	}
-	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)
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("CalvingAnalysisMethodEnumList", zap.Any("err", err))
+		return 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 +527,5 @@ func (s *StoreEntry) CalvingAnalysisMethodEnumList(isAll string) []*pasturePb.Co
 		Label:    "按照品种统计",
 		Disabled: true,
 	})
-	return configOptions
+	return configOptions*/
 }

+ 11 - 11
module/backend/config_data_extend.go

@@ -12,7 +12,7 @@ import (
 	"gitee.com/xuyiping_admin/pkg/xerr"
 )
 
-func (s *StoreEntry) WorkOrderSubUnitEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) WorkOrderSubUnitEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.WorkOrderSubscribeUnit_Person),
@@ -26,7 +26,7 @@ func (s *StoreEntry) WorkOrderSubUnitEnumList(isAll string) []*pasturePb.ConfigO
 	return configOptions
 }
 
-func (s *StoreEntry) WorkOrderPriorityEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) WorkOrderPriorityEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.Priority_Low),
@@ -44,7 +44,7 @@ func (s *StoreEntry) WorkOrderPriorityEnumList(isAll string) []*pasturePb.Config
 	return configOptions
 }
 
-func (s *StoreEntry) WorkOrderCategoryEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) WorkOrderCategoryEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.WorkOrderCategory_Health),
@@ -70,7 +70,7 @@ func (s *StoreEntry) WorkOrderCategoryEnumList(isAll string) []*pasturePb.Config
 	return configOptions
 }
 
-func (s *StoreEntry) AdmissionStatusEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) AdmissionStatusEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -104,7 +104,7 @@ func (s *StoreEntry) AdmissionStatusEnumList(isAll string) []*pasturePb.ConfigOp
 	return configOptions
 }
 
-func (s *StoreEntry) ForbiddenMatingReasonsEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) ForbiddenMatingReasonsEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -146,7 +146,7 @@ func (s *StoreEntry) ForbiddenMatingReasonsEnumList(isAll string) []*pasturePb.C
 	return configOptions
 }
 
-func (s *StoreEntry) WarningHealthLevel(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) WarningHealthLevel(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -172,7 +172,7 @@ func (s *StoreEntry) WarningHealthLevel(isAll string) []*pasturePb.ConfigOptions
 	return configOptions
 }
 
-func (s *StoreEntry) Behavior(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) Behavior(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -206,7 +206,7 @@ func (s *StoreEntry) Behavior(isAll string) []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) HealthStatusEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) HealthStatusEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
@@ -244,7 +244,7 @@ func (s *StoreEntry) HealthStatusEnumList(isAll string) []*pasturePb.ConfigOptio
 	return configOptions
 }
 
-func (s *StoreEntry) MatingWindowPeriodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) MatingWindowPeriodEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -270,7 +270,7 @@ func (s *StoreEntry) MatingWindowPeriodEnumList(isAll string) []*pasturePb.Confi
 	return configOptions
 }
 
-func (s *StoreEntry) DataWaringTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) DataWaringTypeEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -314,7 +314,7 @@ func (s *StoreEntry) DataWaringTypeEnumList(isAll string) []*pasturePb.ConfigOpt
 	return configOptions
 }
 
-func (s *StoreEntry) NeckRingErrorEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) NeckRingErrorEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,

+ 16 - 16
module/backend/config_data_other.go

@@ -9,7 +9,7 @@ import (
 	"go.uber.org/zap"
 )
 
-func (s *StoreEntry) PregnantCheckMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) PregnantCheckMethodEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -33,7 +33,7 @@ func (s *StoreEntry) PregnantCheckMethodEnumList(isAll string) []*pasturePb.Conf
 	return configOptions
 }
 
-func (s *StoreEntry) DrugCategoryEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) DrugCategoryEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -107,7 +107,7 @@ func (s *StoreEntry) DrugCategoryEnumList(isAll string) []*pasturePb.ConfigOptio
 	return configOptions
 }
 
-func (s *StoreEntry) DrugUsageEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) DrugUsageEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -142,7 +142,7 @@ func (s *StoreEntry) DrugUsageEnumList(isAll string) []*pasturePb.ConfigOptionsL
 	return configOptions
 }
 
-func (s *StoreEntry) UnitEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) UnitEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions,
 		&pasturePb.ConfigOptionsList{
@@ -189,7 +189,7 @@ func (s *StoreEntry) UnitEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) ExposeEstrusTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) ExposeEstrusTypeEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -217,7 +217,7 @@ func (s *StoreEntry) ExposeEstrusTypeEnumList(isAll string) []*pasturePb.ConfigO
 	return configOptions
 }
 
-func (s *StoreEntry) FrozenSemenTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) FrozenSemenTypeEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -240,11 +240,11 @@ func (s *StoreEntry) FrozenSemenTypeEnumList(isAll string) []*pasturePb.ConfigOp
 	return configOptions
 }
 
-func (s *StoreEntry) BullNumberEnumList(isAll string, pastureId int64) []*pasturePb.BullOptionsList {
+func (s *StoreEntry) BullNumberEnumList(userModel *model.UserModel, isAll string) []*pasturePb.BullOptionsList {
 	frozenSemenList := make([]*model.FrozenSemen, 0)
 	bullNumberList := make([]*pasturePb.BullOptionsList, 0)
 	if err := s.DB.Model(new(model.FrozenSemen)).
-		Where("pasture_id = ?", pastureId).
+		Where("pasture_id = ?", userModel.AppPasture.Id).
 		Where("quantity > 0").
 		Group("bull_id").
 		Find(&frozenSemenList).Error; err != nil {
@@ -261,7 +261,7 @@ func (s *StoreEntry) BullNumberEnumList(isAll string, pastureId int64) []*pastur
 	return bullNumberList
 }
 
-func (s *StoreEntry) WeekEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) WeekEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions,
 		&pasturePb.ConfigOptionsList{
@@ -296,7 +296,7 @@ func (s *StoreEntry) WeekEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) MonthEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) MonthEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	for v := 1; v <= 31; v++ {
 		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
@@ -308,7 +308,7 @@ func (s *StoreEntry) MonthEnumList(isAll string) []*pasturePb.ConfigOptionsList
 	return configOptions
 }
 
-func (s *StoreEntry) WorkOrderFrequencyEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) WorkOrderFrequencyEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.WorkOrderFrequency_None),
@@ -330,7 +330,7 @@ func (s *StoreEntry) WorkOrderFrequencyEnumList(isAll string) []*pasturePb.Confi
 	return configOptions
 }
 
-func (s *StoreEntry) OutTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) OutTypeEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -352,7 +352,7 @@ func (s *StoreEntry) OutTypeEnumList(isAll string) []*pasturePb.ConfigOptionsLis
 	return configOptions
 }
 
-func (s *StoreEntry) AuditStatusEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) AuditStatusEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -386,7 +386,7 @@ func (s *StoreEntry) AuditStatusEnumList(isAll string) []*pasturePb.ConfigOption
 	return configOptions
 }
 
-func (s *StoreEntry) PregnantCheckNameEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) PregnantCheckNameEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -408,7 +408,7 @@ func (s *StoreEntry) PregnantCheckNameEnumList(isAll string) []*pasturePb.Config
 	return configOptions
 }
 
-func (s *StoreEntry) UnMatingReasonsEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) UnMatingReasonsEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,
@@ -442,7 +442,7 @@ func (s *StoreEntry) UnMatingReasonsEnumList(isAll string) []*pasturePb.ConfigOp
 	return configOptions
 }
 
-func (s *StoreEntry) EventTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) EventTypeEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	if isAll == model.IsAllYes {
 		configOptions = append(configOptions,

+ 16 - 16
module/backend/cow.go

@@ -57,13 +57,13 @@ func (s *StoreEntry) Detail(ctx context.Context, req *pasturePb.SearchEventReque
 		}
 	}
 
-	cowTypeMap := s.CowTypeMap()
-	breedStatusMap := s.CowBreedStatusMap()
-	cowKindMap := s.CowKindMap()
-	cowSourceMap := s.CowSourceMap()
-	admissionStatusMap := s.AdmissionStatusMap()
-	healthStatusMap := s.HealthStatusMap()
-	purposeMap := s.PurposeMap()
+	cowTypeMap := s.CowTypeMap(userModel)
+	breedStatusMap := s.CowBreedStatusMap(userModel)
+	cowKindMap := s.CowKindMap(userModel)
+	cowSourceMap := s.CowSourceMap(userModel)
+	admissionStatusMap := s.AdmissionStatusMap(userModel)
+	healthStatusMap := s.HealthStatusMap(userModel)
+	purposeMap := s.PurposeMap(userModel)
 	systemBasic, err := s.GetSystemBasicByName(ctx, userModel.AppPasture.Id, model.PregnancyAge)
 	if err != nil {
 		messageId, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
@@ -159,13 +159,13 @@ func (s *StoreEntry) List(ctx context.Context, req *pasturePb.SearchEventRequest
 		return nil, xerr.WithStack(err)
 	}
 
-	cowTypeMap := s.CowTypeMap()
-	breedStatusMap := s.CowBreedStatusMap()
-	cowKindMap := s.CowKindMap()
-	cowSourceMap := s.CowSourceMap()
-	admissionStatusMap := s.AdmissionStatusMap()
-	healthStatusMap := s.HealthStatusMap()
-	purposeMap := s.PurposeMap()
+	cowTypeMap := s.CowTypeMap(userModel)
+	breedStatusMap := s.CowBreedStatusMap(userModel)
+	cowKindMap := s.CowKindMap(userModel)
+	cowSourceMap := s.CowSourceMap(userModel)
+	admissionStatusMap := s.AdmissionStatusMap(userModel)
+	healthStatusMap := s.HealthStatusMap(userModel)
+	purposeMap := s.PurposeMap(userModel)
 	return &pasturePb.SearchCowListResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
@@ -216,7 +216,7 @@ func (s *StoreEntry) EventList(ctx context.Context, req *pasturePb.SearchCowEven
 		return nil, xerr.WithStack(err)
 	}
 
-	eventCategoryMap := s.EventCategoryMap()
+	eventCategoryMap := s.EventCategoryMap(userModel)
 	return &pasturePb.CowEventListResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
@@ -277,7 +277,7 @@ func (s *StoreEntry) BehaviorCurve(ctx context.Context, req *pasturePb.CowBehavi
 	q1, q3 := s.CowIQR(cowInfo, req.CurveName, dayRange, data.DateTimeList)
 	data.IQR3 = q3
 	data.IQR1 = q1
-	eventMapList := s.EventTypeMap()
+	eventMapList := s.EventTypeMap(userModel)
 	for k, v := range eventMapList {
 		if k == pasturePb.EventType_Enter || k == pasturePb.EventType_Body_Score || k == pasturePb.EventType_Birth ||
 			k == pasturePb.EventType_Weaning || k == pasturePb.EventType_Sale || k == pasturePb.EventType_Weight ||

+ 7 - 7
module/backend/dashboard.go

@@ -190,13 +190,13 @@ func (s *StoreEntry) DataWarningPop(ctx context.Context, req *pasturePb.WarningD
 		zaplog.Error("UpdateWarningData", zap.Any("err", err), zap.Any("query", query), zap.Any("params", params))
 	}
 
-	cowTypeMap := s.CowTypeMap()
-	breedStatusMap := s.CowBreedStatusMap()
-	cowKindMap := s.CowKindMap()
-	cowSourceMap := s.CowSourceMap()
-	admissionStatusMap := s.AdmissionStatusMap()
-	healthStatusMap := s.HealthStatusMap()
-	purposeMap := s.PurposeMap()
+	cowTypeMap := s.CowTypeMap(userModel)
+	breedStatusMap := s.CowBreedStatusMap(userModel)
+	cowKindMap := s.CowKindMap(userModel)
+	cowSourceMap := s.CowSourceMap(userModel)
+	admissionStatusMap := s.AdmissionStatusMap(userModel)
+	healthStatusMap := s.HealthStatusMap(userModel)
+	purposeMap := s.PurposeMap(userModel)
 	resp.Data.Total = int32(count)
 	systemBasic, err := s.GetSystemBasicByName(ctx, userModel.AppPasture.Id, model.PregnancyAge)
 	if err != nil {

+ 100 - 104
module/backend/enum_map.go

@@ -1,136 +1,148 @@
 package backend
 
-import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+import (
+	"kpt-pasture/model"
 
-func (s *StoreEntry) DrugCategoryMaps() map[pasturePb.DrugCategory_Kind]string {
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+)
+
+func (s *StoreEntry) DrugCategoryMaps(userModel *model.UserModel) map[pasturePb.DrugCategory_Kind]string {
 	res := make(map[pasturePb.DrugCategory_Kind]string)
-	for _, v := range s.DrugCategoryEnumList("") {
+	for _, v := range s.DrugCategoryEnumList(userModel, "") {
 		res[pasturePb.DrugCategory_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) DrugUsageMaps() map[pasturePb.DrugUsage_Kind]string {
+func (s *StoreEntry) DrugUsageMaps(userModel *model.UserModel) map[pasturePb.DrugUsage_Kind]string {
 	res := make(map[pasturePb.DrugUsage_Kind]string)
-	for _, v := range s.DrugUsageEnumList("") {
+	for _, v := range s.DrugUsageEnumList(userModel, "") {
 		res[pasturePb.DrugUsage_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) ExposeEstrusTypeMap() map[pasturePb.ExposeEstrusType_Kind]string {
+func (s *StoreEntry) ExposeEstrusTypeMap(userModel *model.UserModel) map[pasturePb.ExposeEstrusType_Kind]string {
 	res := make(map[pasturePb.ExposeEstrusType_Kind]string)
-	for _, v := range s.ExposeEstrusTypeEnumList("") {
+	for _, v := range s.ExposeEstrusTypeEnumList(userModel, "") {
 		res[pasturePb.ExposeEstrusType_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) FrozenSemenTypeMap() map[pasturePb.FrozenSemenType_Kind]string {
+func (s *StoreEntry) FrozenSemenTypeMap(userModel *model.UserModel) map[pasturePb.FrozenSemenType_Kind]string {
 	res := make(map[pasturePb.FrozenSemenType_Kind]string)
-	for _, v := range s.FrozenSemenTypeEnumList("") {
+	for _, v := range s.FrozenSemenTypeEnumList(userModel, "") {
 		res[pasturePb.FrozenSemenType_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) UnitMap() map[pasturePb.Unit_Kind]string {
+func (s *StoreEntry) UnitMap(userModel *model.UserModel) map[pasturePb.Unit_Kind]string {
 	res := make(map[pasturePb.Unit_Kind]string)
-	for _, v := range s.UnitEnumList("") {
+	for _, v := range s.UnitEnumList(userModel, "") {
 		res[pasturePb.Unit_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) WeekMap() map[pasturePb.Week_Kind]string {
+func (s *StoreEntry) WeekMap(userModel *model.UserModel) map[pasturePb.Week_Kind]string {
 	res := make(map[pasturePb.Week_Kind]string)
-	for _, v := range s.WeekEnumList("") {
+	for _, v := range s.WeekEnumList(userModel, "") {
 		res[pasturePb.Week_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) MonthMap() map[int32]string {
+func (s *StoreEntry) MonthMap(userModel *model.UserModel) map[int32]string {
 	res := make(map[int32]string)
-	for _, v := range s.MonthEnumList("") {
+	for _, v := range s.MonthEnumList(userModel, "") {
 		res[v.Value] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) CowTypeMap() map[pasturePb.CowType_Kind]string {
+func (s *StoreEntry) CowTypeMap(userModel *model.UserModel) map[pasturePb.CowType_Kind]string {
 	res := make(map[pasturePb.CowType_Kind]string)
 	optionName, isAll := "", ""
-	for _, v := range s.CowTypeEnumList(optionName, isAll) {
+	for _, v := range s.CowTypeEnumList(userModel, optionName, isAll) {
 		res[pasturePb.CowType_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) CowBreedStatusMap() map[pasturePb.BreedStatus_Kind]string {
+func (s *StoreEntry) CowBreedStatusMap(userModel *model.UserModel) map[pasturePb.BreedStatus_Kind]string {
 	res := make(map[pasturePb.BreedStatus_Kind]string)
-	for _, v := range s.BreedStatusEnumList() {
+	for _, v := range s.BreedStatusEnumList(userModel, "") {
 		res[pasturePb.BreedStatus_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) CowKindMap() map[pasturePb.CowKind_Kind]string {
+func (s *StoreEntry) CowKindMap(userModel *model.UserModel) map[pasturePb.CowKind_Kind]string {
 	res := make(map[pasturePb.CowKind_Kind]string)
-	for _, v := range s.CowKindEnumList() {
+	for _, v := range s.CowKindEnumList(userModel, "") {
 		res[pasturePb.CowKind_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) CowSourceMap() map[pasturePb.CowSource_Kind]string {
+func (s *StoreEntry) CowSourceMap(userModel *model.UserModel) map[pasturePb.CowSource_Kind]string {
 	res := make(map[pasturePb.CowSource_Kind]string)
-	for _, v := range s.CowSourceEnumList() {
+	for _, v := range s.CowSourceEnumList(userModel, "") {
 		res[pasturePb.CowSource_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) WorkOrderCategoryMap() map[pasturePb.WorkOrderCategory_Kind]string {
+func (s *StoreEntry) WorkOrderCategoryMap(userModel *model.UserModel) map[pasturePb.WorkOrderCategory_Kind]string {
 	res := make(map[pasturePb.WorkOrderCategory_Kind]string)
-	for _, v := range s.WorkOrderCategoryEnumList("") {
+	for _, v := range s.WorkOrderCategoryEnumList(userModel, "") {
 		res[pasturePb.WorkOrderCategory_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) WorkOrderFrequencyMap() map[pasturePb.WorkOrderFrequency_Kind]string {
+func (s *StoreEntry) WorkOrderFrequencyMap(userModel *model.UserModel) map[pasturePb.WorkOrderFrequency_Kind]string {
 	res := make(map[pasturePb.WorkOrderFrequency_Kind]string)
-	for _, v := range s.WorkOrderFrequencyEnumList("") {
+	for _, v := range s.WorkOrderFrequencyEnumList(userModel, "") {
 		res[pasturePb.WorkOrderFrequency_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) WorkOrderSubUnitMap() map[pasturePb.WorkOrderSubscribeUnit_Kind]string {
+func (s *StoreEntry) WorkOrderSubUnitMap(userModel *model.UserModel) map[pasturePb.WorkOrderSubscribeUnit_Kind]string {
 	res := make(map[pasturePb.WorkOrderSubscribeUnit_Kind]string)
-	for _, v := range s.WorkOrderSubUnitEnumList("") {
+	for _, v := range s.WorkOrderSubUnitEnumList(userModel, "") {
 		res[pasturePb.WorkOrderSubscribeUnit_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) WorkOrderPriorityMap() map[pasturePb.Priority_Kind]string {
+func (s *StoreEntry) WorkOrderPriorityMap(userModel *model.UserModel) map[pasturePb.Priority_Kind]string {
 	res := make(map[pasturePb.Priority_Kind]string)
-	for _, v := range s.WorkOrderPriorityEnumList("") {
+	for _, v := range s.WorkOrderPriorityEnumList(userModel, "") {
 		res[pasturePb.Priority_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) SameTimeCowTypeMap() map[pasturePb.SameTimeCowType_Kind]string {
+func (s *StoreEntry) SameTimeCowTypeMap(userModel *model.UserModel) map[pasturePb.SameTimeCowType_Kind]string {
 	res := make(map[pasturePb.SameTimeCowType_Kind]string)
-	for _, v := range s.SameTimeCowTypeEnumList("") {
+	for _, v := range s.SameTimeCowTypeEnumList(userModel, "") {
 		res[pasturePb.SameTimeCowType_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
+func (s *StoreEntry) CalendarTypeMap(userModel *model.UserModel) map[pasturePb.CalendarType_Kind]string {
+	res := make(map[pasturePb.CalendarType_Kind]string)
+	for _, v := range s.CalendarTypeEnumList(userModel, "") {
+		res[pasturePb.CalendarType_Kind(v.Value)] = v.Label
+	}
+	return res
+}
+
 func CalendarTypeMap() map[pasturePb.CalendarType_Kind]string {
 	res := make(map[pasturePb.CalendarType_Kind]string)
 	for _, v := range CalendarTypeEnumList("") {
@@ -139,49 +151,49 @@ 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
 }
 
-func (s *StoreEntry) PregnantCheckMethodMap() map[pasturePb.PregnantCheckMethod_Kind]string {
+func (s *StoreEntry) PregnantCheckMethodMap(userModel *model.UserModel) map[pasturePb.PregnantCheckMethod_Kind]string {
 	res := make(map[pasturePb.PregnantCheckMethod_Kind]string)
-	for _, v := range s.PregnantCheckMethodEnumList("") {
+	for _, v := range s.PregnantCheckMethodEnumList(userModel, "") {
 		res[pasturePb.PregnantCheckMethod_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) PregnantCheckResultMap() map[pasturePb.PregnantCheckResult_Kind]string {
+func (s *StoreEntry) PregnantCheckResultMap(userModel *model.UserModel) map[pasturePb.PregnantCheckResult_Kind]string {
 	res := make(map[pasturePb.PregnantCheckResult_Kind]string)
-	for _, v := range s.PregnantCheckResultEnumList("") {
+	for _, v := range s.PregnantCheckResultEnumList(userModel, "") {
 		res[pasturePb.PregnantCheckResult_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) HealthStatusMap() map[pasturePb.HealthStatus_Kind]string {
+func (s *StoreEntry) HealthStatusMap(userModel *model.UserModel) map[pasturePb.HealthStatus_Kind]string {
 	res := make(map[pasturePb.HealthStatus_Kind]string)
-	for _, v := range s.HealthStatusEnumList("") {
+	for _, v := range s.HealthStatusEnumList(userModel, "") {
 		res[pasturePb.HealthStatus_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) PurposeMap() map[pasturePb.Purpose_Kind]string {
+func (s *StoreEntry) PurposeMap(userModel *model.UserModel) map[pasturePb.Purpose_Kind]string {
 	res := make(map[pasturePb.Purpose_Kind]string)
-	for _, v := range s.CowPurposeList("") {
+	for _, v := range s.CowPurposeList(userModel, "") {
 		res[pasturePb.Purpose_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) DiseaseTypeMap() map[int32]string {
+func (s *StoreEntry) DiseaseTypeMap(userModel *model.UserModel) map[int32]string {
 	res := make(map[int32]string)
-	for _, v := range s.diseaseTypeEnumList("") {
+	for _, v := range s.diseaseTypeEnumList(userModel, "") {
 		res[v.Value] = v.Label
 	}
 	return res
@@ -199,177 +211,161 @@ func (s *StoreEntry) MultiFactorAnalysisMethodMap() map[pasturePb.MultiFactorAna
 	}
 }
 
-func (s *StoreEntry) NeckRingIsBindMap() map[pasturePb.NeckRingIsBind_Kind]string {
+func (s *StoreEntry) NeckRingIsBindMap(userModel *model.UserModel) map[pasturePb.NeckRingIsBind_Kind]string {
 	res := make(map[pasturePb.NeckRingIsBind_Kind]string)
-	for _, v := range s.NeckRingIsBindEnumList("") {
+	for _, v := range s.NeckRingIsBindEnumList(userModel, "") {
 		res[pasturePb.NeckRingIsBind_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) NeckRingStatusMap() map[pasturePb.NeckRingStatus_Kind]string {
+func (s *StoreEntry) NeckRingStatusMap(userModel *model.UserModel) map[pasturePb.NeckRingStatus_Kind]string {
 	res := make(map[pasturePb.NeckRingStatus_Kind]string)
-	for _, v := range s.NeckRingStatusEnumList("") {
+	for _, v := range s.NeckRingStatusEnumList(userModel, "") {
 		res[pasturePb.NeckRingStatus_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) SaleCowAnalysisMap() map[pasturePb.SaleCowAnalysisMethod_Kind]string {
+func (s *StoreEntry) SaleCowAnalysisMap(userModel *model.UserModel) map[pasturePb.SaleCowAnalysisMethod_Kind]string {
 	res := make(map[pasturePb.SaleCowAnalysisMethod_Kind]string)
-	for _, v := range s.SaleCowAnalysisMethodEnumList("") {
+	for _, v := range s.SaleCowAnalysisMethodEnumList(userModel, "") {
 		res[pasturePb.SaleCowAnalysisMethod_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) OutTypeMap() map[pasturePb.OutType_Kind]string {
+func (s *StoreEntry) OutTypeMap(userModel *model.UserModel) map[pasturePb.OutType_Kind]string {
 	res := make(map[pasturePb.OutType_Kind]string)
-	for _, v := range s.OutTypeEnumList("") {
+	for _, v := range s.OutTypeEnumList(userModel, "") {
 		res[pasturePb.OutType_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) AuditStatusMap() map[pasturePb.AuditStatus_Kind]string {
+func (s *StoreEntry) AuditStatusMap(userModel *model.UserModel) map[pasturePb.AuditStatus_Kind]string {
 	res := make(map[pasturePb.AuditStatus_Kind]string)
-	for _, v := range s.AuditStatusEnumList("") {
+	for _, v := range s.AuditStatusEnumList(userModel, "") {
 		res[pasturePb.AuditStatus_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) AdmissionStatusMap() map[pasturePb.AdmissionStatus_Kind]string {
+func (s *StoreEntry) AdmissionStatusMap(userModel *model.UserModel) map[pasturePb.AdmissionStatus_Kind]string {
 	res := make(map[pasturePb.AdmissionStatus_Kind]string)
-	for _, v := range s.AdmissionStatusEnumList("") {
+	for _, v := range s.AdmissionStatusEnumList(userModel, "") {
 		res[pasturePb.AdmissionStatus_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) SameTimeTypeMap() map[pasturePb.SameTimeType_Kind]string {
+func (s *StoreEntry) SameTimeTypeMap(userModel *model.UserModel) map[pasturePb.SameTimeType_Kind]string {
 	res := make(map[pasturePb.SameTimeType_Kind]string)
-	for _, v := range s.SameTimeTypeEnumList("") {
+	for _, v := range s.SameTimeTypeEnumList(userModel, "") {
 		res[pasturePb.SameTimeType_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) EventTypeMap() map[pasturePb.EventType_Kind]string {
+func (s *StoreEntry) EventTypeMap(userModel *model.UserModel) map[pasturePb.EventType_Kind]string {
 	res := make(map[pasturePb.EventType_Kind]string)
-	for _, v := range s.EventTypeEnumList("") {
+	for _, v := range s.EventTypeEnumList(userModel, "") {
 		res[pasturePb.EventType_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) CalvingLevelMap() map[pasturePb.CalvingLevel_Kind]string {
+func (s *StoreEntry) CalvingLevelMap(userModel *model.UserModel) map[pasturePb.CalvingLevel_Kind]string {
 	res := make(map[pasturePb.CalvingLevel_Kind]string)
-	for _, v := range s.CalvingLevelEnumList("") {
+	for _, v := range s.CalvingLevelEnumList(userModel, "") {
 		res[pasturePb.CalvingLevel_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) DystociaReasonMap() map[pasturePb.DystociaReason_Kind]string {
+func (s *StoreEntry) DystociaReasonMap(userModel *model.UserModel) map[pasturePb.DystociaReason_Kind]string {
 	res := make(map[pasturePb.DystociaReason_Kind]string)
-	for _, v := range s.DystociaReasonEnumList("") {
+	for _, v := range s.DystociaReasonEnumList(userModel, "") {
 		res[pasturePb.DystociaReason_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) DeadReasonMap() map[pasturePb.DeathReason_Kind]string {
+func (s *StoreEntry) DeadReasonMap(userModel *model.UserModel) map[pasturePb.DeathReason_Kind]string {
 	res := make(map[pasturePb.DeathReason_Kind]string)
-	for _, v := range s.DeathReasonEnumList("") {
+	for _, v := range s.DeathReasonEnumList(userModel, "") {
 		res[pasturePb.DeathReason_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) OutReasonMap() map[pasturePb.OutReasons_Kind]string {
-	res := make(map[pasturePb.OutReasons_Kind]string)
-	for _, v := range s.OutReasonEnumList("") {
-		res[pasturePb.OutReasons_Kind(v.Value)] = v.Label
-	}
-	return res
-}
-
-func (s *StoreEntry) MatingResultMap() map[pasturePb.MatingResult_Kind]string {
+func (s *StoreEntry) MatingResultMap(userModel *model.UserModel) map[pasturePb.MatingResult_Kind]string {
 	res := make(map[pasturePb.MatingResult_Kind]string)
-	for _, v := range s.MatingResultEnumList("") {
+	for _, v := range s.MatingResultEnumList(userModel, "") {
 		res[pasturePb.MatingResult_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) EventCategoryMap() map[pasturePb.EventCategory_Kind]string {
+func (s *StoreEntry) EventCategoryMap(userModel *model.UserModel) map[pasturePb.EventCategory_Kind]string {
 	res := make(map[pasturePb.EventCategory_Kind]string)
-	for _, v := range s.EventCategoryEnumList("") {
+	for _, v := range s.EventCategoryEnumList(userModel, "") {
 		res[pasturePb.EventCategory_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) GroupTransferReasonMap() map[int32]string {
+func (s *StoreEntry) GroupTransferReasonMap(userModel *model.UserModel) map[int32]string {
 	res := make(map[int32]string)
-	for _, v := range s.TransferPenEnumList("") {
+	for _, v := range s.TransferPenEnumList(userModel, "") {
 		res[v.Value] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) BarnTypeMap() map[pasturePb.PenType_Kind]string {
-	return map[pasturePb.PenType_Kind]string{
-		pasturePb.PenType_Lactating_Calves: "哺乳牛舍",
-		pasturePb.PenType_Weaned_Calves:    "断奶牛舍",
-		pasturePb.PenType_Youth:            "青年牛舍",
-		pasturePb.PenType_Nurturing:        "育成牛舍",
-		pasturePb.PenType_Lactation:        "成母牛舍",
-		pasturePb.PenType_Peripartum:       "围产牛舍",
-		pasturePb.PenType_Dry_Milking:      "干奶牛舍",
-		pasturePb.PenType_Sick_Cow:         "病牛牛舍",
-		pasturePb.PenType_Out:              "淘汰牛舍",
-		pasturePb.PenType_Segregate:        "隔离牛舍",
-		pasturePb.PenType_Bull:             "公牛牛舍",
+func (s *StoreEntry) BarnTypeMap(userModel *model.UserModel) map[pasturePb.PenType_Kind]string {
+	res := make(map[pasturePb.PenType_Kind]string)
+	for _, v := range s.BarnTypeEnumList(userModel, nil, "") {
+		res[pasturePb.PenType_Kind(v.Value)] = v.Label
 	}
+	return res
 }
 
-func (s *StoreEntry) UnMatingReasonsMap() map[pasturePb.UnMatingReasons_Kind]string {
+func (s *StoreEntry) UnMatingReasonsMap(userModel *model.UserModel) map[pasturePb.UnMatingReasons_Kind]string {
 	res := make(map[pasturePb.UnMatingReasons_Kind]string)
-	for _, v := range s.UnMatingReasonsEnumList("") {
+	for _, v := range s.UnMatingReasonsEnumList(userModel, "") {
 		res[pasturePb.UnMatingReasons_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) ForbiddenMatingReasonsMap() map[pasturePb.ForbiddenMatingReasons_Kind]string {
+func (s *StoreEntry) ForbiddenMatingReasonsMap(userModel *model.UserModel) map[pasturePb.ForbiddenMatingReasons_Kind]string {
 	res := make(map[pasturePb.ForbiddenMatingReasons_Kind]string)
-	for _, v := range s.ForbiddenMatingReasonsEnumList("") {
+	for _, v := range s.ForbiddenMatingReasonsEnumList(userModel, "") {
 		res[pasturePb.ForbiddenMatingReasons_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) CowOutReasonsMap() map[pasturePb.OutReasons_Kind]string {
+func (s *StoreEntry) CowOutReasonsMap(userModel *model.UserModel) map[pasturePb.OutReasons_Kind]string {
 	res := make(map[pasturePb.OutReasons_Kind]string)
-	for _, v := range s.CowOutReasonList("") {
+	for _, v := range s.CowOutReasonEnumList(userModel, "") {
 		res[pasturePb.OutReasons_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) CowDeathDestinationMap() map[pasturePb.DeathDestination_Kind]string {
+func (s *StoreEntry) CowDeathDestinationMap(userModel *model.UserModel) map[pasturePb.DeathDestination_Kind]string {
 	res := make(map[pasturePb.DeathDestination_Kind]string)
-	for _, v := range s.CowDeathDestinationList("") {
+	for _, v := range s.CowDeathDestinationList(userModel, "") {
 		res[pasturePb.DeathDestination_Kind(v.Value)] = v.Label
 	}
 	return res
 }
 
-func (s *StoreEntry) WarningHealthLevelMap() map[pasturePb.WarningHealthLevel_Kind]string {
+func (s *StoreEntry) WarningHealthLevelMap(userModel *model.UserModel) map[pasturePb.WarningHealthLevel_Kind]string {
 	res := make(map[pasturePb.WarningHealthLevel_Kind]string)
-	for _, v := range s.WarningHealthLevel("") {
+	for _, v := range s.WarningHealthLevel(userModel, "") {
 		res[pasturePb.WarningHealthLevel_Kind(v.Value)] = v.Label
 	}
 	return res

+ 40 - 14
module/backend/enum_options.go

@@ -25,7 +25,7 @@ func (s *StoreEntry) BarnTypeOptions(ctx context.Context) (*pasturePb.ConfigOpti
 	return &pasturePb.ConfigOptionsListResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
-		Data: s.BarnTypeEnumList(excludeTypes),
+		Data: s.BarnTypeEnumList(userModel, excludeTypes, ""),
 	}, nil
 }
 
@@ -51,7 +51,7 @@ func (s *StoreEntry) BarnListOptions(ctx context.Context, penType int, isAll str
 		excludeTypes = append(excludeTypes, pasturePb.PenType_Dry_Milking, pasturePb.PenType_Peripartum)
 	}
 
-	barnTypeList := s.BarnTypeEnumList(excludeTypes)
+	barnTypeList := s.BarnTypeEnumList(userModel, excludeTypes, "")
 	return &pasturePb.ConfigOptionsListResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
@@ -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
 }
 
@@ -129,41 +129,62 @@ func (s *StoreEntry) PrescriptionOptions(ctx context.Context) (*pasturePb.Config
 }
 
 func (s *StoreEntry) BreedStatusOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error) {
+	userModel, err := s.GetUserModel(ctx)
+	if err != nil {
+		return nil, xerr.WithStack(err)
+	}
 	return &pasturePb.ConfigOptionsListResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
-		Data: s.BreedStatusEnumList(),
+		Data: s.BreedStatusEnumList(userModel, ""),
 	}, nil
 }
 func (s *StoreEntry) CowKindOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error) {
+	userModel, err := s.GetUserModel(ctx)
+	if err != nil {
+		return nil, xerr.WithStack(err)
+	}
 	return &pasturePb.ConfigOptionsListResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
-		Data: s.CowKindEnumList(),
+		Data: s.CowKindEnumList(userModel, ""),
 	}, nil
 }
 
 func (s *StoreEntry) CowSourceOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error) {
+	userModel, err := s.GetUserModel(ctx)
+	if err != nil {
+		return nil, xerr.WithStack(err)
+	}
+
 	return &pasturePb.ConfigOptionsListResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
-		Data: s.CowSourceEnumList(),
+		Data: s.CowSourceEnumList(userModel, ""),
 	}, nil
 }
 
 func (s *StoreEntry) CowTypeOptions(ctx context.Context, optionName, isAll string) (*pasturePb.ConfigOptionsListResponse, error) {
+	userModel, err := s.GetUserModel(ctx)
+	if err != nil {
+		return nil, xerr.WithStack(err)
+	}
 	return &pasturePb.ConfigOptionsListResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
-		Data: s.CowTypeEnumList(optionName, isAll),
+		Data: s.CowTypeEnumList(userModel, optionName, isAll),
 	}, nil
 }
 
 func (s *StoreEntry) CowTransferPenReasonOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error) {
+	userModel, err := s.GetUserModel(ctx)
+	if err != nil {
+		return nil, xerr.WithStack(err)
+	}
 	return &pasturePb.ConfigOptionsListResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
-		Data: s.TransferPenEnumList(""),
+		Data: s.TransferPenEnumList(userModel, ""),
 	}, nil
 }
 
@@ -236,15 +257,20 @@ func (s *StoreEntry) BullOptions(ctx context.Context) (*pasturePb.BullOptionsLis
 	return &pasturePb.BullOptionsListResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
-		Data: s.BullNumberEnumList("", userModel.AppPasture.Id),
+		Data: s.BullNumberEnumList(userModel, ""),
 	}, nil
 }
 
 func (s *StoreEntry) SystemBaseConfigOptions(ctx context.Context, optionsName, isAll string) (*pasturePb.ConfigOptionsListResponse, error) {
+	userModel, err := s.GetUserModel(ctx)
+	if err != nil {
+		return nil, xerr.WithStack(err)
+	}
+
 	if optionsName == "" {
 		return nil, xerr.New("optionsName is empty")
 	}
-	getConfigFuncMap := map[string]func(isAll string) []*pasturePb.ConfigOptionsList{
+	getConfigFuncMap := map[string]func(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList{
 		"childNumber":                s.ChildNumberEnumList,
 		"calvingLevel":               s.CalvingLevelEnumList,
 		"dystociaReason":             s.DystociaReasonEnumList,
@@ -267,7 +293,7 @@ func (s *StoreEntry) SystemBaseConfigOptions(ctx context.Context, optionsName, i
 		"immunizationConditions":     s.ImmunizationConditionsEnumList,
 		"abortionReasons":            s.AbortionReasonsEnumList,
 		"healthStatus":               s.HealthStatusEnumList,
-		"calendarType":               CalendarTypeEnumList,
+		"calendarType":               s.CalendarTypeEnumList,
 		"calvingAnalysisMethod":      s.CalvingAnalysisMethodEnumList,
 		"lact":                       s.LactEnumList,
 		"diseaseAnalysisMethod":      s.DiseaseAnalysisMethodEnumList,
@@ -281,13 +307,13 @@ func (s *StoreEntry) SystemBaseConfigOptions(ctx context.Context, optionsName, i
 		"pregnantCheckName":          s.PregnantCheckNameEnumList,
 		"unMatingReasons":            s.UnMatingReasonsEnumList,
 		"evenType":                   s.EventTypeEnumList,
-		"outReason":                  s.OutReasonEnumList,
+		"outReason":                  s.CowOutReasonEnumList,
 		"deathReason":                s.DeathReasonEnumList,
 		"categoryKind":               s.EventCategoryEnumList,
 		"indicatorsDetails":          s.IndicatorsDetailsList,
 		"purposeKind":                s.CowPurposeList,
 		"forbiddenMatingReasons":     s.ForbiddenMatingReasonsEnumList,
-		"cowOutReason":               s.CowOutReasonList,
+		"cowOutReason":               s.CowOutReasonEnumList,
 		"deathDestination":           s.CowDeathDestinationList,
 		"warningHealthLevel":         s.WarningHealthLevel,
 		"behavior":                   s.Behavior,
@@ -301,7 +327,7 @@ func (s *StoreEntry) SystemBaseConfigOptions(ctx context.Context, optionsName, i
 		return nil, fmt.Errorf("invalid optionsName: %s", optionsName)
 	}
 
-	configOptions := getConfigFunc(isAll)
+	configOptions := getConfigFunc(userModel, isAll)
 	if configOptions == nil {
 		return nil, fmt.Errorf("failed to retrieve configOptions for %s", optionsName)
 	}

+ 5 - 5
module/backend/event_base.go

@@ -70,10 +70,10 @@ func (s *StoreEntry) EnterList(ctx context.Context, req *pasturePb.SearchEventRe
 	}
 
 	penMap := s.PenMap(ctx, userModel.AppPasture.Id)
-	breedStatusMap := s.CowBreedStatusMap()
-	cowSourceMap := s.CowSourceMap()
-	cowTypeMap := s.CowTypeMap()
-	cowKindMap := s.CowKindMap()
+	breedStatusMap := s.CowBreedStatusMap(userModel)
+	cowSourceMap := s.CowSourceMap(userModel)
+	cowTypeMap := s.CowTypeMap(userModel)
+	cowKindMap := s.CowKindMap(userModel)
 
 	return &pasturePb.SearchEnterEventResponse{
 		Code: http.StatusOK,
@@ -237,7 +237,7 @@ func (s *StoreEntry) CreateGroupTransfer(ctx context.Context, req *pasturePb.Tra
 		return xerr.Custom("一次最多只能转移50头牛")
 	}
 
-	transferReasonMap := s.GroupTransferReasonMap()
+	transferReasonMap := s.GroupTransferReasonMap(userModel)
 	penMap := s.PenMap(ctx, userModel.AppPasture.Id)
 
 	if err = s.DB.Transaction(func(tx *gorm.DB) error {

+ 1 - 1
module/backend/event_base_more.go

@@ -201,7 +201,7 @@ func (s *StoreEntry) CowSaleCreate(ctx context.Context, req *pasturePb.EventCowS
 	}
 
 	if req.SalesType == pasturePb.SalesType_Out {
-		if name, ok := s.CowOutReasonsMap()[req.OutReasonsKind]; ok {
+		if name, ok := s.CowOutReasonsMap(userModel)[req.OutReasonsKind]; ok {
 			req.OutReasonsName = name
 		}
 	}

+ 1 - 1
module/backend/event_breed.go

@@ -357,7 +357,7 @@ func (s *StoreEntry) SameTimeList(
 		return nil, xerr.WithStack(err)
 	}
 
-	sameTimeTypeMap := s.SameTimeTypeMap()
+	sameTimeTypeMap := s.SameTimeTypeMap(userModel)
 	return &pasturePb.SearchSameTimeResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",

+ 6 - 6
module/backend/event_breed_more.go

@@ -49,8 +49,8 @@ func (s *StoreEntry) PregnantCheckList(ctx context.Context, req *pasturePb.Searc
 		return nil, xerr.WithStack(err)
 	}
 
-	pregnantCheckResultMap := s.PregnantCheckResultMap()
-	pregnantCheckMethodMap := s.PregnantCheckMethodMap()
+	pregnantCheckResultMap := s.PregnantCheckResultMap(userModel)
+	pregnantCheckMethodMap := s.PregnantCheckMethodMap(userModel)
 	return &pasturePb.EventPregnantCheckResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
@@ -74,8 +74,8 @@ func (s *StoreEntry) PregnantCheckCreateBatch(ctx context.Context, req *pastureP
 		return xerr.WithStack(err)
 	}
 
-	abortionReasonsMap := s.AbortionReasonsMap()
-	matingResultMap := s.MatingResultMap()
+	abortionReasonsMap := s.AbortionReasonsMap(userModel)
+	matingResultMap := s.MatingResultMap(userModel)
 
 	if err = s.DB.Transaction(func(tx *gorm.DB) error {
 		for _, item := range pregnantCheckBatchModelList {
@@ -319,7 +319,7 @@ func (s *StoreEntry) MatingList(ctx context.Context, req *pasturePb.SearchEventR
 		return nil, xerr.WithStack(err)
 	}
 
-	exposeEstrusTypeMap := s.ExposeEstrusTypeMap()
+	exposeEstrusTypeMap := s.ExposeEstrusTypeMap(userModel)
 	return &pasturePb.EventMatingResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
@@ -474,7 +474,7 @@ func (s *StoreEntry) NaturalEstrusToMating(ctx context.Context, tx *gorm.DB, use
 		}
 
 		// 更新牛只配种结果日志
-		if err = s.UpdateMatingResultEventCowLogByCowId(ctx, item.Cow.Id, s.MatingResultMap()[pasturePb.MatingResult_Empty]); err != nil {
+		if err = s.UpdateMatingResultEventCowLogByCowId(ctx, item.Cow.Id, s.MatingResultMap(userModel)[pasturePb.MatingResult_Empty]); err != nil {
 			zaplog.Error("MatingCreate", zap.Any("UpdateEventCowLogByCowId", err), zap.Any("cow", item.Cow))
 		}
 	}

+ 5 - 5
module/backend/event_check.go

@@ -356,7 +356,7 @@ func (s *StoreEntry) EstrusCheckDataCheck(ctx context.Context, userModel *model.
 	if req.ExposeEstrusType == pasturePb.ExposeEstrusType_Neck_Ring {
 		exposeEstrusType = pasturePb.ExposeEstrusType_Neck_Ring
 	}
-	unMatingReasonsMap := s.UnMatingReasonsMap()
+	unMatingReasonsMap := s.UnMatingReasonsMap(userModel)
 
 	res := &model.EventEstrusBatch{
 		ExposeEstrusType: exposeEstrusType,
@@ -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,
@@ -534,7 +534,7 @@ func (s *StoreEntry) AbortionEventDataCheck(ctx context.Context, userModel *mode
 
 func (s *StoreEntry) ForbiddenMatingCheck(ctx context.Context, userModel *model.UserModel, items []*pasturePb.ForbiddenMatingItem) ([]*model.EventForbiddenMatingItem, error) {
 	res := make([]*model.EventForbiddenMatingItem, 0)
-	forbiddenMatingReasonsMap := s.ForbiddenMatingReasonsMap()
+	forbiddenMatingReasonsMap := s.ForbiddenMatingReasonsMap(userModel)
 	for _, v := range items {
 		cowInfo, err := s.GetCowInfoByEarNumber(ctx, userModel.AppPasture.Id, v.EarNumber)
 		if err != nil {
@@ -608,7 +608,7 @@ func (s *StoreEntry) DeathCheck(ctx context.Context, userModel *model.UserModel,
 			return nil, xerr.Customf(messageId)
 		}
 
-		if name, ok := s.DeadReasonMap()[item.DeathReasonKind]; ok {
+		if name, ok := s.DeadReasonMap(userModel)[item.DeathReasonKind]; ok {
 			item.DeathReasonName = name
 		}
 
@@ -621,7 +621,7 @@ func (s *StoreEntry) DeathCheck(ctx context.Context, userModel *model.UserModel,
 			return nil, xerr.Customf(messageId)
 		}
 
-		if name, ok := s.CowDeathDestinationMap()[item.DeathDestinationKind]; ok {
+		if name, ok := s.CowDeathDestinationMap(userModel)[item.DeathDestinationKind]; ok {
 			item.DeathDestinationName = name
 		}
 

+ 14 - 10
module/backend/event_cow_log.go

@@ -17,13 +17,17 @@ import (
 )
 
 func (s *StoreEntry) SubmitEventLog(ctx context.Context, pastureId int64, cow *model.Cow, eventType pasturePb.EventType_Kind, req interface{}) *model.EventCowLog {
+	userModel, err := s.GetUserModel(ctx)
+	if err != nil {
+		return nil
+	}
 	var (
 		desc, remarks    = "", ""
-		eventTypeName    = s.EventTypeMap()[eventType]
+		eventTypeName    = s.EventTypeMap(userModel)[eventType]
 		eventAt          = int64(0)
 		eventCategoryMap = s.eventCategoryMap()
 		penMap           = s.PenMap(ctx, pastureId)
-		cowTypeMap       = s.CowTypeMap()
+		cowTypeMap       = s.CowTypeMap(userModel)
 		operationUser    = &model.SystemUser{}
 	)
 
@@ -32,7 +36,7 @@ func (s *StoreEntry) SubmitEventLog(ctx context.Context, pastureId int64, cow *m
 		data := req.(*pasturePb.EventEnterRequest)
 		eventAt = int64(data.EnterAt)
 		remarks = data.Remarks
-		sourceMap := s.CowSourceMap()
+		sourceMap := s.CowSourceMap(userModel)
 		operationUser.Id = int64(data.OperationId)
 		operationUser.Name = data.OperationName
 		sex := "公"
@@ -61,15 +65,15 @@ func (s *StoreEntry) SubmitEventLog(ctx context.Context, pastureId int64, cow *m
 		data := req.(*PregnantCheckBatchModel)
 		eventAt = int64(data.PregnantCheckAt)
 		if data.PregnantCheckResult == pasturePb.PregnantCheckResult_Pregnant {
-			desc += fmt.Sprintf("孕检方式: %s; 孕检结果: %s", s.PregnantCheckMethodMap()[data.PregnantCheckMethod], s.MatingResultMap()[pasturePb.MatingResult_Pregnant])
+			desc += fmt.Sprintf("孕检方式: %s; 孕检结果: %s", s.PregnantCheckMethodMap(userModel)[data.PregnantCheckMethod], s.MatingResultMap(userModel)[pasturePb.MatingResult_Pregnant])
 		}
 		if data.PregnantCheckResult == pasturePb.PregnantCheckResult_UnPregnant {
-			desc += fmt.Sprintf("孕检方式: %s", s.PregnantCheckMethodMap()[data.PregnantCheckMethod])
+			desc += fmt.Sprintf("孕检方式: %s", s.PregnantCheckMethodMap(userModel)[data.PregnantCheckMethod])
 			if cow.BreedStatus == pasturePb.BreedStatus_Abort {
-				desc += fmt.Sprintf("; 复检结果: %s", s.MatingResultMap()[pasturePb.MatingResult_Abort])
+				desc += fmt.Sprintf("; 复检结果: %s", s.MatingResultMap(userModel)[pasturePb.MatingResult_Abort])
 			}
 			if cow.BreedStatus == pasturePb.BreedStatus_Empty {
-				desc += fmt.Sprintf("; 孕检结果: %s", s.MatingResultMap()[pasturePb.MatingResult_Empty])
+				desc += fmt.Sprintf("; 孕检结果: %s", s.MatingResultMap(userModel)[pasturePb.MatingResult_Empty])
 			}
 		}
 		operationUser.Id = data.OperationUser.Id
@@ -82,16 +86,16 @@ func (s *StoreEntry) SubmitEventLog(ctx context.Context, pastureId int64, cow *m
 		if data.IsMating == pasturePb.IsShow_Ok {
 			isMating = "是"
 		}
-		desc = fmt.Sprintf("发情揭发方式:%s;是否配种:%s;", s.ExposeEstrusTypeMap()[data.ExposeEstrusType], isMating)
+		desc = fmt.Sprintf("发情揭发方式:%s;是否配种:%s;", s.ExposeEstrusTypeMap(userModel)[data.ExposeEstrusType], isMating)
 		operationUser.Id = data.OperationId
 		operationUser.Name = data.OperationName
 		remarks = data.Remarks
 	case pasturePb.EventType_Calving:
 		data := req.(*pasturePb.EventCalving)
 		eventAt = int64(data.CalvingAt)
-		desc = fmt.Sprintf("怀孕天数:%d;难产等级: %s;产子数量: %d;", cow.PregnancyAge, s.CalvingLevelMap()[data.CalvingLevel], data.ChildNumber)
+		desc = fmt.Sprintf("怀孕天数:%d;难产等级: %s;产子数量: %d;", cow.PregnancyAge, s.CalvingLevelMap(userModel)[data.CalvingLevel], data.ChildNumber)
 		if data.CalvingLevel > pasturePb.CalvingLevel_Natural_Childbirth {
-			desc += fmt.Sprintf("难产原因: %s", s.DystociaReasonMap()[data.DystociaReason])
+			desc += fmt.Sprintf("难产原因: %s", s.DystociaReasonMap(userModel)[data.DystociaReason])
 		}
 		ly, qy, die := 0, 0, 0
 		earNumber := ""

+ 4 - 4
module/backend/event_health.go

@@ -65,7 +65,7 @@ func (s *StoreEntry) CowDiseaseList(ctx context.Context, req *pasturePb.SearchEv
 		return nil, xerr.WithStack(err)
 	}
 
-	healthStatusMap := s.HealthStatusMap()
+	healthStatusMap := s.HealthStatusMap(userModel)
 	return &pasturePb.EventCowDiseaseResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
@@ -229,7 +229,7 @@ func (s *StoreEntry) CowDiseaseCreate(ctx context.Context, req *pasturePb.EventC
 		}
 		// 3. 创建治疗记录
 		if len(prescriptionDetail) > 0 {
-			diseaseTypeMap := s.DiseaseTypeMap()
+			diseaseTypeMap := s.DiseaseTypeMap(userModel)
 			newCowTreatmentRequest := &pasturePb.CowTreatmentRequest{
 				CowId:              req.CowId,
 				PrescriptionId:     prescription.Id,
@@ -443,7 +443,7 @@ func (s *StoreEntry) CowDiseaseTreatment(ctx context.Context, req *pasturePb.Cow
 	}
 
 	// 处方详情
-	unitMap := s.UnitMap()
+	unitMap := s.UnitMap(userModel)
 	prescriptionDetail := make([]*pasturePb.PrescriptionDrugsList, len(prescriptionDrugs))
 	for i, v := range prescriptionDrugs {
 		prescriptionDetail[i] = &pasturePb.PrescriptionDrugsList{
@@ -467,7 +467,7 @@ func (s *StoreEntry) CowDiseaseTreatment(ctx context.Context, req *pasturePb.Cow
 	if req.TreatmentResult == pasturePb.TreatmentResult_Dead {
 		healthStatus = pasturePb.HealthStatus_Dead
 	}
-	diseaseTypeMap := s.DiseaseTypeMap()
+	diseaseTypeMap := s.DiseaseTypeMap(userModel)
 	newEventCowTreatment := model.NewEventCowTreatment(pastureId, prescription, req, diseaseTypeMap, operationUser, userModel.SystemUser)
 
 	if err = s.DB.Transaction(func(tx *gorm.DB) error {

+ 15 - 15
module/backend/goods.go

@@ -61,9 +61,9 @@ func (s *StoreEntry) DrugsCreateOrUpdate(ctx context.Context, req *pasturePb.Sea
 		return xerr.WithStack(err)
 	}
 
-	req.CategoryName = s.DrugCategoryMaps()[req.CategoryId]
-	req.UnitName = s.UnitMap()[req.Unit]
-	req.UsageName = s.DrugUsageMaps()[req.Usage]
+	req.CategoryName = s.DrugCategoryMaps(userModel)[req.CategoryId]
+	req.UnitName = s.UnitMap(userModel)[req.Unit]
+	req.UsageName = s.DrugUsageMaps(userModel)[req.Usage]
 
 	newDrugs := model.NewDrugs(userModel.AppPasture.Id, req, userModel.SystemUser)
 	if req.Id <= 0 {
@@ -98,7 +98,7 @@ func (s *StoreEntry) MedicalEquipmentList(ctx context.Context, req *pasturePb.Se
 		return nil, xerr.WithStack(err)
 	}
 
-	unitMap := s.UnitMap()
+	unitMap := s.UnitMap(userModel)
 	return &pasturePb.SearchMedicalEquipmentResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
@@ -304,8 +304,8 @@ func (s *StoreEntry) NeckRingList(ctx context.Context, req *pasturePb.SearchNeck
 		return nil, xerr.WithStack(err)
 	}
 
-	neckRingIsBindMap := s.NeckRingIsBindMap()
-	neckRingStatusMap := s.NeckRingStatusMap()
+	neckRingIsBindMap := s.NeckRingIsBindMap(userModel)
+	neckRingStatusMap := s.NeckRingStatusMap(userModel)
 	return &pasturePb.SearchNeckRingResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
@@ -430,7 +430,7 @@ func (s *StoreEntry) OutboundApply(ctx context.Context, req *pasturePb.OutboundA
 		})
 		return xerr.Custom(messageId)
 	}
-	unitMap := s.UnitMap()
+	unitMap := s.UnitMap(userModel)
 	if err = s.DB.Transaction(func(tx *gorm.DB) error {
 		if req.Id > 0 {
 			if err = tx.Model(new(model.Outbound)).
@@ -503,8 +503,8 @@ func (s *StoreEntry) OutboundList(ctx context.Context, req *pasturePb.SearchOutb
 		return nil, xerr.WithStack(err)
 	}
 
-	outTypeMap := s.OutTypeMap()
-	auditStatusMap := s.AuditStatusMap()
+	outTypeMap := s.OutTypeMap(userModel)
+	auditStatusMap := s.AuditStatusMap(userModel)
 
 	return &pasturePb.SearchOutboundApplyResponse{
 		Code: http.StatusOK,
@@ -620,8 +620,8 @@ func (s *StoreEntry) OutboundDetail(ctx context.Context, id int64) (*pasturePb.O
 	if err != nil {
 		return nil, xerr.WithStack(err)
 	}
-	outTypeMap := s.OutTypeMap()
-	auditStatusMap := s.AuditStatusMap()
+	outTypeMap := s.OutTypeMap(userModel)
+	auditStatusMap := s.AuditStatusMap(userModel)
 	applicantAtFormat, examineAtFormat := "", ""
 	if outbound.ApplicantAt > 0 {
 		applicantAtFormat = time.Unix(outbound.ApplicantAt, 0).Local().Format(model.LayoutTime)
@@ -630,7 +630,7 @@ func (s *StoreEntry) OutboundDetail(ctx context.Context, id int64) (*pasturePb.O
 		examineAtFormat = time.Unix(outbound.ExamineAt, 0).Local().Format(model.LayoutTime)
 	}
 
-	unitMap := s.UnitMap()
+	unitMap := s.UnitMap(userModel)
 	return &pasturePb.OutboundDetailResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
@@ -723,8 +723,8 @@ func (s *StoreEntry) FrozenSemenList(ctx context.Context, req *pasturePb.FrozenS
 		return nil, xerr.WithStack(err)
 	}
 
-	frozenSemenTypeMap := s.FrozenSemenTypeMap()
-	unitMap := s.UnitMap()
+	frozenSemenTypeMap := s.FrozenSemenTypeMap(userModel)
+	unitMap := s.UnitMap(userModel)
 
 	return &pasturePb.FrozenSemenResponse{
 		Code: http.StatusOK,
@@ -744,7 +744,7 @@ func (s *StoreEntry) FrozenSemenCreate(ctx context.Context, req *pasturePb.Searc
 		return xerr.WithStack(err)
 	}
 
-	req.CowKindName = s.CowKindMap()[req.CowKind]
+	req.CowKindName = s.CowKindMap(userModel)[req.CowKind]
 	if req.Id > 0 {
 		histData := &model.FrozenSemen{}
 		if err = s.DB.Model(new(model.FrozenSemen)).

+ 4 - 4
module/backend/indicators.go

@@ -123,7 +123,7 @@ func (s *StoreEntry) LongTermInfertility(ctx context.Context, req *pasturePb.Lon
 		return nil, xerr.WithStack(err)
 	}
 
-	breedStatusMap := s.CowBreedStatusMap()
+	breedStatusMap := s.CowBreedStatusMap(userModel)
 	return &pasturePb.LongTermInfertilityResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
@@ -219,8 +219,8 @@ func (s *StoreEntry) AlreadySale(ctx context.Context, req *pasturePb.AlreadySale
 		cowMap[v.Id] = v
 	}
 
-	sourceMap := s.CowSourceMap()
-	cowKindMap := s.CowKindMap()
+	sourceMap := s.CowSourceMap(userModel)
+	cowKindMap := s.CowKindMap(userModel)
 	result.Data.Total = int32(len(eventSaleCowList))
 	result.Data.List = model.EventSaleCowSlice(eventSaleCowList).ToPB(eventSaleMap, cowKindMap, cowMap, sourceMap)
 	return result, nil
@@ -272,7 +272,7 @@ func (s *StoreEntry) CanSale(ctx context.Context, req *pasturePb.CanSalesReportR
 	if len(cowList) <= 0 {
 		return result, nil
 	}
-	cowKindMap := s.CowKindMap()
+	cowKindMap := s.CowKindMap(userModel)
 	result.Data.Total = int32(count)
 	result.Data.List = model.CowSlice(cowList).CanSaleToPB(cowKindMap)
 	return result, nil

+ 2 - 2
module/backend/neck_ring_warning.go

@@ -153,8 +153,8 @@ func (s *StoreEntry) NeckRingWarningHealthCowList(ctx context.Context, req *past
 		return nil, xerr.WithStack(err)
 	}
 
-	warningHealthLevelMap := s.WarningHealthLevelMap()
-	healthStatusMap := s.HealthStatusMap()
+	warningHealthLevelMap := s.WarningHealthLevelMap(userModel)
+	healthStatusMap := s.HealthStatusMap(userModel)
 	cowMap := make(map[int64]*model.Cow)
 	eventLogMap := make(map[int64]string)
 	cowIds := make([]int64, 0)

+ 34 - 8
module/backend/pasture.go

@@ -40,7 +40,7 @@ func (s *StoreEntry) SearchBarnList(ctx context.Context, req *pasturePb.SearchNa
 	}
 
 	//configBarnTypeList := make([]*model.ConfigPenType, 0)
-	barnTypeMap := s.BarnTypeMap()
+	barnTypeMap := s.BarnTypeMap(userModel)
 	return &pasturePb.SearchBarnResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
@@ -90,6 +90,11 @@ func (s *StoreEntry) CreateOrUpdateBarn(ctx context.Context, req *pasturePb.Sear
 }
 
 func (s *StoreEntry) SearchBarnTypeList(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)
+	}
+
 	barnTypeList := make([]*model.ConfigPenType, 0)
 	var count int64 = 0
 
@@ -107,7 +112,7 @@ func (s *StoreEntry) SearchBarnTypeList(ctx context.Context, req *pasturePb.Sear
 		Code: http.StatusOK,
 		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
-			List:     model.ConfigBarnTypeSlice(barnTypeList).ToPB(),
+			List:     model.ConfigBarnTypeSlice(barnTypeList).ToPB(userModel),
 			Total:    int32(count),
 			PageSize: pagination.PageSize,
 			Page:     pagination.Page,
@@ -138,6 +143,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 +164,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),
 			Total:    int32(count),
 			PageSize: pagination.PageSize,
 			Page:     pagination.Page,
@@ -186,6 +195,10 @@ func (s *StoreEntry) CreateOrUpdateBreedStatus(ctx context.Context, req *pasture
 }
 
 func (s *StoreEntry) SearchCowKindList(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)
+	}
 	configCowKindList := make([]*model.ConfigCowKind, 0)
 	var count int64 = 0
 
@@ -203,7 +216,7 @@ func (s *StoreEntry) SearchCowKindList(ctx context.Context, req *pasturePb.Searc
 		Code: http.StatusOK,
 		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
-			List:     model.ConfigCowKindSlice(configCowKindList).ToPB(),
+			List:     model.ConfigCowKindSlice(configCowKindList).ToPB(userModel),
 			Total:    int32(count),
 			PageSize: pagination.PageSize,
 			Page:     pagination.Page,
@@ -282,6 +295,11 @@ func (s *StoreEntry) CreateOrUpdateCowStatus(ctx context.Context, req *pasturePb
 }
 
 func (s *StoreEntry) SearchCowTypeList(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)
+	}
+
 	configCowTypeList := make([]*model.ConfigCowType, 0)
 	var count int64 = 0
 
@@ -299,7 +317,7 @@ func (s *StoreEntry) SearchCowTypeList(ctx context.Context, req *pasturePb.Searc
 		Code: http.StatusOK,
 		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
-			List:     model.ConfigCowTypeSlice(configCowTypeList).ToPB(),
+			List:     model.ConfigCowTypeSlice(configCowTypeList).ToPB(userModel),
 			Total:    int32(count),
 			PageSize: pagination.PageSize,
 			Page:     pagination.Page,
@@ -330,6 +348,10 @@ func (s *StoreEntry) CreateOrUpdateCowType(ctx context.Context, req *pasturePb.S
 }
 
 func (s *StoreEntry) SearchTransferPenReasonList(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)
+	}
 	configTransferPenReasonList := make([]*model.ConfigTransferPenReason, 0)
 	var count int64 = 0
 
@@ -338,7 +360,7 @@ func (s *StoreEntry) SearchTransferPenReasonList(ctx context.Context, req *pastu
 		pref.Where("name like ?", fmt.Sprintf("%s%s%s", "%", req.Name, "%"))
 	}
 
-	if err := pref.Order("id desc").Count(&count).Limit(int(pagination.PageSize)).Offset(int(pagination.PageOffset)).
+	if err = pref.Order("id desc").Count(&count).Limit(int(pagination.PageSize)).Offset(int(pagination.PageOffset)).
 		Find(&configTransferPenReasonList).Error; err != nil {
 		return nil, xerr.WithStack(err)
 	}
@@ -347,7 +369,7 @@ func (s *StoreEntry) SearchTransferPenReasonList(ctx context.Context, req *pastu
 		Code: http.StatusOK,
 		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
-			List:     model.ConfigTransferPenReasonSlice(configTransferPenReasonList).ToPB(),
+			List:     model.ConfigTransferPenReasonSlice(configTransferPenReasonList).ToPB(userModel),
 			Total:    int32(count),
 			PageSize: pagination.PageSize,
 			Page:     pagination.Page,
@@ -378,6 +400,10 @@ func (s *StoreEntry) CreateOrUpdateTransferPenReason(ctx context.Context, req *p
 }
 
 func (s *StoreEntry) SearchCowSourceList(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)
+	}
 	configCowSourceList := make([]*model.ConfigCowSource, 0)
 	var count int64 = 0
 
@@ -395,7 +421,7 @@ func (s *StoreEntry) SearchCowSourceList(ctx context.Context, req *pasturePb.Sea
 		Code: http.StatusOK,
 		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
-			List:     model.ConfigCowSourceSlice(configCowSourceList).ToPB(),
+			List:     model.ConfigCowSourceSlice(configCowSourceList).ToPB(userModel),
 			Total:    int32(count),
 			PageSize: pagination.PageSize,
 			Page:     pagination.Page,

+ 14 - 9
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"
@@ -66,8 +68,8 @@ func (s *StoreEntry) SearchSameTimeList(ctx context.Context, req *pasturePb.Sear
 		return nil, xerr.WithStack(err)
 	}
 
-	weekMap := s.WeekMap()
-	sameTimeCowTypeMap := s.SameTimeCowTypeMap()
+	weekMap := s.WeekMap(userModel)
+	sameTimeCowTypeMap := s.SameTimeCowTypeMap(userModel)
 	systemUser, _ := s.SystemUserList(ctx, pastureId)
 	return &pasturePb.SameTimeResponse{
 		Code: http.StatusOK,
@@ -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,
@@ -448,8 +453,8 @@ func (s *StoreEntry) ImmunizationSetList(ctx context.Context, req *pasturePb.Imm
 		return nil, xerr.WithStack(err)
 	}
 
-	CowTypeOptions := s.ImmunizationCowTypeEnumList("")
-	conditionsOptions := s.ImmunizationConditionsEnumList("")
+	CowTypeOptions := s.ImmunizationCowTypeEnumList(userModel, "")
+	conditionsOptions := s.ImmunizationConditionsEnumList(userModel, "")
 	return &pasturePb.SearchImmunizationResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",

+ 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)

+ 5 - 1
module/backend/test_service.go

@@ -128,6 +128,10 @@ func (s *StoreEntry) UpdateCowPen(ctx context.Context, pagination *pasturePb.Pag
 }
 
 func (s *StoreEntry) PastureInit(ctx context.Context, pastureId int64) error {
+	userModel, err := s.GetUserModel(ctx)
+	if err != nil {
+		return xerr.WithStack(err)
+	}
 	if pastureId <= 0 {
 		return xerr.New("pastureId invalid")
 	}
@@ -150,7 +154,7 @@ func (s *StoreEntry) PastureInit(ctx context.Context, pastureId int64) error {
 		return xerr.Customf("该牧场已初始化:%d", pastureId)
 	}
 
-	dataWaringTypeEnumList := s.DataWaringTypeEnumList("all")
+	dataWaringTypeEnumList := s.DataWaringTypeEnumList(userModel, "all")
 	dataWarningList := model.DataWarningInitData(pastureId, dataWaringTypeEnumList)
 
 	if err := s.DB.Transaction(func(tx *gorm.DB) error {

+ 12 - 7
module/backend/work.go

@@ -18,6 +18,11 @@ import (
 )
 
 func (s *StoreEntry) OrderList(ctx context.Context, req *pasturePb.SearchWorkOrderRequest, pagination *pasturePb.PaginationModel) (*pasturePb.SearchWorkOrderResponse, error) {
+	userModel, err := s.GetUserModel(ctx)
+	if err != nil {
+		return nil, xerr.WithStack(err)
+	}
+
 	workOrderList := make([]*model.WorkOrderMaster, 0)
 	var count int64 = 0
 
@@ -51,11 +56,11 @@ func (s *StoreEntry) OrderList(ctx context.Context, req *pasturePb.SearchWorkOrd
 		return nil, xerr.WithStack(err)
 	}
 
-	priorityMap := s.WorkOrderPriorityMap()
-	frequencyMap := s.WorkOrderFrequencyMap()
-	subscribeUnitMap := s.WorkOrderSubUnitMap()
-	weekMap := s.WeekMap()
-	monthMap := s.MonthMap()
+	priorityMap := s.WorkOrderPriorityMap(userModel)
+	frequencyMap := s.WorkOrderFrequencyMap(userModel)
+	subscribeUnitMap := s.WorkOrderSubUnitMap(userModel)
+	weekMap := s.WeekMap(userModel)
+	monthMap := s.MonthMap(userModel)
 	return &pasturePb.SearchWorkOrderResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
@@ -76,7 +81,7 @@ func (s *StoreEntry) OrderCreateOrUpdate(ctx context.Context, req *pasturePb.Wor
 	if err != nil {
 		return xerr.WithStack(err)
 	}
-	workOrderCategoryMap := s.WorkOrderCategoryMap()
+	workOrderCategoryMap := s.WorkOrderCategoryMap(userModel)
 	systemUserList, _ := s.SystemUserList(ctx, userModel.AppPasture.Id)
 	newWorkOrderMaster := model.NewWorkOrderMaster(userModel.AppPasture.Id, req, userModel.SystemUser, systemUserList, workOrderCategoryMap)
 	if req.Id <= 0 {
@@ -278,7 +283,7 @@ func (s *StoreEntry) UserWorkOrderList(ctx context.Context, workOrderStatus past
 		mMap[workOrderMaster.Id] = workOrderMaster
 	}
 
-	priorityMap := s.WorkOrderPriorityMap()
+	priorityMap := s.WorkOrderPriorityMap(userModel)
 
 	return &pasturePb.UserWorkOrderResponse{
 		Code: http.StatusOK,