|
@@ -437,33 +437,33 @@ func (d *DataLayoutDataTable) Shrink() error { |
|
@@ -437,33 +437,33 @@ func (d *DataLayoutDataTable) Shrink() error { |
437
|
}
|
437
|
}
|
438
|
iData++
|
438
|
iData++
|
439
|
}
|
439
|
}
|
440
|
- //d.DataTable.Data = data
|
|
|
441
|
- //for i := 0; i <= y; i++ {
|
|
|
442
|
- // d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{
|
|
|
443
|
- // Name: fmt.Sprintf("列%d", i),
|
|
|
444
|
- // SQLName: fmt.Sprintf("col%d", i),
|
|
|
445
|
- // SQLType: domain.String.ToString(),
|
|
|
446
|
- // })
|
|
|
447
|
- //}
|
|
|
448
|
- // 默认计算集第一行作为标题
|
|
|
449
|
- if len(data) >= 1 {
|
|
|
450
|
- d.DataTable.Data = data[1:]
|
|
|
451
|
- columnMap := collection.NewSet()
|
|
|
452
|
- for i := 0; i < len(data[0]); i++ {
|
|
|
453
|
- //if len(data[0][i]) == 0 {
|
|
|
454
|
- // return fmt.Errorf("计算集标题第%d列不能为空", i+1)
|
|
|
455
|
- //}
|
|
|
456
|
- //if columnMap.Contains(data[0][i]) {
|
|
|
457
|
- // return fmt.Errorf("计算集第%d列重复:%v", i+1, data[0][i])
|
|
|
458
|
- //}
|
|
|
459
|
- columnMap.Add(data[0][i])
|
440
|
+ d.DataTable.Data = data
|
|
|
441
|
+ for i := 0; i <= y; i++ {
|
460
|
d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{
|
442
|
d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{
|
461
|
- Name: data[0][i],
|
443
|
+ Name: fmt.Sprintf("列%d", i),
|
462
|
SQLName: fmt.Sprintf("col%d", i),
|
444
|
SQLName: fmt.Sprintf("col%d", i),
|
463
|
SQLType: domain.String.ToString(),
|
445
|
SQLType: domain.String.ToString(),
|
464
|
})
|
446
|
})
|
465
|
}
|
447
|
}
|
466
|
- }
|
448
|
+ // 默认计算集第一行作为标题
|
|
|
449
|
+ //if len(data) >= 1 {
|
|
|
450
|
+ // d.DataTable.Data = data[1:]
|
|
|
451
|
+ // columnMap := collection.NewSet()
|
|
|
452
|
+ // for i := 0; i < len(data[0]); i++ {
|
|
|
453
|
+ // if len(data[0][i]) == 0 {
|
|
|
454
|
+ // return fmt.Errorf("计算集标题第%d列不能为空", i+1)
|
|
|
455
|
+ // }
|
|
|
456
|
+ // if columnMap.Contains(data[0][i]) {
|
|
|
457
|
+ // return fmt.Errorf("计算集第%d列重复:%v", i+1, data[0][i])
|
|
|
458
|
+ // }
|
|
|
459
|
+ // columnMap.Add(data[0][i])
|
|
|
460
|
+ // d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{
|
|
|
461
|
+ // Name: data[0][i],
|
|
|
462
|
+ // SQLName: fmt.Sprintf("col%d", i),
|
|
|
463
|
+ // SQLType: domain.String.ToString(),
|
|
|
464
|
+ // })
|
|
|
465
|
+ // }
|
|
|
466
|
+ //}
|
467
|
return nil
|
467
|
return nil
|
468
|
}
|
468
|
}
|
469
|
|
469
|
|