public void ExportTableList(DefTable t, List <Record> records, StringBuilder s) { s.Append("return").AppendLine(); s.Append('{').AppendLine(); foreach (Record r in records) { DBean d = r.Data; s.Append(d.Apply(ToLuaLiteralVisitor.Ins)); s.Append(',').AppendLine(); } s.Append('}'); }
public int Accept(DBean data, TType type, Title x) { if (x.SubTitleList.Count > 0) { if (data.Type.IsAbstractType) { if (!x.SubTitles.TryGetValue(DefBean.TYPE_NAME_KEY, out var typeTitle)) { throw new Exception($"多态bean:{data.Type.FullName} 缺失 __type__ 标题列"); } if (data.ImplType != null) { SetTitleValue(typeTitle, data.ImplType.Name); } else { SetTitleValue(typeTitle, DefBean.BEAN_NULL_STR); } } else { if (data.ImplType != null) { } else { //Current(x).Value = "null"; throw new Exception($"title:{x.Name} 不支持 值为null的普通bean"); } } int rowCount = 1; if (data.ImplType != null) { int index = 0; foreach (var field in data.ImplType.HierarchyFields) { var fdata = data.Fields[index++]; if (!x.SubTitles.TryGetValue(field.Name, out var fieldTitle)) { throw new Exception($"title:{x.Name} 子title:{field.Name} 缺失"); } if (fdata != null) { //if (fieldTitle.SubTitleList.Count > 0) //{ rowCount = Math.Max(rowCount, fdata.Apply(this, field.CType, fieldTitle)); //} //else //{ // (_cells[_startRowIndex, fieldTitle.FromIndex] as Range).Value = data.Apply(ToExcelStringVisitor.Ins, fieldTitle.Sep); //} } else if (field.CType is TText) { SetTitleValue(fieldTitle, $"null{(field.CType.HasTag("sep") ? field.CType.GetTag("sep") : "#")}null"); } } } return(rowCount); } else { SetTitleValue(x, data.Apply(ToExcelStringVisitor.Ins, type.GetTag("sep"))); return(1); } }