From 7ba357ad28cdcd1b5a519337cda796f2ec403da2 Mon Sep 17 00:00:00 2001 From: sunkaixuna <610262374@qq.com> Date: Sun, 19 Dec 2021 14:46:22 +0800 Subject: [PATCH] Update Where(List) --- Src/Asp.Net/DmTest/UnitTest/Updateable.cs | 4 ++-- Src/Asp.Net/MySqlTest/UnitTest/Updateable.cs | 6 +++--- Src/Asp.Net/OracleTest/UnitTest/Updateable.cs | 6 +++--- Src/Asp.Net/PgSqlTest/UnitTest/Updateable.cs | 4 ++-- .../Abstract/SqlBuilderProvider/SqlBuilderProvider.cs | 1 + Src/Asp.Net/SqliteTest/UnitTest/Updateable.cs | 6 +++--- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Src/Asp.Net/DmTest/UnitTest/Updateable.cs b/Src/Asp.Net/DmTest/UnitTest/Updateable.cs index 3c2863c90..cd39ffbfe 100644 --- a/Src/Asp.Net/DmTest/UnitTest/Updateable.cs +++ b/Src/Asp.Net/DmTest/UnitTest/Updateable.cs @@ -23,8 +23,8 @@ namespace OrmTest Db.Updateable().SetColumns(it => it.BoolValue == x.BoolValue).Where(it => it.Id == 1).ExecuteCommand(); Db.Updateable().SetColumns(it => new UnitBoolTest() { BoolValue = !x.BoolValue }).Where(it => it.Id == 1).ExecuteCommand(); //Db.Updateable().SetColumns(it => it.BoolValue == !x.BoolValue).Where(it => it.Id == 1).ExecuteCommand(); - Db.Updateable(x).ReSetValue(it => it.BoolValue == it.BoolValue).ExecuteCommand(); - Db.Updateable(x).ReSetValue(it => it.BoolValue == true).ExecuteCommand(); + Db.Updateable(x).ReSetValue(it => it.BoolValue = it.BoolValue).ExecuteCommand(); + Db.Updateable(x).ReSetValue(it => it.BoolValue = true).ExecuteCommand(); //Db.Updateable(x).ReSetValue(it => it.BoolValue == !it.BoolValue).ExecuteCommand(); Db.Updateable(x).UpdateColumns(it =>new { it.BoolValue }) .ExecuteCommand(); diff --git a/Src/Asp.Net/MySqlTest/UnitTest/Updateable.cs b/Src/Asp.Net/MySqlTest/UnitTest/Updateable.cs index 0a99f6da9..2c018bcb7 100644 --- a/Src/Asp.Net/MySqlTest/UnitTest/Updateable.cs +++ b/Src/Asp.Net/MySqlTest/UnitTest/Updateable.cs @@ -23,9 +23,9 @@ namespace OrmTest Db.Updateable().SetColumns(it => it.BoolValue == x.BoolValue).Where(it => it.Id == 1).ExecuteCommand(); Db.Updateable().SetColumns(it => new UnitBoolTest() { BoolValue = !x.BoolValue }).Where(it => it.Id == 1).ExecuteCommand(); Db.Updateable().SetColumns(it => it.BoolValue == !x.BoolValue).Where(it => it.Id == 1).ExecuteCommand(); - Db.Updateable(x).ReSetValue(it => it.BoolValue == it.BoolValue).ExecuteCommand(); - Db.Updateable(x).ReSetValue(it => it.BoolValue == true).ExecuteCommand(); - Db.Updateable(x).ReSetValue(it => it.BoolValue == !it.BoolValue).ExecuteCommand(); + Db.Updateable(x).ReSetValue(it => it.BoolValue = it.BoolValue).ExecuteCommand(); + Db.Updateable(x).ReSetValue(it => it.BoolValue = true).ExecuteCommand(); + Db.Updateable(x).ReSetValue(it => it.BoolValue = !it.BoolValue).ExecuteCommand(); Db.Updateable(x).UpdateColumns(it =>new { it.BoolValue }) .ExecuteCommand(); diff --git a/Src/Asp.Net/OracleTest/UnitTest/Updateable.cs b/Src/Asp.Net/OracleTest/UnitTest/Updateable.cs index 306a36869..de6098300 100644 --- a/Src/Asp.Net/OracleTest/UnitTest/Updateable.cs +++ b/Src/Asp.Net/OracleTest/UnitTest/Updateable.cs @@ -23,9 +23,9 @@ namespace OrmTest Db.Updateable().SetColumns(it => it.BoolValue == x.BoolValue).Where(it => it.Id == 1).ExecuteCommand(); Db.Updateable().SetColumns(it => new UnitBoolTest() { BoolValue = !x.BoolValue }).Where(it => it.Id == 1).ExecuteCommand(); Db.Updateable().SetColumns(it => it.BoolValue == !x.BoolValue).Where(it => it.Id == 1).ExecuteCommand(); - Db.Updateable(x).ReSetValue(it => it.BoolValue == it.BoolValue).ExecuteCommand(); - Db.Updateable(x).ReSetValue(it => it.BoolValue == true).ExecuteCommand(); - Db.Updateable(x).ReSetValue(it => it.BoolValue == !it.BoolValue).ExecuteCommand(); + Db.Updateable(x).ReSetValue(it => it.BoolValue = it.BoolValue).ExecuteCommand(); + Db.Updateable(x).ReSetValue(it => it.BoolValue = true).ExecuteCommand(); + Db.Updateable(x).ReSetValue(it => it.BoolValue = !it.BoolValue).ExecuteCommand(); Db.Updateable(x).UpdateColumns(it =>new { it.BoolValue }) .ExecuteCommand(); diff --git a/Src/Asp.Net/PgSqlTest/UnitTest/Updateable.cs b/Src/Asp.Net/PgSqlTest/UnitTest/Updateable.cs index 3717df64a..9a883ef80 100644 --- a/Src/Asp.Net/PgSqlTest/UnitTest/Updateable.cs +++ b/Src/Asp.Net/PgSqlTest/UnitTest/Updateable.cs @@ -23,8 +23,8 @@ namespace OrmTest Db.Updateable().SetColumns(it => it.BoolValue == x.BoolValue).Where(it => it.Id == 1).ExecuteCommand(); Db.Updateable().SetColumns(it => new UnitBoolTest() { BoolValue = !x.BoolValue }).Where(it => it.Id == 1).ExecuteCommand(); //Db.Updateable().SetColumns(it => it.BoolValue == !x.BoolValue).Where(it => it.Id == 1).ExecuteCommand(); - Db.Updateable(x).ReSetValue(it => it.BoolValue == it.BoolValue).ExecuteCommand(); - Db.Updateable(x).ReSetValue(it => it.BoolValue == true).ExecuteCommand(); + Db.Updateable(x).ReSetValue(it => it.BoolValue = it.BoolValue).ExecuteCommand(); + Db.Updateable(x).ReSetValue(it => it.BoolValue = true).ExecuteCommand(); //Db.Updateable(x).ReSetValue(it => it.BoolValue == !it.BoolValue).ExecuteCommand(); Db.Updateable(x).UpdateColumns(it =>new { it.BoolValue }) .ExecuteCommand(); diff --git a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/SqlBuilderProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/SqlBuilderProvider.cs index 9d234e932..b82d63eb8 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/SqlBuilderProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/SqlBuilderProvider.cs @@ -152,6 +152,7 @@ namespace SqlSugar { parameterName = parameterName.Replace(this.SqlTranslationLeft, "_"); } + item.FieldName = GetTranslationColumnName(item.FieldName); switch (item.ConditionalType) { case ConditionalType.Equal: diff --git a/Src/Asp.Net/SqliteTest/UnitTest/Updateable.cs b/Src/Asp.Net/SqliteTest/UnitTest/Updateable.cs index cf98db6f6..4bff3026f 100644 --- a/Src/Asp.Net/SqliteTest/UnitTest/Updateable.cs +++ b/Src/Asp.Net/SqliteTest/UnitTest/Updateable.cs @@ -23,9 +23,9 @@ namespace OrmTest Db.Updateable().SetColumns(it => it.BoolValue == x.BoolValue).Where(it => it.Id == 1).ExecuteCommand(); Db.Updateable().SetColumns(it => new UnitBoolTest() { BoolValue = !x.BoolValue }).Where(it => it.Id == 1).ExecuteCommand(); Db.Updateable().SetColumns(it => it.BoolValue == !x.BoolValue).Where(it => it.Id == 1).ExecuteCommand(); - Db.Updateable(x).ReSetValue(it => it.BoolValue == it.BoolValue).ExecuteCommand(); - Db.Updateable(x).ReSetValue(it => it.BoolValue == true).ExecuteCommand(); - Db.Updateable(x).ReSetValue(it => it.BoolValue == !it.BoolValue).ExecuteCommand(); + Db.Updateable(x).ReSetValue(it => it.BoolValue = it.BoolValue).ExecuteCommand(); + Db.Updateable(x).ReSetValue(it => it.BoolValue = true).ExecuteCommand(); + Db.Updateable(x).ReSetValue(it => it.BoolValue = !it.BoolValue).ExecuteCommand(); Db.Updateable(x).UpdateColumns(it =>new { it.BoolValue }) .ExecuteCommand();