diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs index cd251e050..7ec5acae0 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs @@ -89,7 +89,7 @@ namespace SqlSugar { this.Context.CurrentShortName = selfParameterName; } - else if (this.Context.JoinIndex == 0) + else if (this.Context.JoinIndex == 0 && this.Context.CurrentShortName != selfParameterName.TrimEnd('.')) result = result.Replace(selfParameterName, SubTools.GetSubReplace(this.Context)); return result; } diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs index 75d3a302f..d72756fcf 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs @@ -91,7 +91,7 @@ namespace SqlSugar { this.Context.CurrentShortName= selfParameterName.ObjToString().TrimEnd('.'); } - else if (this.Context.JoinIndex == 0) + else if (this.Context.JoinIndex == 0&& this.Context.CurrentShortName!= selfParameterName.TrimEnd('.')) result = result.Replace(selfParameterName, SubTools.GetSubReplace(this.Context)); if (!string.IsNullOrEmpty(selfParameterName) && this.Context.IsSingle&& this.Context.JoinIndex == 0) {