From 651a507f6eb98df1c4ac1ce182c39b01404bac82 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Sun, 28 Mar 2021 16:52:34 +0800 Subject: [PATCH] modify --- Database/SqlBuilder.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Database/SqlBuilder.php b/Database/SqlBuilder.php index 702e54e9..bdbe595d 100644 --- a/Database/SqlBuilder.php +++ b/Database/SqlBuilder.php @@ -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();