mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Synchronization code
This commit is contained in:
parent
61fc1ddf70
commit
1176016e7b
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -159,6 +159,13 @@ namespace SqlSugar
|
||||
List<TResult> ToList<TResult>(Expression<Func<T, TResult>> expression);
|
||||
Task<List<TResult>> ToListAsync<TResult>(Expression<Func<T, TResult>> expression);
|
||||
List<T> ToList();
|
||||
|
||||
bool IntoTable<TableEntityType>();
|
||||
bool IntoTable(Type TableEntityType);
|
||||
bool IntoTable<TableEntityType>(string tableName);
|
||||
bool IntoTable(Type TableEntityType,string tableName);
|
||||
//bool IntoTable(Type TableEntityType, params string[] columnNameList);
|
||||
//bool IntoTable<TableEntityType>(params string[] columnNameList);
|
||||
List<T> SetContext<ParameterT>(Expression<Func<T, bool>> whereExpression, ParameterT parameter);
|
||||
List<T> SetContext<ParameterT>(Expression<Func<T,object>> thisFiled, Expression<Func<object>> mappingFiled, ParameterT parameter);
|
||||
List<T> SetContext<ParameterT>(Expression<Func<T, object>> thisFiled1, Expression<Func<object>> mappingFiled1, Expression<Func<T, object>> thisFiled2, Expression<Func<object>> mappingFiled2, ParameterT parameter);
|
||||
|
Loading…
Reference in New Issue
Block a user