mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 20:38:16 +08:00
- 优化 Lambda bool 解析;#1219
This commit is contained in:
@ -754,7 +754,16 @@ namespace FreeSql.Internal
|
||||
return ExpressionLambdaToSql(Expression.Call(leftExp, MethodDateTimeSubtractTimeSpan, rightExp), tsc);
|
||||
}
|
||||
if (oper == "OR")
|
||||
return $"({GetBoolString(ExpressionLambdaToSql(leftExp, tsc))} {oper} {GetBoolString(ExpressionLambdaToSql(rightExp, tsc))})";
|
||||
{
|
||||
var leftBool = ExpressionLambdaToSql(leftExp, tsc);
|
||||
if (SearchColumnByField(tsc._tables, tsc.currentTable, leftBool) != null) leftBool = $"{leftBool} = {formatSql(true, null, null, null)}";
|
||||
else leftBool = GetBoolString(leftBool);
|
||||
|
||||
var rightBool = ExpressionLambdaToSql(rightExp, tsc);
|
||||
if (SearchColumnByField(tsc._tables, tsc.currentTable, rightBool) != null) rightBool = $"{rightBool} = {formatSql(true, null, null, null)}";
|
||||
else rightBool = GetBoolString(rightBool);
|
||||
return $"({leftBool} {oper} {rightBool})";
|
||||
}
|
||||
return $"({ExpressionLambdaToSql(leftExp, tsc)} {oper} {ExpressionLambdaToSql(rightExp, tsc)})";
|
||||
case "=":
|
||||
case "<>":
|
||||
|
Reference in New Issue
Block a user