|
@@ -37,18 +37,25 @@ func (s *StoreEntry) BarnListOptions(ctx context.Context, penType int, isAll str
|
|
}, nil
|
|
}, nil
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *StoreEntry) DiseaseTypeOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error) {
|
|
|
|
|
|
+func (s *StoreEntry) DiseaseTypeOptions(ctx context.Context, isAll string) (*pasturePb.ConfigOptionsListResponse, error) {
|
|
diseaseTypeList := make([]*model.ConfigDiseaseType, 0)
|
|
diseaseTypeList := make([]*model.ConfigDiseaseType, 0)
|
|
pref := s.DB.Table(new(model.ConfigDiseaseType).TableName()).
|
|
pref := s.DB.Table(new(model.ConfigDiseaseType).TableName()).
|
|
Where("is_show =? ", pasturePb.IsShow_Ok)
|
|
Where("is_show =? ", pasturePb.IsShow_Ok)
|
|
-
|
|
|
|
if err := pref.Find(&diseaseTypeList).Error; err != nil {
|
|
if err := pref.Find(&diseaseTypeList).Error; err != nil {
|
|
return nil, xerr.WithStack(err)
|
|
return nil, xerr.WithStack(err)
|
|
}
|
|
}
|
|
|
|
+ diseaseList := make([]*model.Disease, 0)
|
|
|
|
+ if isAll == model.IsAllYes {
|
|
|
|
+ if err := s.DB.Table(new(model.Disease).TableName()).
|
|
|
|
+ Where("is_show =? ", pasturePb.IsShow_Ok).Find(&diseaseList).Error; err != nil {
|
|
|
|
+ return nil, xerr.WithStack(err)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
return &pasturePb.ConfigOptionsListResponse{
|
|
return &pasturePb.ConfigOptionsListResponse{
|
|
Code: http.StatusOK,
|
|
Code: http.StatusOK,
|
|
Message: "ok",
|
|
Message: "ok",
|
|
- Data: model.ConfigDiseaseTypeSlice(diseaseTypeList).ToPB2(),
|
|
|
|
|
|
+ Data: model.ConfigDiseaseTypeSlice(diseaseTypeList).ToPB2(diseaseList),
|
|
}, nil
|
|
}, nil
|
|
}
|
|
}
|
|
|
|
|