|
|
@ -273,6 +273,38 @@ namespace SqlSugar |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
internal string GetFilters(Type type) |
|
|
|
{ |
|
|
|
var result = ""; |
|
|
|
if (this.Context != null) |
|
|
|
{ |
|
|
|
var db = Context; |
|
|
|
BindingFlags flag = BindingFlags.Instance | BindingFlags.NonPublic; |
|
|
|
var index = 0; |
|
|
|
if (db.QueryFilter.GeFilterList != null) |
|
|
|
{ |
|
|
|
foreach (var item in db.QueryFilter.GeFilterList) |
|
|
|
{ |
|
|
|
PropertyInfo field = item.GetType().GetProperty("exp", flag); |
|
|
|
if (field != null) |
|
|
|
{ |
|
|
|
Type ChildType = item.GetType().GetProperty("type", flag).GetValue(item, null) as Type; |
|
|
|
if (ChildType == type) |
|
|
|
{ |
|
|
|
var entityInfo = db.EntityMaintenance.GetEntityInfo(ChildType); |
|
|
|
var exp = field.GetValue(item, null) as Expression; |
|
|
|
var whereStr = index==0 ? " " : " AND "; |
|
|
|
index++; |
|
|
|
result += (whereStr + GetExpressionValue(exp, ResolveExpressType.WhereSingle).GetString()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public virtual string ToSqlString() |
|
|
|
{ |
|
|
|
string oldOrderBy = this.OrderByValue; |
|
|
|