This commit is contained in:
as2252258@163.com
2021-02-28 00:43:59 +08:00
parent 72ddcbb2b7
commit e3f66ea878
+34 -33
View File
@@ -14,45 +14,46 @@ use Snowflake\Core\Str;
abstract class Condition extends BaseObject
{
protected string $column = '';
protected string $opera = '=';
protected string $column = '';
protected string $opera = '=';
/** @var array|mixed */
protected $value;
/** @var array|mixed */
protected $value;
const INT_TYPE = ['bit', 'bool', 'tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'float', 'double', 'decimal', 'timestamp'];
const INT_TYPE = ['bit', 'bool', 'tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'float', 'double', 'decimal', 'timestamp'];
protected array $attributes = [];
protected array $attributes = [];
abstract public function builder();
abstract public function builder();
/**
* @param string $column
*/
public function setColumn(string $column): void
{
$this->column = $column;
}
/**
* @param string $column
*/
public function setColumn(string $column): void
{
$this->column = $column;
}
/**
* @param string $opera
*/
public function setOpera(string $opera): void
{
$this->opera = $opera;
}
/**
* @param string $opera
*/
public function setOpera(string $opera): void
{
$this->opera = $opera;
}
/**
* @param $value
*/
public function setValue($value): void
{
$this->value = is_numeric($value) ? $value : '\'' . $value . '\'';
if (is_array($this->value)) {
$this->value = array_map(function ($value) {
return is_numeric($value) ? $value : '\''.$value.'\'';
}, $this->value);
}
}
/**
* @param $value
*/
public function setValue($value): void
{
if (is_array($value)) {
$this->value = array_map(function ($_value) {
return is_numeric($_value) ? $_value : '\'' . $_value . '\'';
}, $value);
} else {
$this->value = is_numeric($value) ? $value : '\'' . $value . '\'';
}
}
}