mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-22 20:13:41 +08:00
Synchronization code
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)
|
||||
{
|
||||
|
@@ -195,6 +195,10 @@ namespace SqlSugar
|
||||
{
|
||||
this.whereSql = this.whereSql.Replace($" {queryable.QueryBuilder.Builder.GetTranslationColumnName(PropertyShortName)}.", $" {this.ProPertyEntity.DbTableName}_1.");
|
||||
}
|
||||
else if (this.whereSql.Contains($"({queryable.QueryBuilder.Builder.GetTranslationColumnName(PropertyShortName)}."))
|
||||
{
|
||||
this.whereSql = this.whereSql.Replace($"({queryable.QueryBuilder.Builder.GetTranslationColumnName(PropertyShortName)}.", $"({this.ProPertyEntity.DbTableName}_1.");
|
||||
}
|
||||
mapper.Sql = mapper.Sql + " AND " + this.whereSql+")";
|
||||
}
|
||||
if (MethodName == "Any")
|
||||
|
@@ -334,6 +334,10 @@ namespace SqlSugar
|
||||
}
|
||||
public override bool IsAnyColumnRemark(string columnName, string tableName)
|
||||
{
|
||||
if (tableName!=null&&tableName.Contains(".") && tableName.Contains(SqlBuilder.SqlTranslationLeft))
|
||||
{
|
||||
tableName =string.Join(".", tableName.Split('.').Select(it => SqlBuilder.GetNoTranslationColumnName(it)));
|
||||
}
|
||||
if (IsAnySchemaTable(tableName))
|
||||
{
|
||||
var schema = tableName.Split('.').First();
|
||||
@@ -347,6 +351,10 @@ namespace SqlSugar
|
||||
}
|
||||
public override bool DeleteColumnRemark(string columnName, string tableName)
|
||||
{
|
||||
if (tableName != null&&tableName.Contains(".") && tableName.Contains(SqlBuilder.SqlTranslationLeft))
|
||||
{
|
||||
tableName = string.Join(".", tableName.Split('.').Select(it => SqlBuilder.GetNoTranslationColumnName(it)));
|
||||
}
|
||||
if (IsAnySchemaTable(tableName))
|
||||
{
|
||||
var schema = tableName.Split('.').First();
|
||||
@@ -360,6 +368,10 @@ namespace SqlSugar
|
||||
}
|
||||
public override bool AddColumnRemark(string columnName, string tableName, string description)
|
||||
{
|
||||
if (tableName != null&&tableName.Contains(".") && tableName.Contains(SqlBuilder.SqlTranslationLeft))
|
||||
{
|
||||
tableName = string.Join(".", tableName.Split('.').Select(it => SqlBuilder.GetNoTranslationColumnName(it)));
|
||||
}
|
||||
if (IsAnySchemaTable(tableName))
|
||||
{
|
||||
var schema = tableName.Split('.').First();
|
||||
|
@@ -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