|
@ -737,10 +737,10 @@ namespace SqlSugar |
|
|
{ |
|
|
{ |
|
|
return IntoTable(typeof(TableEntityType)); |
|
|
return IntoTable(typeof(TableEntityType)); |
|
|
} |
|
|
} |
|
|
//public bool IntoTable<TableEntityType>(string[] columnNameList)
|
|
|
public bool IntoTable<TableEntityType>(string TableName) |
|
|
//{
|
|
|
{ |
|
|
// return IntoTable(typeof(TableEntityType), columnNameList);
|
|
|
return IntoTable(typeof(TableEntityType), TableName); |
|
|
//}
|
|
|
} |
|
|
public bool IntoTable(Type TableEntityType) |
|
|
public bool IntoTable(Type TableEntityType) |
|
|
{ |
|
|
{ |
|
|
var entityInfo=this.Context.EntityMaintenance.GetEntityInfo(TableEntityType); |
|
|
var entityInfo=this.Context.EntityMaintenance.GetEntityInfo(TableEntityType); |
|
@ -761,15 +761,27 @@ namespace SqlSugar |
|
|
this.Context.Ado.ExecuteCommand(sql, sqlInfo.Value); |
|
|
this.Context.Ado.ExecuteCommand(sql, sqlInfo.Value); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
//public bool IntoTable(Type TableEntityType,params string [] columnNameList)
|
|
|
|
|
|
//{
|
|
|
public bool IntoTable(Type TableEntityType,string TableName) |
|
|
// var entityInfo = this.Context.EntityMaintenance.GetEntityInfo(TableEntityType);
|
|
|
{ |
|
|
// var columnsString =string.Join(",", columnNameList.Select(it => this.SqlBuilder.GetTranslationColumnName(it)));
|
|
|
//var entityInfo = this.Context.EntityMaintenance.GetEntityInfo(TableEntityType);
|
|
|
// var sqlInfo = this.MergeTable().Select(columnsString).ToSql();
|
|
|
var sqlInfo = this.ToSql(); |
|
|
// var name = this.SqlBuilder.GetTranslationTableName(entityInfo.DbTableName);
|
|
|
var name = this.SqlBuilder.GetTranslationTableName(TableName); |
|
|
// var sql = $" INSERT INTO {name} ({columnsString}) " + sqlInfo.Key;
|
|
|
var columns = ""; |
|
|
// this.Context.Ado.ExecuteCommand(sql, sqlInfo.Value);
|
|
|
if (this.QueryBuilder.GetSelectValue != null && this.QueryBuilder.GetSelectValue.Contains(",")) ; |
|
|
// return true;
|
|
|
{ |
|
|
//}
|
|
|
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; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|