...
|
...
|
@@ -437,33 +437,33 @@ func (d *DataLayoutDataTable) Shrink() error { |
|
|
}
|
|
|
iData++
|
|
|
}
|
|
|
//d.DataTable.Data = data
|
|
|
//for i := 0; i <= y; i++ {
|
|
|
// d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{
|
|
|
// Name: fmt.Sprintf("列%d", i),
|
|
|
// SQLName: fmt.Sprintf("col%d", i),
|
|
|
// SQLType: domain.String.ToString(),
|
|
|
// })
|
|
|
//}
|
|
|
// 默认计算集第一行作为标题
|
|
|
if len(data) >= 1 {
|
|
|
d.DataTable.Data = data[1:]
|
|
|
columnMap := collection.NewSet()
|
|
|
for i := 0; i < len(data[0]); i++ {
|
|
|
//if len(data[0][i]) == 0 {
|
|
|
// return fmt.Errorf("计算集标题第%d列不能为空", i+1)
|
|
|
//}
|
|
|
//if columnMap.Contains(data[0][i]) {
|
|
|
// return fmt.Errorf("计算集第%d列重复:%v", i+1, data[0][i])
|
|
|
//}
|
|
|
columnMap.Add(data[0][i])
|
|
|
d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{
|
|
|
Name: data[0][i],
|
|
|
SQLName: fmt.Sprintf("col%d", i),
|
|
|
SQLType: domain.String.ToString(),
|
|
|
})
|
|
|
}
|
|
|
d.DataTable.Data = data
|
|
|
for i := 0; i <= y; i++ {
|
|
|
d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{
|
|
|
Name: fmt.Sprintf("列%d", i),
|
|
|
SQLName: fmt.Sprintf("col%d", i),
|
|
|
SQLType: domain.String.ToString(),
|
|
|
})
|
|
|
}
|
|
|
// 默认计算集第一行作为标题
|
|
|
//if len(data) >= 1 {
|
|
|
// d.DataTable.Data = data[1:]
|
|
|
// columnMap := collection.NewSet()
|
|
|
// for i := 0; i < len(data[0]); i++ {
|
|
|
// if len(data[0][i]) == 0 {
|
|
|
// return fmt.Errorf("计算集标题第%d列不能为空", i+1)
|
|
|
// }
|
|
|
// if columnMap.Contains(data[0][i]) {
|
|
|
// return fmt.Errorf("计算集第%d列重复:%v", i+1, data[0][i])
|
|
|
// }
|
|
|
// columnMap.Add(data[0][i])
|
|
|
// d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{
|
|
|
// Name: data[0][i],
|
|
|
// SQLName: fmt.Sprintf("col%d", i),
|
|
|
// SQLType: domain.String.ToString(),
|
|
|
// })
|
|
|
// }
|
|
|
//}
|
|
|
return nil
|
|
|
}
|
|
|
|
...
|
...
|
|