diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UCustom09.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom09.cs index f26951c46..a3d352aba 100644 --- a/Src/Asp.Net/SqlServerTest/UnitTest/UCustom09.cs +++ b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom09.cs @@ -19,6 +19,14 @@ namespace OrmTest db.CodeFirst.InitTables(); db.Insertable(new Unitadfaint21() { id = 1 , id2=22 }).ExecuteCommand(); var list2 = db.Queryable().ToList(); + + var list3=db.Queryable() + // .Where(it=>SqlFunc.ToString(it.Id>0?1:0)=="") + .Select(it => new + { + count = SqlFunc.AggregateSum(it.Id < 20 ? 1 : 0) + //count = SqlFunc.AggregateSum(SqlFunc.IIF(b.客户确认状态 < 20, 1, 0)) + }).ToListAsync(); } public class Unitadfaint21 diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs index bb29335be..e62d73238 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs @@ -547,6 +547,10 @@ namespace SqlSugar { parameter.CommonTempData = DateTime.Now.Date; } + else if (item is ConditionalExpression) + { + parameter.CommonTempData = GetNewExpressionValue(item); + } else if (IsDateDate(item)) { parameter.CommonTempData = GetNewExpressionValue(item); @@ -585,7 +589,7 @@ namespace SqlSugar methodCallExpressionArgs.IsMember = false; } } - if (IsDateDate(item) || IsDateValue(item)|| IsDateItemValue(item)) + if (IsDateDate(item) || IsDateValue(item)|| IsDateItemValue(item)||item is ConditionalExpression) { methodCallExpressionArgs.IsMember = true; }