|
@@ -369,19 +369,19 @@ func (e *Entry) SystemBasicCrontab() error {
|
|
pref.Where("breed_status = ?", pasturePb.BreedStatus_Breeding).
|
|
pref.Where("breed_status = ?", pasturePb.BreedStatus_Breeding).
|
|
Where("last_mating_at > ?", 0).
|
|
Where("last_mating_at > ?", 0).
|
|
Where("DATE(FROM_UNIXTIME(last_mating_at)) BETWEEN DATE_SUB(CURDATE(), INTERVAL ? DAY) AND DATE_SUB(CURDATE(), INTERVAL ? DAY)", systemBasic.MaxValue, systemBasic.MinValue).
|
|
Where("DATE(FROM_UNIXTIME(last_mating_at)) BETWEEN DATE_SUB(CURDATE(), INTERVAL ? DAY) AND DATE_SUB(CURDATE(), INTERVAL ? DAY)", systemBasic.MaxValue, systemBasic.MinValue).
|
|
- Where("NOT EXISTS (?)", fmt.Sprintf("SELECT 1 FROM event_pregnant_check WHERE event_pregnant_check.cow_id = cow.id AND event_pregnant_check.status = %d", pasturePb.IsShow_No))
|
|
|
|
|
|
+ Where("NOT EXISTS (SELECT 1 FROM event_pregnant_check WHERE event_pregnant_check.cow_id = cow.id AND event_pregnant_check.status = ?)", pasturePb.IsShow_No)
|
|
case model.PregnantCheckForSecond: // 复检清单 过滤初检空怀的牛只
|
|
case model.PregnantCheckForSecond: // 复检清单 过滤初检空怀的牛只
|
|
pref.Where("breed_status IN (?)", []pasturePb.BreedStatus_Kind{pasturePb.BreedStatus_Pregnant}).
|
|
pref.Where("breed_status IN (?)", []pasturePb.BreedStatus_Kind{pasturePb.BreedStatus_Pregnant}).
|
|
Where("last_mating_at > ?", 0).
|
|
Where("last_mating_at > ?", 0).
|
|
Where("DATE(FROM_UNIXTIME(last_mating_at)) = ?", fmt.Sprintf("DATE_SUB(CURDATE(), INTERVAL %d DAY))", systemBasic.MinValue)).
|
|
Where("DATE(FROM_UNIXTIME(last_mating_at)) = ?", fmt.Sprintf("DATE_SUB(CURDATE(), INTERVAL %d DAY))", systemBasic.MinValue)).
|
|
- Where("NOT EXISTS (?)", fmt.Sprintf("SELECT 1 FROM event_pregnant_check WHERE event_pregnant_check.cow_id = cow.id AND event_pregnant_check.status = %d", pasturePb.IsShow_No))
|
|
|
|
|
|
+ Where("NOT EXISTS (SELECT 1 FROM event_pregnant_check WHERE event_pregnant_check.cow_id = cow.id AND event_pregnant_check.status = ?)", pasturePb.IsShow_No)
|
|
case model.WeaningAge: // 断奶清单
|
|
case model.WeaningAge: // 断奶清单
|
|
pref.Where("day_age = ?", systemBasic.MinValue).
|
|
pref.Where("day_age = ?", systemBasic.MinValue).
|
|
- Where("NOT EXISTS (?)", fmt.Sprintf("SELECT 1 FROM event_weaning WHERE event_weaning.cow_id = cow.id AND event_weaning.status = %d", pasturePb.IsShow_No))
|
|
|
|
|
|
+ Where("NOT EXISTS (SELECT 1 FROM event_weaning WHERE event_weaning.cow_id = cow.id AND event_weaning.status = ?)", pasturePb.IsShow_No)
|
|
case model.PregnancyAge: // 产犊清单
|
|
case model.PregnancyAge: // 产犊清单
|
|
pref.Where("pregnancy_age = ?", systemBasic.MinValue).
|
|
pref.Where("pregnancy_age = ?", systemBasic.MinValue).
|
|
Where("breed_status = ?", pasturePb.BreedStatus_Pregnant).
|
|
Where("breed_status = ?", pasturePb.BreedStatus_Pregnant).
|
|
- Where("NOT EXISTS (?)", fmt.Sprintf("SELECT 1 FROM event_calving WHERE event_calving.cow_id = cow.id AND event_calving.status = %d", pasturePb.IsShow_No))
|
|
|
|
|
|
+ Where("NOT EXISTS (SELECT 1 FROM event_calving WHERE event_calving.cow_id = cow.id AND event_calving.status = ?)", pasturePb.IsShow_No)
|
|
default:
|
|
default:
|
|
continue
|
|
continue
|
|
}
|
|
}
|