【修复】修复 convert_xlsx生成的数据的一些格式错误
parent
d292f12070
commit
7df7c5d866
|
|
@ -2,6 +2,7 @@
|
|||
using Luban.Job.Cfg.DataSources.Excel;
|
||||
using Luban.Job.Cfg.DataVisitors;
|
||||
using Luban.Job.Cfg.Defs;
|
||||
using Luban.Job.Common.Types;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
@ -125,7 +126,6 @@ namespace Luban.Job.Cfg.DataConverts
|
|||
|
||||
public int Accept(DBean type, Title x)
|
||||
{
|
||||
|
||||
if (x.SubTitleList.Count > 0)
|
||||
{
|
||||
if (type.Type.IsAbstractType)
|
||||
|
|
@ -179,6 +179,10 @@ namespace Luban.Job.Cfg.DataConverts
|
|||
// (_cells[_startRowIndex, fieldTitle.FromIndex] as Range).Value = data.Apply(ToExcelStringVisitor.Ins, fieldTitle.Sep);
|
||||
//}
|
||||
}
|
||||
else if (field.CType is TText)
|
||||
{
|
||||
SetTitleValue(fieldTitle, $"null{fieldTitle.Sep}null");
|
||||
}
|
||||
}
|
||||
}
|
||||
return rowCount;
|
||||
|
|
|
|||
|
|
@ -157,9 +157,12 @@ namespace Luban.Job.Cfg.DataConverts
|
|||
{
|
||||
title.FromIndex = column;
|
||||
title.ToIndex = column;
|
||||
if (!title.Tags.ContainsKey("sep"))
|
||||
if (type.Bean is DefBean dbean && string.IsNullOrWhiteSpace(dbean.Sep))
|
||||
{
|
||||
title.Tags.Add("sep", "|");
|
||||
if (!title.Tags.ContainsKey("sep"))
|
||||
{
|
||||
title.Tags.Add("sep", "|");
|
||||
}
|
||||
}
|
||||
|
||||
//int lastColumn = column - 1;
|
||||
|
|
|
|||
|
|
@ -93,11 +93,19 @@ namespace Luban.Job.Cfg.DataConverts
|
|||
|
||||
public string Accept(DBean type, string sep)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(type.Type.Sep))
|
||||
{
|
||||
sep = type.Type.Sep;
|
||||
}
|
||||
var sb = new List<string>();
|
||||
if (type.Type.IsAbstractType)
|
||||
{
|
||||
sb.Add(type.ImplType != null ? type.ImplType.Name : DefBean.BEAN_NULL_STR);
|
||||
}
|
||||
else if (type.TType.IsNullable)
|
||||
{
|
||||
sb.Add(type.ImplType != null ? type.ImplType.Name : DefBean.BEAN_NULL_STR);
|
||||
}
|
||||
|
||||
foreach (var field in type.Fields)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ namespace Luban.Job.Cfg.DataCreators
|
|||
{
|
||||
throw new InvalidExcelDataException($"type:{fullType} 不是bean类型");
|
||||
}
|
||||
return new DBean(originBean, implType, CreateBeanFields(implType, x));
|
||||
return new DBean(type, implType, CreateBeanFields(implType, x));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -367,7 +367,7 @@ namespace Luban.Job.Cfg.DataCreators
|
|||
throw new Exception($"type:'{type.Bean.FullName}' 可空标识:'{subType}' 不合法(只能为{DefBean.BEAN_NOT_NULL_STR}或{DefBean.BEAN_NULL_STR}或{originBean.Name})");
|
||||
}
|
||||
}
|
||||
return new DBean(originBean, originBean, CreateBeanFields(originBean, x));
|
||||
return new DBean(type, originBean, CreateBeanFields(originBean, x));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ namespace Luban.Job.Cfg.DataCreators
|
|||
throw new Exception($"结构:'{implBean.FullName}' 字段:'{f.Name}' 缺失");
|
||||
}
|
||||
}
|
||||
return new DBean(bean, implBean, fields);
|
||||
return new DBean(type, implBean, fields);
|
||||
}
|
||||
|
||||
private List<DType> ReadList(TType type, JsonElement e, DefAssembly ass)
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ namespace Luban.Job.Cfg.DataCreators
|
|||
throw new Exception($"结构:{implBean.FullName} 字段:{f.Name} 缺失");
|
||||
}
|
||||
}
|
||||
return new DBean(bean, implBean, fields);
|
||||
return new DBean(type, implBean, fields);
|
||||
}
|
||||
|
||||
private List<DType> ReadList(TType type, LuaTable e, DefAssembly ass)
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ namespace Luban.Job.Cfg.DataCreators
|
|||
{
|
||||
throw new Exception($"type:'{fullType}' 不是 bean 类型");
|
||||
}
|
||||
return new DBean(originBean, implType, CreateBeanFields(implType, sheet, row));
|
||||
return new DBean(type, implType, CreateBeanFields(implType, sheet, row));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -362,7 +362,7 @@ namespace Luban.Job.Cfg.DataCreators
|
|||
}
|
||||
}
|
||||
|
||||
return new DBean(originBean, originBean, CreateBeanFields(originBean, sheet, row));
|
||||
return new DBean(type, originBean, CreateBeanFields(originBean, sheet, row));
|
||||
}
|
||||
}
|
||||
else if (row.Elements != null)
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ namespace Luban.Job.Cfg.DataCreators
|
|||
}
|
||||
|
||||
}
|
||||
return new DBean(bean, implBean, fields);
|
||||
return new DBean(type, implBean, fields);
|
||||
}
|
||||
|
||||
private List<DType> ReadList(TType type, XElement x, DefAssembly ass)
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ namespace Luban.Job.Cfg.DataCreators
|
|||
}
|
||||
|
||||
}
|
||||
return new DBean(bean, implBean, fields);
|
||||
return new DBean(type, implBean, fields);
|
||||
}
|
||||
|
||||
private List<DType> ReadList(TType type, YamlSequenceNode x, DefAssembly ass)
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
using Luban.Job.Cfg.DataVisitors;
|
||||
using Luban.Job.Cfg.Defs;
|
||||
using Luban.Job.Cfg.Utils;
|
||||
using Luban.Job.Common.Types;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Luban.Job.Cfg.Datas
|
||||
{
|
||||
public class DBean : DType
|
||||
{
|
||||
public DefBean Type { get; }
|
||||
public TBean TType { get; }
|
||||
|
||||
public DefBean Type => (DefBean)TType.Bean;
|
||||
|
||||
public DefBean ImplType { get; }
|
||||
|
||||
|
|
@ -15,9 +18,9 @@ namespace Luban.Job.Cfg.Datas
|
|||
|
||||
public override string TypeName => "bean";
|
||||
|
||||
public DBean(DefBean defType, DefBean implType, List<DType> fields)
|
||||
public DBean(TBean defType, DefBean implType, List<DType> fields)
|
||||
{
|
||||
this.Type = defType;
|
||||
this.TType = defType;
|
||||
this.ImplType = implType;
|
||||
this.Fields = fields;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue