|
@@ -111,7 +111,38 @@ func (s *StoreEntry) ImmunisationCowList(ctx context.Context, dateTime string, p
|
|
|
}
|
|
|
|
|
|
func (s *StoreEntry) PGCowList(ctx context.Context, dateTime string, pagination *pasturePb.PaginationModel) (*model.CalendarResponse, error) {
|
|
|
- return nil, nil
|
|
|
+ sameTimeCowDetailList := make([]*model.SameTimeCowDetail, 0)
|
|
|
+ count := int64(0)
|
|
|
+ if err := s.DB.Model(&model.SameTimeCowDetail{}).
|
|
|
+ Where("plan_start_time <= ?", dateTime).
|
|
|
+ Where("status = ?", pasturePb.IsShow_No).
|
|
|
+ Order("id desc").Count(&count).Limit(int(pagination.PageSize)).Offset(int(pagination.PageOffset)).
|
|
|
+ Find(&sameTimeCowDetailList).Error; err != nil {
|
|
|
+ return nil, xerr.WithStack(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ return &model.CalendarResponse{
|
|
|
+ Code: http.StatusOK,
|
|
|
+ Message: "ok",
|
|
|
+ Data: &model.CalendarData{
|
|
|
+ Total: int32(count),
|
|
|
+ Page: pagination.Page,
|
|
|
+ PageSize: pagination.PageSize,
|
|
|
+ Header: model.SameTimeHeader{
|
|
|
+ Id: "id",
|
|
|
+ CowId: "cowId",
|
|
|
+ BreedStatus: "breedStatus",
|
|
|
+ PenName: "penName",
|
|
|
+ Lact: "lact",
|
|
|
+ CalvingAge: "calvingAge",
|
|
|
+ AbortionAge: "abortionAge",
|
|
|
+ DayAge: "dayAge",
|
|
|
+ Status: "status",
|
|
|
+ ExecType: "execType",
|
|
|
+ },
|
|
|
+ List: model.SameTimeCowDetailSlice(sameTimeCowDetailList).ToPB(),
|
|
|
+ },
|
|
|
+ }, nil
|
|
|
}
|
|
|
|
|
|
func (s *StoreEntry) RnGHCowList(ctx context.Context, dateTime string, pagination *pasturePb.PaginationModel) (*model.CalendarResponse, error) {
|