This commit is contained in:
2021-02-24 19:08:42 +08:00
parent 4dddb833bb
commit b73f6b4f85
3 changed files with 1 additions and 24 deletions
-1
View File
@@ -152,7 +152,6 @@ class ActiveRecord extends BaseActiveRecord
if (empty($condition)) {
$condition = [$this->getPrimary() => $this->getPrimaryValue()];
}
$condition = static::find()->where($condition)->getCondition();
$execute = static::getDb()->createCommand()
->mathematics(self::getTable(), [$action => $columns], $condition);
if ($execute instanceof Command) {
+1 -1
View File
@@ -144,7 +144,7 @@ class Command extends Component
public function mathematics($tableName, $param, $condition): bool|static
{
$change = $this->db->getSchema()->getChange();
$sql = $change->mathematics($tableName, $param, $condition);
$sql = $change->mathematics($tableName, $param, [$condition]);
if ($sql === false) {
return false;
}
-22
View File
@@ -102,7 +102,6 @@ trait Condition
private function conditionMap($condition): string
{
$array = [];
var_dump($condition);
if (is_string($condition) || empty($condition)) {
return $condition;
}
@@ -227,25 +226,4 @@ trait Condition
return ' LIMIT ' . $query->limit;
}
/**
* @param $value
* @param bool $isSearch
* @return int|string
*/
public function valueEncode($value, $isSearch = false): int|string
{
if ($isSearch) {
return $value;
}
if (is_numeric($value)) {
return $value;
} else {
if (!is_null(Json::decode($value))) {
return $value;
}
return '\'' . Str::encode($value) . '\'';
}
}
}