|
@@ -325,7 +325,7 @@ func (s *StoreEntry) BehaviorCurve(ctx context.Context, req *pasturePb.CowBehavi
|
|
|
// 发情数据
|
|
|
estrusList := make([]*model.NeckRingEstrus, 0)
|
|
|
if err = s.DB.Model(new(model.NeckRingEstrus)).
|
|
|
- Select("id,active_level,active_time,is_peak").
|
|
|
+ Select("id,active_level,MAX(active_time) AS active_time,is_peak").
|
|
|
Where("cow_id = ?", cowInfo.Id).
|
|
|
Where("pasture_id = ?", userModel.AppPasture.Id).
|
|
|
Where("active_time BETWEEN ? AND ?", fmt.Sprintf("%s 00:00:00", startDataTime), fmt.Sprintf("%s 23:59:59", endDataTime)).
|