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