This commit is contained in:
as2252258@163.com
2021-03-28 16:52:34 +08:00
parent a0dc55f583
commit 651a507f6e
+3 -3
View File
@@ -177,7 +177,7 @@ class SqlBuilder extends Component
public function one(): string
{
$this->query->limit(0, 1);
if (empty($this->from)) {
if (empty($this->query->from) && !empty($this->query->modelClass)) {
$this->query->from($this->query->getTable());
}
return $this->_prefix(true);
@@ -190,7 +190,7 @@ class SqlBuilder extends Component
*/
public function all(): string
{
if (empty($this->from)) {
if (empty($this->query->from) && !empty($this->query->modelClass)) {
$this->query->from($this->query->getTable());
}
return $this->_prefix(true);
@@ -203,7 +203,7 @@ class SqlBuilder extends Component
*/
public function count(): string
{
if (empty($this->from)) {
if (empty($this->query->from) && !empty($this->query->modelClass)) {
$this->query->from($this->query->getTable());
}
return $this->_prefix();