【调整】调整excel多行记录的判定方式。只有对顶级多行才支持与该记录第一行非多行字段相应单元格值完全相同时,判定该行属于当前记录

main
walon 2021-08-17 13:35:10 +08:00
parent 0ae7744f6e
commit 5482b0a5de
2 changed files with 17 additions and 16 deletions

View File

@ -80,13 +80,14 @@ Luban适合有以下需求的开发者
- python (3.0+)
- 支持主流引擎和平台
- unity + c#
- unity + tolua、xlua
- unity + ILRuntime
- unity + puerts
- unity + [tolua](https://github.com/topameng/tolua)、[xlua](https://github.com/Tencent/xLua)
- unity + [ILRuntime](https://github.com/Ourpalm/ILRuntime)
- unity + [puerts](https://github.com/Tencent/puerts)
- unity + [ET游戏框架](https://github.com/egametang/ET)
- unreal + c++
- unreal + unlua
- unreal + sluaunreal
- unreal + puerts
- unreal + [unlua](https://github.com/Tencent/UnLua)
- unreal + [sluaunreal](https://github.com/Tencent/sluaunreal)
- unreal + [puerts](https://github.com/Tencent/puerts)
- cocos2d-x + lua
- cocos2d-x + js
- 微信小程序平台

View File

@ -38,6 +38,8 @@ namespace Luban.Job.Cfg.DataSources.Excel
public class Title
{
public bool Root { get; set; }
public int FromIndex { get; set; }
public int ToIndex { get; set; }
@ -134,7 +136,7 @@ namespace Luban.Job.Cfg.DataSources.Excel
{
var fieldTitle = title.SubTitles[f.Name];
return Sheet.IsBlankRow(row, fieldTitle.FromIndex, fieldTitle.ToIndex);
}) || (recordRows != null && notMultiRowFields.All(f =>
}) || (title.Root && recordRows != null && notMultiRowFields.All(f =>
{
var fieldTitle = title.SubTitles[f.Name];
return Sheet.IsSameRow(row, recordRows[0], fieldTitle.FromIndex, fieldTitle.ToIndex);
@ -206,7 +208,11 @@ namespace Luban.Job.Cfg.DataSources.Excel
{
if (Titles.TryGetValue(name, out var title))
{
// CheckEmptySinceSecondRow(name, title.FromIndex, title.ToIndex);
// 只有顶级root支持才允许非multi_rows字段与第一行相同时判定为同个记录
if (!this.SelfTitle.Root)
{
CheckEmptySinceSecondRow(name, title.FromIndex, title.ToIndex);
}
var es = new ExcelStream(Rows[0], title.FromIndex, title.ToIndex, sep, namedMode);
return es;
}
@ -216,13 +222,6 @@ namespace Luban.Job.Cfg.DataSources.Excel
}
}
//public NamedRow GetSubTitleNamedRow(string name)
//{
// Title title = this.Titles[name];
// CheckEmptySinceSecondRow(name, title.FromIndex, title.ToIndex);
// return new NamedRow(title, this.Rows[0]);
//}
public NamedRow GetSubTitleNamedRow(string name)
{
Title title = Titles[name];
@ -435,6 +434,7 @@ namespace Luban.Job.Cfg.DataSources.Excel
}
}
const string ROOT_TITLE_NAME = "__<root>__";
private void LoadRemainRows(IExcelDataReader reader, bool headerOnly)
{
@ -486,7 +486,7 @@ namespace Luban.Job.Cfg.DataSources.Excel
throw new Exception($"没有定义字段名行");
}
_rootTitle = new Title() { Name = "_root_", FromIndex = 1, ToIndex = rows.Select(r => r.Count).Max() - 1 };
_rootTitle = new Title() { Root = true, Name = ROOT_TITLE_NAME, FromIndex = 1, ToIndex = rows.Select(r => r.Count).Max() - 1 };
int titleRowNum = 1;
if (reader.MergeCells != null)