Browse Source

Synchronization code

pull/30/head
sunkaixuan 2 years ago
parent
commit
628b9693cf
  1. 2
      Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs
  2. 3
      Src/Asp.NetCore2/SqlSugar/Abstract/ExecuteNavProvider/InsertNavProviderOneToOne.cs
  3. 3
      Src/Asp.NetCore2/SqlSugar/Abstract/ExecuteNavProvider/UpdateNavOneToOne.cs
  4. 12
      Src/Asp.NetCore2/SqlSugar/Abstract/FilterProvider/FilterProvider.cs
  5. 2
      Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/NavigatManager.cs
  6. 8
      Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Subquerable.cs
  7. 2
      Src/Asp.NetCore2/SqlSugar/Realization/Dm/SqlBuilder/DmUpdateBuilder.cs
  8. 2
      Src/Asp.NetCore2/SqlSugar/SpliteTable/SplitTableContext.cs

2
Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs

@ -436,7 +436,7 @@ namespace SqlSugar
var lamResult = DeleteBuilder.GetExpressionValue(inField, ResolveExpressType.FieldSingle);
var fieldName = lamResult.GetResultString();
tempPrimaryKeys = new List<string>() { fieldName };
var result = In(primaryKeyValue);;
var result = In(primaryKeyValue);
tempPrimaryKeys = null;
return this;
}

3
Src/Asp.NetCore2/SqlSugar/Abstract/ExecuteNavProvider/InsertNavProviderOneToOne.cs

