Browse Source

Update core

pull/12/head
sunkaixuna 3 years ago
parent
commit
7f3cb6eb7a
  1. 19
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs
  2. 7
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Entities/SqlFilter.cs
  3. 4
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/SqlSugar.csproj

19
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs

@ -384,7 +384,24 @@ namespace SqlSugar
sql = GetSql(exp, isSingle);
sql = sql.Replace(itName, shortName);
}
WhereInfos.Add(sql);
if (item.IsJoinQuery == false||isMain||isSingle|| isEasyJoin)
{
WhereInfos.Add(sql);
}
else
{
foreach (var joinInfo in this.JoinQueryInfos)
{
if (joinInfo.TableName.EqualCase(entityInfo.EntityName)|| joinInfo.TableName.EqualCase(entityInfo.DbTableName))
{
if (sql.StartsWith(" WHERE "))
{
sql = Regex.Replace(sql, $"^ WHERE ", " AND ");
}
joinInfo.JoinWhere=joinInfo.JoinWhere + sql;
}
}
}
}
private string GetSql(Expression exp, bool isSingle)

7
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Entities/SqlFilter.cs

@ -27,16 +27,19 @@ namespace SqlSugar
}
private Expression exp { get; set; }
private Type type { get; set; }
public TableFilterItem(Expression<Func<T,bool>> expression)
public TableFilterItem(Expression<Func<T,bool>> expression,bool isJoinOn=false)
{
exp = expression;
type = typeof(T);
base.IsJoinQuery = isJoinOn;
this.IsJoinQuery = isJoinOn;
}
public TableFilterItem(Type entityType,Expression expression)
public TableFilterItem(Type entityType,Expression expression, bool isJoinOn=false)
{
exp = expression;
type = entityType;
IsJoinQuery = isJoinOn;
}
private new string FilterName { get; set; }

4
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/SqlSugar.csproj

@ -33,4 +33,8 @@
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Abstract\QueryableProvider\QueryableProvider\" />
</ItemGroup>
</Project>

Loading…
Cancel
Save