From 8b85a29786269563ab7b1d19c2d9d59608b44eda Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Wed, 17 Jan 2024 10:25:24 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91excel?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=96=B9=E6=B3=95=EF=BC=9A=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B=E6=98=AF=E5=B8=83=E5=B0=94?= =?UTF-8?q?=E5=80=BC=E6=97=B6=E7=9A=84=E5=88=A4=E6=96=AD=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Import/ExcelImportBLL.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs index 084b50faf..07a76ded6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs @@ -321,7 +321,7 @@ namespace Learun.Application.Excel throw (new Exception("【" + col.F_ColName + "】 此项数据为必填项")); } } - if (dbType == System.Data.DbType.DateTime || dbType == System.Data.DbType.Decimal) + if (dbType == System.Data.DbType.DateTime || dbType == System.Data.DbType.Decimal || dbType == System.Data.DbType.Boolean) { if (string.IsNullOrEmpty(dr[col.F_ColName].ToString())) { @@ -349,7 +349,21 @@ namespace Learun.Application.Excel dataItemMap.Add(col.F_DataItemCode, dataItemList); } dataItemName = FindDataItemValue(dataItemMap[col.F_DataItemCode], dr[col.F_ColName].ToString(), col.F_ColName, col.F_IsMandatory ?? false); - dp.Add(col.F_Name, dataItemName, dbType); + if (dbType == System.Data.DbType.Boolean) + { + if (string.IsNullOrEmpty(dr[col.F_ColName].ToString()) || string.IsNullOrEmpty(dataItemName)) + { + dp.Add(col.F_Name, null, dbType); + } + else + { + dp.Add(col.F_Name, dataItemName, dbType); + } + } + else + { + dp.Add(col.F_Name, dataItemName, dbType); + } IsOnlyOne(col, sqlonly, dataItemName, entity.F_DbId, dbType); break; case 3://数据表