Skip to content

Commit

Permalink
修正聚合查询
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Nov 7, 2024
1 parent 843f985 commit 6d8bcc8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/model/relation/BelongsTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function getRelationCountQuery(?Closure $closure = null, string $aggregat
return $this->query
->whereExp($this->localKey, '=' . $this->parent->getTable(true) . '.' . $this->foreignKey)
->fetchSql()
->$aggregate($this->localKey);
->$aggregate($field);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/model/relation/HasMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function getRelationCountQuery(?Closure $closure = null, string $aggregat
return $this->query->alias($aggregate . '_table')
->whereExp($aggregate . '_table.' . $this->foreignKey, '=' . $this->parent->getTable(true) . '.' . $this->localKey)
->fetchSql()
->$aggregate($this->localKey);
->$aggregate($field);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/model/relation/HasOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function getRelationCountQuery(?Closure $closure = null, string $aggregat
return $this->query
->whereExp($this->foreignKey, '=' . $this->parent->getTable(true) . '.' . $this->localKey)
->fetchSql()
->$aggregate($this->localKey);
->$aggregate($field);
}

/**
Expand Down

0 comments on commit 6d8bcc8

Please sign in to comment.