core/SqlCondition.php
public function where($sql = null, $args = null)
    {
        if ($sql === null) {
            return $this;
        }
        if ($sql instanceof SqlCondition) {
            $frame = $sql->getFrame();
            if (!empty($frame['sql'])) {
                if (preg_match('@^(AND|OR)\s+@i', $frame['sql'])) {
                    $frame['sql'] = preg_replace('@^(AND|OR)\s+@i', '', $frame['sql']);
                }
                if ($frame['type'] !== '') {
                    $this->items[] = new SqlItem($frame['type'] . ' (' . $frame['sql'] . ')', $frame['args']);
                } else {
                    $this->items[] = new SqlItem('(' . $frame['sql'] . ')', $frame['args']);
                }
            }
            return $this;
        } elseif (is_array($sql) && $args === null) {
            foreach ($sql as $key => $value) {
                if (strpos($key, '?') === false) {
                    $this->where($key . '=?', $value);
                } else {
                    $this->where($key, $value);
                }
            }
            return $this;
        }
        if (!is_string($sql)) {
            return $this;
        }
        $sql = trim($sql);
        if (!isset($sql[0])) {
            return $this;
        }
        $item = new SqlItem($sql, $args);
        $this->items[] = $item;
        return $this;
    }
public function where($sql = null, $args = null)
    {
        if ($sql === null) {
            return $this;
        }
        if ($sql instanceof SqlCondition) {
            $frame = $sql->getFrame();
            if (!empty($frame['sql'])) {
                if (preg_match('@^(AND|OR)\s+@i', $frame['sql'])) {
                    $frame['sql'] = preg_replace('@^(AND|OR)\s+@i', '', $frame['sql']);
                }
                if ($frame['type'] !== '') {
                    $this->items[] = new SqlItem($frame['type'] . ' (' . $frame['sql'] . ')', $frame['args']);
                } else {
                    $this->items[] = new SqlItem('(' . $frame['sql'] . ')', $frame['args']);
                }
            }
            return $this;
        } elseif (is_array($sql) && $args === null) {
            foreach ($sql as $key => $value) {
                if (strpos($key, '?') === false) {
                    $this->where($key . '=?', $value);
                } else {
                    $this->where($key, $value);
                }
            }
            return $this;
        }
        if (!is_string($sql)) {
            return $this;
        }
        $sql = trim($sql);
        if (!isset($sql[0])) {
            return $this;
        }
        $item = new SqlItem($sql, $args);
        $this->items[] = $item;
        return $this;
    }
查询条件
@param null $sql
@param null $args
@return $this