Update core

This commit is contained in:
sunkaixuna
2022-01-04 13:12:10 +08:00
parent 1c1aaac32c
commit 767f150b62
2 changed files with 17 additions and 0 deletions

View File

@@ -72,5 +72,17 @@ namespace SqlSugar
} }
} }
public void SetShortNameNext(MethodCallExpression exp, string result)
{
if (exp.Arguments.Count>1&&exp.Arguments[1] is LambdaExpression && result.IsContainsIn("+", "-"))
{
var parameters = (exp.Arguments[1] as LambdaExpression).Parameters;
if (parameters != null && parameters.Count > 0)
{
this.Context.CurrentShortName = this.Context.SqlTranslationLeft + parameters[0] + this.Context.SqlTranslationRight;
}
}
}
} }
} }

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
namespace SqlSugar namespace SqlSugar
{ {
@@ -48,6 +49,10 @@ namespace SqlSugar
{ {
Check.Exception(true, ErrorMessage.WhereIFCheck,exp.Arguments[0].ToString()); Check.Exception(true, ErrorMessage.WhereIFCheck,exp.Arguments[0].ToString());
} }
if (Regex.Matches(expression.ToString(), "Subqueryable").Count >= 2)
{
new SubSelect() { Context = this.Context }.SetShortNameNext(exp, "+");
}
var isWhere= Convert.ToBoolean(value); var isWhere= Convert.ToBoolean(value);
if (!Convert.ToBoolean(isWhere)) { if (!Convert.ToBoolean(isWhere)) {
return "WHERE 1=1 "; return "WHERE 1=1 ";