|
|
@ -732,5 +732,56 @@ namespace SqlSugar |
|
|
|
var result = ((this.Context.DbFirst) as DbFirstProvider).GetClassString(columns, ref className); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public bool IntoTable<TableEntityType>() |
|
|
|
{ |
|
|
|
return IntoTable(typeof(TableEntityType)); |
|
|
|
} |
|
|
|
public bool IntoTable<TableEntityType>(string TableName) |
|
|
|
{ |
|
|
|
return IntoTable(typeof(TableEntityType), TableName); |
|
|
|
} |
|
|
|
public bool IntoTable(Type TableEntityType) |
|
|
|
{ |
|
|
|
var entityInfo=this.Context.EntityMaintenance.GetEntityInfo(TableEntityType); |
|
|
|
var sqlInfo=this.ToSql(); |
|
|
|
var name = this.SqlBuilder.GetTranslationTableName(entityInfo.DbTableName); |
|
|
|
var columns = ""; |
|
|
|
if (this.QueryBuilder.GetSelectValue != null && this.QueryBuilder.GetSelectValue.Contains(",")) ; |
|
|
|
{ |
|
|
|
columns = "("; |
|
|
|
foreach (var item in this.QueryBuilder.GetSelectValue.Split(',')) |
|
|
|
{ |
|
|
|
var column = Regex.Split(item,"AS").Last().Trim(); |
|
|
|
columns += $"{column},"; |
|
|
|
} |
|
|
|
columns = columns.TrimEnd(',') + ")"; |
|
|
|
} |
|
|
|
var sql= $" INSERT INTO {name} {columns} " + sqlInfo.Key; |
|
|
|
this.Context.Ado.ExecuteCommand(sql, sqlInfo.Value); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
public bool IntoTable(Type TableEntityType,string TableName) |
|
|
|
{ |
|
|
|
//var entityInfo = this.Context.EntityMaintenance.GetEntityInfo(TableEntityType);
|
|
|
|
var sqlInfo = this.ToSql(); |
|
|
|
var name = this.SqlBuilder.GetTranslationTableName(TableName); |
|
|
|
var columns = ""; |
|
|
|
if (this.QueryBuilder.GetSelectValue != null && this.QueryBuilder.GetSelectValue.Contains(",")) ; |
|
|
|
{ |
|
|
|
columns = "("; |
|
|
|
foreach (var item in this.QueryBuilder.GetSelectValue.Split(',')) |
|
|
|
{ |
|
|
|
var column = Regex.Split(item, "AS").Last().Trim(); |
|
|
|
columns += $"{column},"; |
|
|
|
} |
|
|
|
columns = columns.TrimEnd(',') + ")"; |
|
|
|
} |
|
|
|
var sql = $" INSERT INTO {name} {columns} " + sqlInfo.Key; |
|
|
|
this.Context.Ado.ExecuteCommand(sql, sqlInfo.Value); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|