|
@@ -29,8 +29,7 @@ func (s *StoreEntry) CowDiseaseList(ctx context.Context, req *pasturePb.SearchEv
|
|
Joins(fmt.Sprintf("JOIN %s AS b on a.cow_id = b.id", new(model.Cow).TableName())).
|
|
Joins(fmt.Sprintf("JOIN %s AS b on a.cow_id = b.id", new(model.Cow).TableName())).
|
|
Select("a.*,b.pen_name").
|
|
Select("a.*,b.pen_name").
|
|
Where("a.pasture_id = ?", userModel.AppPasture.Id).
|
|
Where("a.pasture_id = ?", userModel.AppPasture.Id).
|
|
- Where("a.health_status != ?", pasturePb.HealthStatus_Curable).
|
|
|
|
- Where("b.admission_status != ?", pasturePb.AdmissionStatus_Admission)
|
|
|
|
|
|
+ Where("b.admission_status = ?", pasturePb.AdmissionStatus_Admission)
|
|
|
|
|
|
if len(req.CowIds) > 0 {
|
|
if len(req.CowIds) > 0 {
|
|
pref.Where("a.cow_id IN ?", req.CowIds)
|
|
pref.Where("a.cow_id IN ?", req.CowIds)
|
|
@@ -57,7 +56,8 @@ func (s *StoreEntry) CowDiseaseList(ctx context.Context, req *pasturePb.SearchEv
|
|
}
|
|
}
|
|
|
|
|
|
if err = pref.Order("a.id DESC").
|
|
if err = pref.Order("a.id DESC").
|
|
- Count(&count).Limit(int(pagination.PageSize)).
|
|
|
|
|
|
+ Count(&count).
|
|
|
|
+ Limit(int(pagination.PageSize)).
|
|
Offset(int(pagination.PageOffset)).
|
|
Offset(int(pagination.PageOffset)).
|
|
Find(&cowDiseaseList).Error; err != nil {
|
|
Find(&cowDiseaseList).Error; err != nil {
|
|
return nil, xerr.WithStack(err)
|
|
return nil, xerr.WithStack(err)
|