mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-04 04:37:58 +08:00
Exp to sql
This commit is contained in:
parent
0ce74d5a4a
commit
92f6a6feff
@ -147,6 +147,13 @@ namespace SqlSugar
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (this.Result.Length > 0 && this.Result[this.Result.Length - 1] == ',')
|
||||
{
|
||||
if (parameter?.ToString()?.StartsWith(" AS ") ==true && parameter?.ToString()?.EndsWith(" ,")==true)
|
||||
{
|
||||
this.Result.Length--; // 直接删掉最后一个字符
|
||||
}
|
||||
}
|
||||
this.Result.Append(parameter);
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ namespace SqlSugar
|
||||
var value = ExpressionTool.DynamicInvoke(express.Test);
|
||||
if (value is bool boolValue)
|
||||
{
|
||||
args[0] = boolValue ? UtilConstants.ExpTrue :UtilConstants.ExpFalse;
|
||||
// 根据结果选择分支
|
||||
var next = boolValue ? express.IfTrue : express.IfFalse;
|
||||
args[1] = next;
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
namespace SqlSugar
|
||||
{
|
||||
@ -77,5 +78,8 @@ namespace SqlSugar
|
||||
"Millisecond",
|
||||
"Date"
|
||||
};
|
||||
|
||||
public static ConstantExpression ExpTrue = Expression.Constant(true);
|
||||
public static ConstantExpression ExpFalse = Expression.Constant(false);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user