From ee0f9f2c1193abc72e907f818600a878edbd8e1d Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@qq.com> Date: Thu, 2 Jun 2022 19:00:44 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=20v3.2.620=20-=20v3.2.66?= =?UTF-8?q?1=20=E5=AD=90=E6=9F=A5=E8=AF=A2=20sum/min/max/avg=20=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=8A=A0=20isnull=20=E9=98=B2=E6=AD=A2=E4=B8=BA=20NUL?= =?UTF-8?q?L=20=E6=83=85=E5=86=B5=EF=BC=8C=E6=97=A5=E6=9C=9F=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=A4=84=E7=90=86=E9=94=99=E8=AF=AF=20#1140=201b84a00?= =?UTF-8?q?69679c92ccaff9aa8c33023e4d34262cd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FreeSql/Internal/CommonExpression.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/FreeSql/Internal/CommonExpression.cs b/FreeSql/Internal/CommonExpression.cs index ba077fc1..f1232098 100644 --- a/FreeSql/Internal/CommonExpression.cs +++ b/FreeSql/Internal/CommonExpression.cs @@ -1314,7 +1314,7 @@ namespace FreeSql.Internal var sql4 = fsqlType.GetMethod("ToSql", new Type[] { typeof(string) })?.Invoke(fsql, new object[] { $"{exp3.Method.Name.ToLower()}({fieldSql})" })?.ToString(); asSelectBefores.Clear(); - return _common.IsNull($"({sql4.Replace(" \r\n", " \r\n ")})", 0); + return _common.IsNull($"({sql4.Replace(" \r\n", " \r\n ")})", formatSql(exp3.Method.ReturnType.CreateInstanceGetDefaultValue(), exp3.Method.ReturnType, null, null)); } var sql3 = manySubSelectAggMethod.Invoke(fsql, new object[] { exp3Args0, FieldAliasOptions.AsProperty }) as string; @@ -1374,8 +1374,8 @@ namespace FreeSql.Internal fsqlType.GetMethod("ToSql", new Type[] { typeof(string) })?.Invoke(fsql, new object[] { tosqlField })?.ToString()); if (string.IsNullOrEmpty(sqlSum) == false) return tscClone1.subSelect001._limit <= 0 && tscClone1.subSelect001._skip <= 0 ? - _common.IsNull($"({sqlSum.Replace(" \r\n", " \r\n ")})", 0) : - _common.IsNull($"({sqlSum})", 0); + _common.IsNull($"({sqlSum.Replace(" \r\n", " \r\n ")})", formatSql(exp3.Method.ReturnType.CreateInstanceGetDefaultValue(), exp3.Method.ReturnType, null, null)) : + _common.IsNull($"({sqlSum})", formatSql(exp3.Method.ReturnType.CreateInstanceGetDefaultValue(), exp3.Method.ReturnType, null, null)); break; case "ToList": case "ToOne": @@ -2280,7 +2280,7 @@ namespace FreeSql.Internal commonExp.ReadAnonymousField(select._tables, field, map, ref index, callExp.Arguments[1], null, null, null, null, null, false); var fieldSql = field.Length > 0 ? field.Remove(0, 2).ToString() : null; - e.Result = commonExp._common.IsNull($"({select.ToSql($"{aggregateMethodName}({fieldSql})").Replace(" \r\n", " \r\n ")})", 0); + e.Result = commonExp._common.IsNull($"({select.ToSql($"{aggregateMethodName}({fieldSql})").Replace(" \r\n", " \r\n ")})", commonExp.formatSql(callExp.Method.ReturnType.CreateInstanceGetDefaultValue(), callExp.Method.ReturnType, null, null)); return; } throw throwCallExp($"不支持 {callExp.Arguments.Count}个参数的方法");