Update exp to sql

This commit is contained in:
sunkaixuan
2019-02-06 21:34:10 +08:00
parent 0aac410c8f
commit e808e7fa44
2 changed files with 7 additions and 1 deletions

View File

@@ -405,7 +405,9 @@ namespace OrmTest.Demo
var test18 = db.Queryable<Student>().Where(it => it.SchoolId.HasValue&&it.SchoolId.HasValue).ToList();
var test19 = db.Queryable<Student>().Where(it => it.SchoolId.HasValue && it.SchoolId.HasValue&&it.SchoolId.HasValue).ToList();
var test20 = db.Queryable<Student>().Where(it => it.SchoolId.HasValue && SqlFunc.IsNullOrEmpty(it.Name)).ToList();
//var test24 = db.Queryable<Student>().Where(it => !it.SchoolId.HasValue && it.SchoolId.HasValue).ToList();
var test21 = db.Queryable<Student>().Where(it => !it.SchoolId.HasValue && it.Name == "").ToList();
var test22 = db.Queryable<Student>().Where(it => !it.SchoolId.HasValue && it.SchoolId.HasValue).ToList();
var test24 = db.Queryable<Student>().Where(it => !(it.Id==1) && it.Name=="").ToList();
}
public static void Page()
{

View File

@@ -49,6 +49,10 @@ namespace SqlSugar
base.Expression = leftExpression;
base.IsLeft = true;
base.Start();
if (leftExpression is UnaryExpression && leftExpression.Type == UtilConstants.BoolType&&!this.Context.Result.Contains(ExpressionConst.ExpressionReplace))
{
this.Context.Result.AppendFormat(" {0} ", ExpressionTool.GetOperator(expression.NodeType));
}
base.IsLeft = false;
base.Expression = rightExpression;
base.Start();