This commit is contained in:
xl
2024-07-02 21:38:30 +08:00
parent ccbac52a16
commit ed22201bef
2 changed files with 19 additions and 14 deletions
+3 -2
View File
@@ -221,10 +221,11 @@ interface ActiveQueryInterface
public function whereNotBetween(string $column, int|float $start, int|float $end): QueryTrait;
/**
* @param array $column
* @param array|string $column
* @param mixed|null $value
* @return QueryTrait
*/
public function where(array $column): QueryTrait;
public function where(array|string $column, mixed $value = null): QueryTrait;
/**
+16 -12
View File
@@ -27,20 +27,20 @@ use Kiri\Abstracts\Component;
*/
abstract class QueryTrait extends Component implements ActiveQueryInterface, ISqlBuilder
{
public array $where = [];
public array $select = ['*'];
public array $join = [];
public array $order = [];
public int $offset = -1;
public int $limit = -1;
public string $group = '';
public string $from = '';
public string $alias = 't1';
protected array $where = [];
protected array $select = ['*'];
protected array $join = [];
protected array $order = [];
protected int $offset = -1;
protected int $limit = -1;
protected string $group = '';
protected string $from = '';
protected string $alias = 't1';
protected array $filter = [];
protected bool $lock = false;
protected SqlBuilder $builder;
public array $params = [];
private array $_alias = ['t1'];
protected array $params = [];
protected array $_alias = ['t1'];
/**
@@ -623,10 +623,14 @@ abstract class QueryTrait extends Component implements ActiveQueryInterface, ISq
/**
* @param array|string $column
* @param mixed $value
* @return $this
*/
public function where(array|string $column): static
public function where(array|string $column, mixed $value = null): static
{
if (func_num_args() === 2) {
return $this->addArray([$column => $value]);
}
if (is_string($column)) {
return $this->whereRaw($column);
} else {