From 1f2e7b4aef314e511116cfa8693b5cae2f5cd484 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Fri, 24 Jun 2022 14:54:17 +0800 Subject: [PATCH] Update exp to sql --- .../ResolveItems/BinaryExpressionResolve.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BinaryExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BinaryExpressionResolve.cs index 27180dd7a..aa0cbee0d 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BinaryExpressionResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BinaryExpressionResolve.cs @@ -37,7 +37,7 @@ namespace SqlSugar } else { - InSubGroupBy(expression); + InSubGroupBy(expression, operatorValue=="<>"?"NOT":""); } return; } @@ -123,7 +123,7 @@ namespace SqlSugar } base.Context.Result.Append($" {leftSql} in ({rightSql}) "); } - private void InSubGroupBy(BinaryExpression expression) + private void InSubGroupBy(BinaryExpression expression,string not) { var leftSql = GetNewExpressionValue(expression.Left); var rightExpression = expression.Right as MethodCallExpression; @@ -139,12 +139,12 @@ namespace SqlSugar var p = (leftExp as MemberExpression); this.Context.SingleTableNameSubqueryShortName=p.Expression.ToString(); } - base.Context.Result.Append($" {leftSql} in ({rightSql}) "); + base.Context.Result.Append($" {leftSql} {not} in ({rightSql}) "); } private bool IsGroupSubquery(Expression rightExpression, string operatorValue) { - if (operatorValue != "=") + if (operatorValue != "="&& operatorValue != "<>") { return false; }