This commit is contained in:
2026-06-30 23:11:55 +08:00
parent 0a95e722d6
commit 9fc910f10f
+8 -7
View File
@@ -281,10 +281,11 @@ class SqlBuilder extends Component
*/ */
private function make(): string private function make(): string
{ {
$select = $this->makeCondition(); return join(' ', [
$select .= $this->makeGroup(); $this->makeCondition(),
$select .= $this->makeOrder(); $this->makeGroup(),
return $select; $this->makeOrder(),
]);
} }
/** /**
@@ -310,7 +311,7 @@ class SqlBuilder extends Component
private function makeGroup(): string private function makeGroup(): string
{ {
if ($this->query->group !== '' && $this->query->group !== '0') { if ($this->query->group !== '' && $this->query->group !== '0') {
return ' GROUP BY ' . $this->query->group; return 'GROUP BY ' . $this->query->group;
} }
return ''; return '';
} }
@@ -322,7 +323,7 @@ class SqlBuilder extends Component
private function makeOrder(): string private function makeOrder(): string
{ {
if (count($this->query->order) > 0) { if (count($this->query->order) > 0) {
return ' ORDER BY ' . implode(',', $this->query->order); return 'ORDER BY ' . implode(',', $this->query->order);
} }
return ''; return '';
} }
@@ -337,7 +338,7 @@ class SqlBuilder extends Component
if (empty($condition)) { if (empty($condition)) {
return ''; return '';
} }
return ' WHERE ' . $condition; return 'WHERE ' . $condition;
} }