Update WhereColumns

This commit is contained in:
sunkaixuan 2025-03-24 15:47:37 +08:00
parent 825127e8e8
commit 54d7743a36
3 changed files with 24 additions and 0 deletions

View File

@ -28,6 +28,14 @@ namespace SqlSugar
var updateTable = string.Format("UPDATE {0} SET", base.GetTableNameStringNoWith);
var setValues = string.Join(",", t.Where(s => !s.IsPrimarykey).Where(s => OldPrimaryKeys == null || !OldPrimaryKeys.Contains(s.DbColumnName)).Select(m => GetOracleUpdateColums(i, m)).ToArray());
var pkList = t.Where(s => s.IsPrimarykey).ToList();
if (this.IsWhereColumns && this.PrimaryKeys?.Any() == true)
{
var whereColumns = pkList.Where(it => this.PrimaryKeys?.Any(p => p.EqualCase(it.PropertyName) || p.EqualCase(it.DbColumnName)) == true).ToList();
if (whereColumns.Any())
{
pkList = whereColumns;
}
}
List<string> whereList = new List<string>();
foreach (var item in pkList)
{

View File

@ -22,6 +22,14 @@ namespace SqlSugar
var updateTable = string.Format("UPDATE {0} SET", base.GetTableNameStringNoWith);
var setValues = string.Join(",", t.Where(s => !s.IsPrimarykey).Where(s => OldPrimaryKeys == null || !OldPrimaryKeys.Contains(s.DbColumnName)).Select(m => GetOracleUpdateColums(m)).ToArray());
var pkList = t.Where(s => s.IsPrimarykey).ToList();
if (this.IsWhereColumns && this.PrimaryKeys?.Any() == true)
{
var whereColumns = pkList.Where(it => this.PrimaryKeys?.Any(p => p.EqualCase(it.PropertyName) || p.EqualCase(it.DbColumnName)) == true).ToList();
if (whereColumns.Any())
{
pkList = whereColumns;
}
}
List<string> whereList = new List<string>();
foreach (var item in pkList)
{

View File

@ -17,6 +17,14 @@ namespace SqlSugar
var updateTable = string.Format("UPDATE {0} SET", base.GetTableNameStringNoWith);
var setValues = string.Join(",", t.Where(s => !s.IsPrimarykey).Where(s=> OldPrimaryKeys==null||!OldPrimaryKeys.Contains(s.DbColumnName)).Select(m => GetOracleUpdateColums(i,m,false)).ToArray());
var pkList = t.Where(s => s.IsPrimarykey).ToList();
if (this.IsWhereColumns&& this.PrimaryKeys?.Any()==true)
{
var whereColumns = pkList.Where(it => this.PrimaryKeys?.Any(p => p.EqualCase(it.PropertyName) || p.EqualCase(it.DbColumnName))==true).ToList();
if (whereColumns.Any())
{
pkList = whereColumns;
}
}
List<string> whereList = new List<string>();
foreach (var item in pkList)
{