core/SqlCondition.php
public function search(string $sql, $value, $type = self::WITHOUT_EMPTY, string $format = null)
    {
        switch ($type) {
            case self::WITHOUT_EMPTY:
                if (empty($value)) {
                    return $this;
                }
                break;
            case self::WITHOUT_NULL:
                if ($value === null) {
                    return $this;
                }
                break;
            case self::WITHOUT_ZERO_LENGTH:
                if ($value === null || strval($value) === '') {
                    return $this;
                }
                break;
            case self::WITHOUT_ZERO:
                if ($value === '0' || (is_numeric($value) && floatval($value) == 0) || $value === 0 || $value === false || $value === null) {
                    return $this;
                }
                break;
            default:
                break;
        }
        if ($format !== null) {
            $value = preg_replace('@\{0\}@', $value);
        }
        $maxCount = substr_count($sql, '?');
        if ($maxCount > 1) {
            $temp = [];
            for ($i = 0; $i < $maxCount; $i++) {
                $temp[] = $value;
            }
            $value = $temp;
        }
        $this->where($sql, $value);
        return $this;
    }
public function search(string $sql, $value, $type = self::WITHOUT_EMPTY, string $format = null)
    {
        switch ($type) {
            case self::WITHOUT_EMPTY:
                if (empty($value)) {
                    return $this;
                }
                break;
            case self::WITHOUT_NULL:
                if ($value === null) {
                    return $this;
                }
                break;
            case self::WITHOUT_ZERO_LENGTH:
                if ($value === null || strval($value) === '') {
                    return $this;
                }
                break;
            case self::WITHOUT_ZERO:
                if ($value === '0' || (is_numeric($value) && floatval($value) == 0) || $value === 0 || $value === false || $value === null) {
                    return $this;
                }
                break;
            default:
                break;
        }
        if ($format !== null) {
            $value = preg_replace('@\{0\}@', $value);
        }
        $maxCount = substr_count($sql, '?');
        if ($maxCount > 1) {
            $temp = [];
            for ($i = 0; $i < $maxCount; $i++) {
                $temp[] = $value;
            }
            $value = $temp;
        }
        $this->where($sql, $value);
        return $this;
    }
检索条件,如果值为空 不加入筛选
@param string $sql
@param $value
@param int $type
@param string|null $format
@return $this