From 03ad0c66c670362fa1af72bc32d1772d922b2180 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Fri, 8 Jul 2022 14:27:54 +0800 Subject: [PATCH] Query decimal to enum bug --- .../SqlSugar/Infrastructure/ContextMethods.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs b/Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs index c794073a9..3fd2ecbe0 100644 --- a/Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs +++ b/Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs @@ -346,6 +346,10 @@ namespace SqlSugar { addValue = Convert.ToInt64(addValue); } + else if (UtilMethods.GetUnderType(item.PropertyType).IsEnum()&& addValue is decimal) + { + addValue = Convert.ToInt64(addValue); + } result.Add(name, addValue); } } @@ -442,6 +446,10 @@ namespace SqlSugar { addItem = addItem.ObjToInt(); } + else if (prop.PropertyType.IsEnum()&&addItem is decimal) + { + addItem = Convert.ToInt64(addItem); + } result.Add(name, addItem); } }