@ -16,7 +16,8 @@ namespace SqlSugar
var parentPkColumn = parentEntity.Columns.FirstOrDefault(it => it.IsPrimarykey);
var thisEntity = this._Context.EntityMaintenance.GetEntityInfo<TChild>();
EntityColumnInfo thisPkColumn = GetPkColumnByNav(thisEntity, nav);
Check.Exception(thisPkColumn == null, $" Navigate {parentEntity.EntityName} : {name} is error ", $"导航实体 {parentEntity.EntityName} 属性 {name} 配置错误");
Check.ExceptionEasy(thisPkColumn == null, $" Navigate {parentEntity.EntityName} : {name} is error ", $"导航实体 {parentEntity.EntityName} 属性 {name} 配置错误");
Check.ExceptionEasy(nav.Navigat.WhereSql.HasValue(), $" {name} Navigate(NavType,WhereSql) no support insert ", $"导航一对一 {name} 配置了 Sql变量 不支持插入");
List<TChild> childList = new List<TChild>();
foreach (var parent in parentList)
{

3
Src/Asp.NetCore2/SqlSugar/Abstract/ExecuteNavProvider/UpdateNavOneToOne.cs

@ -17,7 +17,8 @@ namespace SqlSugar
var parentPkColumn = parentEntity.Columns.FirstOrDefault(it => it.IsPrimarykey);
var thisEntity = this._Context.EntityMaintenance.GetEntityInfo<TChild>();
EntityColumnInfo thisPkColumn = GetPkColumnByNav(thisEntity, nav);
Check.Exception(thisPkColumn == null, $" Navigate {parentEntity.EntityName} : {name} is error ", $"导航实体 {parentEntity.EntityName} 属性 {name} 配置错误");
Check.ExceptionEasy(thisPkColumn == null, $" Navigate {parentEntity.EntityName} : {name} is error ", $"导航实体 {parentEntity.EntityName} 属性 {name} 配置错误");
Check.ExceptionEasy(nav.Navigat.WhereSql.HasValue(), $" {name} Navigate(NavType,WhereSql) no support update ", $"导航一对一 {name} 配置了 Sql变量 不支持更新");
List<TChild> childList = new List<TChild>();
foreach (var parent in parentList)
{

12
Src/Asp.NetCore2/SqlSugar/Abstract/FilterProvider/FilterProvider.cs

@ -65,31 +65,35 @@ namespace SqlSugar
}
}
public void AddTableFilter<T>(Expression<Func<T,bool>> expression, FilterJoinPosition filterJoinType = FilterJoinPosition.On) where T : class,new()
public QueryFilterProvider AddTableFilter<T>(Expression<Func<T,bool>> expression, FilterJoinPosition filterJoinType = FilterJoinPosition.On) where T : class,new()
{
var isOn = filterJoinType == FilterJoinPosition.On;
var tableFilter = new TableFilterItem<T>(expression, isOn);
this.Add(tableFilter);
return this;
}
public void AddTableFilterIF<T>(bool isAppendFilter,Expression<Func<T, bool>> expression, FilterJoinPosition filterJoinType = FilterJoinPosition.On) where T : class, new()
public QueryFilterProvider AddTableFilterIF<T>(bool isAppendFilter,Expression<Func<T, bool>> expression, FilterJoinPosition filterJoinType = FilterJoinPosition.On) where T : class, new()
{
if (isAppendFilter)
{
AddTableFilter(expression, filterJoinType);
}
return this;
}
public void AddTableFilter(Type type,Expression expression, FilterJoinPosition filterJoinType = FilterJoinPosition.On)
public QueryFilterProvider AddTableFilter(Type type,Expression expression, FilterJoinPosition filterJoinType = FilterJoinPosition.On)
{
var isOn = filterJoinType == FilterJoinPosition.On;
this.Add(new TableFilterItem<object>(type, expression, isOn));
return this;
}
public void AddTableFilterIF(bool isAppendFilter, Type type, Expression expression, FilterJoinPosition posType = FilterJoinPosition.On)
public QueryFilterProvider AddTableFilterIF(bool isAppendFilter, Type type, Expression expression, FilterJoinPosition posType = FilterJoinPosition.On)
{
if (isAppendFilter)
{
AddTableFilter(type, expression, posType);
}
return this;
}
public enum FilterJoinPosition
{

2
Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/NavigatManager.cs

@ -538,7 +538,7 @@ namespace SqlSugar
SqlInfo result = new SqlInfo();
result.Parameters = new List<SugarParameter>();
var isList = false;
int parameterIndex = 0;
int parameterIndex = 100;
foreach (var item in _ListCallFunc)
{
var method = item as MethodCallExpression;

8
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Subquerable.cs

@ -71,7 +71,7 @@ namespace SqlSugar
return this;
}
public TResult Select<TResult>(Func<T, TResult> expression) where TResult :struct
public TResult Select<TResult>(Func<T, TResult> expression)
{
return default(TResult);
}
@ -89,7 +89,7 @@ namespace SqlSugar
return default(string);
}
public TResult Max<TResult>(Func<T, TResult> expression) where TResult : struct
public TResult Max<TResult>(Func<T, TResult> expression)
{
return default(TResult);
}
@ -106,7 +106,7 @@ namespace SqlSugar
{
return default(string);
}
public TResult Min<TResult>(Func<T, TResult> expression) where TResult : struct
public TResult Min<TResult>(Func<T, TResult> expression)
{
return default(TResult);
}
@ -125,7 +125,7 @@ namespace SqlSugar
{
return default(int);
}
public TResult Sum<TResult>(Func<T, TResult> expression) where TResult : struct
public TResult Sum<TResult>(Func<T, TResult> expression)
{
return default(TResult);
}

2
Src/Asp.NetCore2/SqlSugar/Realization/Dm/SqlBuilder/DmUpdateBuilder.cs

@ -28,7 +28,7 @@ namespace SqlSugar
return string.Format("{0} {1} WHERE {2};", updateTable, setValues, string.Join("AND", whereList));
}).ToArray()));
var result= sb.ToString();
if (result == "\r\n")
if (groupList.Count==0)
{
return null;
}

2
Src/Asp.NetCore2/SqlSugar/SpliteTable/SplitTableContext.cs

@ -26,7 +26,7 @@ namespace SqlSugar
}
public string[] GetTableNames(SplitType splitType)
{
List<string> result = new List<string>();;
List<string> result = new List<string>();
foreach (var item in Items)
{
result.Add(Helper.GetTableName(Helper.GetValue(splitType, item)));

Loading…
Cancel
Save