mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-03 20:27:56 +08:00
Optimized code
This commit is contained in:
parent
2c041e70e1
commit
d49261fac9
@ -752,22 +752,9 @@ namespace SqlSugar
|
||||
}
|
||||
public int IntoTable(Type TableEntityType)
|
||||
{
|
||||
var entityInfo=this.Context.EntityMaintenance.GetEntityInfo(TableEntityType);
|
||||
var sqlInfo=this.ToSql();
|
||||
var entityInfo = this.Context.EntityMaintenance.GetEntityInfo(TableEntityType);
|
||||
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;
|
||||
return this.Context.Ado.ExecuteCommand(sql, sqlInfo.Value);
|
||||
return IntoTable(TableEntityType, name);
|
||||
}
|
||||
|
||||
public int IntoTable(Type TableEntityType,string TableName)
|
||||
|
Loading…
Reference in New Issue
Block a user