标准化字段列表,可以是各种输入格式
@param mixed $fields
null/''/0 所有字段
string 一个字段名,或者是用逗号分隔的字段列表
object/array

=><别名>
@return string
191335
public function createFields($fields = null): string
    {
        // 如果未指定字段,则,全部字段
        if (!$fields) {
            return '*';
        }

        $ret = $this->formatFields($fields);

        // 返回逗号分隔的列表
        return implode(',', $ret);
    }
74841
public function values($fields = [])
    {
        $parts = $this->builder()->getQueryParts();
        foreach (['set', 'value'] as $part) {
            if (isset($parts[$part])) {
                $this->builder()->resetQueryPart($part);
            }
        }

        $this->resetBinds('value');

        if (empty($fields)) {
            foreach ($this->model()->fields() as $field) {
                $this->assignValue($field);
            }

            return $this;
        }

        foreach ($fields as $field) {
            $this->assignValue($this->model()->field($field));
        }

        return $this;
    }
1060283
public function getIndexHeaderCells(array $fields = null)
    {
        $stub = $this->getStubContent('index.header.cell.blade', $this->template);
        $fields = $this->getFieldsToDisplay($fields);
        $rows = '';

        foreach ($fields as $field) {
            if ($field->isOnIndexView) {
                $row = $stub;
                $this->replaceFieldTitle($row, $this->getTitle($field->getLabel(), true))
                    ->replaceCommonTemplates($row, $field);
                $rows .= $row . PHP_EOL;
            }
        }

        return $rows;
    }
850880
public function getHeader($field)
    {
       if (!isset($this->headers[$field])) {
           return null;
       }
       
       return is_array($this->headers[$field]) ? implode(',', $this->headers[$field]) : $this->headers[$field];
    }
915269
private function prepareFields(array $fields)
    {
        $preparedFields = [];

        foreach ($fields as $field) {
            $preparedFields[$field->getName()] = $field;
        }

        return $preparedFields;
    }
562226
protected function getField($field)
    {
        if ($this->isFieldSupported($field) && isset($this->fields[ $field ])) {
            return $this->fields[ $field ];
        }

        return null;
    }
733454
public function setFields($fields)
    {
        if (\is_array($fields)) {
            $fields = \implode(',', $fields);
        }

        return $this->setParam('fields', (string) $fields);
    }
573484
private static function handleSelectandi($fields) {
        $i = 0;
        $res = '';
        foreach($fields as $what) {
            $res .= ($i > 0 ? ', ' : '') . self::$_ops->selectandi($what);
            $i++;
        }
        return $res;
    }
1201633
public static function firstOrNull($fields = null)
    {
        static $request;
        if (!$request) {
            $request = Di::getDefault()->getShared('request');
        }

        if (!$request->isAjax()) {
            return null;
        }

        $model = new static();
        return static::get($request->getId($model->getPrimaryKey()));
    }
46351
private function getActionField(array $fields): ?string
    {
        $mapping = [
            'title',
            'name',
            'id',
        ];

        foreach ($mapping as $name) {
            if (in_array($name, $fields)) {
                return $name;
            }
        }

        return null;
    }
388927
public function first($fields = null)
    {
        foreach ($this->queries as $query) {
            if ($r = $query->select($fields)->limit(1)->fetch(true)) {
                return $r[0];
            }
        }

        return null;
    }
358339
public function getIndexBodyCells(array $fields = null)
    {
        $rows = '';
        $stub = $this->getStubContent('index.body.cell.blade', $this->template);
        foreach ($this->getFieldsToDisplay($fields) as $field) {
            if ($field->isOnIndexView) {
                $rows .= $this->getIndexBodyCell($stub, $field) . PHP_EOL;
            }
        }

        return $rows;
    }
1022667
public function getField($field)
    {
        return isset($this->data[$field]) ? $this->data[$field] : null;
    }
1330503
private static function setFields($fields) {
        $fieldsString = '';
        $i = 0;
        foreach($fields as $key => $val) {
            $fieldsString .= ($i > 0 ? ",\n  " : '') . self::$_ops->addBackticks($key) .
                             self::$_ops->operandi($val, true, true);
            $i++;
        }
        return $fieldsString;
    }
130638
public static function cleanFields($fields)
    {
        $fields = parent::cleanFields($fields);
        if (('*' !== array_get($fields, 0)) && !in_array('private', $fields)) {
            $fields[] = 'private';
        }

        return $fields;
    }
1207105
protected static function cleanFields($fields)
    {
        $new = [];
        $fieldList = explode(',', $fields);
        foreach ($fieldList as $f) {
            if (static::ID_FIELD !== trim(strtolower($f))) {
                $new[] = $f;
            }
        }

        return implode(',', $new);
    }
680965
public function parseFields($fields)
    {
        switch (true) {
            case is_array($fields):
                $fields = array_values($fields);
                break;
            case is_string($fields):
                $fields = preg_split('/\s*,\s*/', trim($fields), -1, PREG_SPLIT_NO_EMPTY);
                break;
            default:
                throw new QueryException('', QueryException::SELECT_NOT_PARSE);
                break;
        }
        return $fields ? $fields :[];
    }