diff --git a/src/Luban.Job.Cfg/Source/DataCreators/ExcelStreamDataCreator.cs b/src/Luban.Job.Cfg/Source/DataCreators/ExcelStreamDataCreator.cs index 26acfa1..543e819 100644 --- a/src/Luban.Job.Cfg/Source/DataCreators/ExcelStreamDataCreator.cs +++ b/src/Luban.Job.Cfg/Source/DataCreators/ExcelStreamDataCreator.cs @@ -422,7 +422,8 @@ namespace Luban.Job.Cfg.DataCreators string sep = type.GetTag("sep"); if (string.IsNullOrEmpty(sep) && type.ElementType != null && type.ElementType.Apply(IsNotSepTypeVisitor.Ins)) { - sep = DataUtil.SimpleContainerSep; + // 如果是array,list,set,并且它们的elementType不包含',;|',则自动添加sep分割。这是一个方便策划的优化 + return stream.CreateAutoSepStream(DataUtil.SimpleContainerSep); } if (!string.IsNullOrEmpty(sep) && !stream.TryReadEOF()) diff --git a/src/Luban.Job.Cfg/Source/DataSources/Excel/ExcelStream.cs b/src/Luban.Job.Cfg/Source/DataSources/Excel/ExcelStream.cs index c29b8fd..5422ec7 100644 --- a/src/Luban.Job.Cfg/Source/DataSources/Excel/ExcelStream.cs +++ b/src/Luban.Job.Cfg/Source/DataSources/Excel/ExcelStream.cs @@ -265,10 +265,10 @@ namespace Luban.Job.Cfg.DataSources.Excel int oldIndex = _curIndex; while (_curIndex <= _toIndex) { - var value = _datas[_curIndex++].Value?.ToString(); + var value = _datas[_curIndex++].Value; if (!IsSkip(value)) { - if (value == END_OF_LIST) + if (value is string s && s == END_OF_LIST) { LastReadIndex = _curIndex - 1; return true; @@ -284,5 +284,23 @@ namespace Luban.Job.Cfg.DataSources.Excel _curIndex = oldIndex; return true; } + + internal ExcelStream CreateAutoSepStream(string simpleContainerSep) + { + int startIndex = _curIndex; + while (_curIndex <= _toIndex) + { + var value = _datas[_curIndex++].Value; + if (!IsSkip(value)) + { + if (value is string s && s == END_OF_LIST) + { + break; + } + } + } + LastReadIndex = _curIndex - 1; + return new ExcelStream(_datas, startIndex, LastReadIndex, simpleContainerSep, ""); + } } }