mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-29 01:31:30 +08:00
Update exp to sql
This commit is contained in:
parent
bd381f7953
commit
c2ef56a223
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SqlSugar
|
||||
{
|
||||
@ -48,6 +49,10 @@ namespace SqlSugar
|
||||
{
|
||||
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);
|
||||
if (!Convert.ToBoolean(isWhere)) {
|
||||
return "WHERE 1=1 ";
|
||||
|
Loading…
Reference in New Issue
Block a user