mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 15:02:47 +08:00
改进Query类的field方法
This commit is contained in:
@@ -85,7 +85,7 @@ abstract class Builder
|
|||||||
if ('*' == $options['field']) {
|
if ('*' == $options['field']) {
|
||||||
$fields = array_keys($bind);
|
$fields = array_keys($bind);
|
||||||
} else {
|
} else {
|
||||||
$fields = is_array($options['field']) ? $options['field'] : array_map('trim', explode(',', $options['field']));
|
$fields = $options['field'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
@@ -567,7 +567,7 @@ abstract class Builder
|
|||||||
if ('*' == $options['field']) {
|
if ('*' == $options['field']) {
|
||||||
$fields = $this->query->getTableInfo($options['table'], 'fields');
|
$fields = $this->query->getTableInfo($options['table'], 'fields');
|
||||||
} else {
|
} else {
|
||||||
$fields = is_array($options['field']) ? $options['field'] : array_map('trim', explode(',', $options['field']));
|
$fields = $options['field'];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($dataSet as &$data) {
|
foreach ($dataSet as &$data) {
|
||||||
|
|||||||
@@ -602,12 +602,12 @@ class Query
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
if (is_string($field)) {
|
if (is_string($field)) {
|
||||||
$field = explode(',', $field);
|
$field = array_map('trim', explode(',', $field));
|
||||||
}
|
}
|
||||||
if (true === $field) {
|
if (true === $field) {
|
||||||
// 获取全部字段
|
// 获取全部字段
|
||||||
$fields = $this->getTableInfo($tableName, 'fields');
|
$fields = $this->getTableInfo($tableName, 'fields');
|
||||||
$field = $fields ?: '*';
|
$field = $fields ?: ['*'];
|
||||||
} elseif ($except) {
|
} elseif ($except) {
|
||||||
// 字段排除
|
// 字段排除
|
||||||
$fields = $this->getTableInfo($tableName, 'fields');
|
$fields = $this->getTableInfo($tableName, 'fields');
|
||||||
|
|||||||
Reference in New Issue
Block a user