实现修改批次绑定的猪栏
This commit is contained in:
@@ -163,8 +163,8 @@ func (s *pigFarmService) DeletePen(id uint) error {
|
||||
}
|
||||
|
||||
// 检查猪栏是否关联了活跃批次
|
||||
if pen.PigBatchID != 0 {
|
||||
pigBatch, err := s.repo.GetPigBatchByID(pen.PigBatchID)
|
||||
if *pen.PigBatchID != 0 {
|
||||
pigBatch, err := s.repo.GetPigBatchByID(*pen.PigBatchID)
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user