mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-22 20:13:41 +08:00
Synchronization code
This commit is contained in:
@@ -74,15 +74,16 @@ namespace SqlSugar
|
|||||||
public IDeleteable<T> AS(string tableName)
|
public IDeleteable<T> AS(string tableName)
|
||||||
{
|
{
|
||||||
if (tableName == null) return this;
|
if (tableName == null) return this;
|
||||||
var entityName = typeof(T).Name;
|
//var entityName = typeof(T).Name;
|
||||||
IsAs = true;
|
//IsAs = true;
|
||||||
OldMappingTableList = this.Context.MappingTables;
|
//OldMappingTableList = this.Context.MappingTables;
|
||||||
this.Context.MappingTables = this.Context.Utilities.TranslateCopy(this.Context.MappingTables);
|
//this.Context.MappingTables = this.Context.Utilities.TranslateCopy(this.Context.MappingTables);
|
||||||
if (this.Context.MappingTables.Any(it => it.EntityName == entityName))
|
//if (this.Context.MappingTables.Any(it => it.EntityName == entityName))
|
||||||
{
|
//{
|
||||||
this.Context.MappingTables.Add(this.Context.MappingTables.First(it => it.EntityName == entityName).DbTableName, tableName);
|
// this.Context.MappingTables.Add(this.Context.MappingTables.First(it => it.EntityName == entityName).DbTableName, tableName);
|
||||||
}
|
//}
|
||||||
this.Context.MappingTables.Add(entityName, tableName);
|
//this.Context.MappingTables.Add(entityName, tableName);
|
||||||
|
this.DeleteBuilder.AsName = tableName;
|
||||||
return this; ;
|
return this; ;
|
||||||
}
|
}
|
||||||
public IDeleteable<T> EnableDiffLogEventIF(bool isEnableDiffLogEvent, object businessData = null)
|
public IDeleteable<T> EnableDiffLogEventIF(bool isEnableDiffLogEvent, object businessData = null)
|
||||||
@@ -628,7 +629,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
List<DiffLogTableInfo> result = new List<DiffLogTableInfo>();
|
List<DiffLogTableInfo> result = new List<DiffLogTableInfo>();
|
||||||
var whereSql = Regex.Replace(sql, ".* WHERE ", "", RegexOptions.Singleline);
|
var whereSql = Regex.Replace(sql, ".* WHERE ", "", RegexOptions.Singleline);
|
||||||
var dt = this.Context.Queryable<T>().Filter(null, true).Where(whereSql).AddParameters(parameters).ToDataTable();
|
var dt = this.Context.Queryable<T>().AS(this.DeleteBuilder.AsName).Filter(null, true).Where(whereSql).AddParameters(parameters).ToDataTable();
|
||||||
if (dt.Rows != null && dt.Rows.Count > 0)
|
if (dt.Rows != null && dt.Rows.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (DataRow row in dt.Rows)
|
foreach (DataRow row in dt.Rows)
|
||||||
|
@@ -19,6 +19,7 @@ namespace SqlSugar
|
|||||||
public StringBuilder sql { get; set; }
|
public StringBuilder sql { get; set; }
|
||||||
public ISqlBuilder Builder { get; set; }
|
public ISqlBuilder Builder { get; set; }
|
||||||
public string TableWithString { get; set; }
|
public string TableWithString { get; set; }
|
||||||
|
public string AsName { get; set; }
|
||||||
public virtual List<string> WhereInfos
|
public virtual List<string> WhereInfos
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -83,6 +84,10 @@ namespace SqlSugar
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
var result = Builder.GetTranslationTableName(EntityInfo.EntityName);
|
var result = Builder.GetTranslationTableName(EntityInfo.EntityName);
|
||||||
|
if (AsName.HasValue())
|
||||||
|
{
|
||||||
|
result = Builder.GetTranslationColumnName(AsName);
|
||||||
|
}
|
||||||
result += UtilConstants.Space;
|
result += UtilConstants.Space;
|
||||||
if (this.TableWithString.HasValue())
|
if (this.TableWithString.HasValue())
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user