package model import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow" const ( ProactivelyStopBreedingForBackup = "proactively_stop_breeding_for_backup" // 后备牛主动停配 ProactivelyStopBreedingForAdult = "proactively_stop_breeding_for_adult" // 成母牛主动停配 PregnantCheckForFirst = "pregnant_check_for_first" // 初检 PregnantCheckForSecond = "pregnant_check_for_second" // 复检 PregnancyAge = "pregnancy_age" // 怀孕天数 WeaningAge = "weaning_age" // 断奶天数 ValueTypeFixed = 1 // 固定值 ValueTypeRange = 2 // 范围值 SourcePC = "PC" SourceApp = "MINI" ) var PregnantCheckNameKeyMap = map[string]string{ PregnantCheckForFirst: "初检", PregnantCheckForSecond: "复检", } var PregnantCheckNameValueMap = map[int32]string{ 1: "pregnant_check_for_first", 2: "pregnant_check_for_second", } type SystemBasic struct { Id int32 `json:"id"` PastureId int64 `json:"pastureId"` Name string `json:"name"` CategoryName string `json:"categoryName"` CategoryId int32 `json:"categoryId"` MinValue int32 `json:"minValue"` MaxValue int32 `json:"maxValue"` WeekValue pasturePb.Week_Kind `json:"weekValue"` ValueType pasturePb.ValueType_Kind `json:"valueType"` Remarks string `json:"remarks"` IsShow pasturePb.IsShow_Kind `json:"isShow"` OperationId int32 `json:"operationId"` OperationName string `json:"operationName"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } func (s *SystemBasic) TableName() string { return "system_basic" } func (s *SystemBasic) EditUpdate(pastureId int64, minValue, maxValue int32, weekValue pasturePb.Week_Kind, currentUser *SystemUser) { s.MinValue = minValue s.MaxValue = maxValue if s.WeekValue > -1 { s.WeekValue = weekValue } s.OperationId = int32(currentUser.Id) s.OperationName = currentUser.Name } type SystemBasicSlice []*SystemBasic func (s SystemBasicSlice) ToPb() []*pasturePb.BaseDataConfig { res := make([]*pasturePb.BaseDataConfig, len(s)) for i, v := range s { res[i] = &pasturePb.BaseDataConfig{ Id: v.Id, Name: v.Name, CategoryName: v.CategoryName, CategoryId: pasturePb.BasicDataCategory_Kind(v.CategoryId), MinValue: v.MinValue, MaxValue: v.MaxValue, WeekValue: v.WeekValue, ValueType: v.ValueType, Remarks: v.Remarks, CreatedAt: int32(v.CreatedAt), UpdatedAt: int32(v.UpdatedAt), } } return res }