datatable_dto.go
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package dto
import "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
type DataTableDto struct {
FileId int `json:"fileId"`
DataFields []*Field `json:"dataFields"`
DataRows [][]interface{} `json:"dataRows"`
Total int `json:"total"`
PageNumber int `json:"pageNumber"`
InValidCells []InValidCell `json:"inValidCells"`
}
type Field struct {
// 索引序号
// Index int `json:"index"`
// 名称
Name string `json:"name"`
// 对应数据库类型
Type string `json:"type"`
}
type InValidCell struct {
X int `json:"x"`
Y int `json:"y"`
Error string `json:"error"`
}
func NewDataTableDtoDemo(fileId int) DataTableDto {
return DataTableDto{
DataFields: []*Field{
{
//Index: 1,
Name: "产品名称",
Type: domain.String.ToString(),
},
{
//Index: 2,
Name: "产品数量",
Type: domain.Int.ToString(),
},
},
DataRows: [][]interface{}{
{"素面", 200},
{"冻豆腐", 400},
{"冻豆腐1", 300},
{"冻豆2", "A"},
},
InValidCells: []InValidCell{
{
X: 1,
Y: 3,
Error: "不是一个有效的数值",
},
},
PageNumber: 1,
Total: 100,
FileId: fileId,
}
}