| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 | package modelimport 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"                          // 断奶天数	EstrusWaringDays                 = "estrus_waring_days"                   // 发情预警产后天数	DryMilkAge                       = "dry_milk_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    pasturePb.BasicDataCategory_Kind `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(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 []*SystemBasicfunc (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:   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}
 |