mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-22 20:13:41 +08:00
Update Discrimator Join
This commit is contained in:
@@ -528,7 +528,7 @@ namespace SqlSugar
|
||||
}
|
||||
public ISugarQueryable<T> Where(string fieldName, string conditionalType, object fieldValue)
|
||||
{
|
||||
string parameterName = fieldName+ this.QueryBuilder.WhereIndex;
|
||||
string parameterName = fieldName.Replace(".","_")+ this.QueryBuilder.WhereIndex;
|
||||
var whereSql = this.SqlBuilder.GetWhere(fieldName, conditionalType, this.QueryBuilder.WhereIndex);
|
||||
this.Where(whereSql);
|
||||
this.QueryBuilder.WhereIndex++;
|
||||
|
@@ -113,7 +113,7 @@ namespace SqlSugar
|
||||
|
||||
public string GetWhere(string fieldName,string conditionalType,int? parameterIndex=null)
|
||||
{
|
||||
return string.Format(" {0} {1} {2}{3} ",this.GetTranslationColumnName(fieldName),conditionalType,this.SqlParameterKeyWord,fieldName+ parameterIndex);
|
||||
return string.Format(" {0} {1} {2}{3} ",this.GetTranslationColumnName(fieldName),conditionalType,this.SqlParameterKeyWord,fieldName.Replace(".","_")+ parameterIndex);
|
||||
}
|
||||
public virtual string GetUnionAllSql(List<string> sqlList)
|
||||
{
|
||||
|
@@ -353,6 +353,7 @@ namespace SqlSugar
|
||||
{
|
||||
queryable.SqlBuilder.QueryBuilder.Parameters.AddRange(paramters);
|
||||
}
|
||||
UtilMethods.AddDiscrimator(typeof(T), queryable, queryable.QueryBuilder.TableShortName + ".");
|
||||
}
|
||||
protected void CreateEasyQueryJoin<T>(Expression joinExpression, Type[] types, ISugarQueryable<T> queryable)
|
||||
{
|
||||
|
@@ -1342,7 +1342,7 @@ namespace SqlSugar
|
||||
}
|
||||
|
||||
|
||||
internal static void AddDiscrimator<T>(Type type, ISugarQueryable<T> queryable)
|
||||
internal static void AddDiscrimator<T>(Type type, ISugarQueryable<T> queryable,string shortName=null)
|
||||
{
|
||||
var entityInfo = queryable.Context?.EntityMaintenance?.GetEntityInfoWithAttr(type);
|
||||
if (entityInfo!=null&&entityInfo.Discrimator.HasValue())
|
||||
@@ -1353,7 +1353,7 @@ namespace SqlSugar
|
||||
{
|
||||
var name = disItem.Split(':').First();
|
||||
var value = disItem.Split(':').Last();
|
||||
queryable.Where(name, "=", value);
|
||||
queryable.Where(shortName+name, "=", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user