-
Notifications
You must be signed in to change notification settings - Fork 0
/
fields_excel.go
141 lines (125 loc) · 3.9 KB
/
fields_excel.go
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
package ERPDocument
import (
"database/sql/driver"
"encoding/json"
"errors"
CoreSQLConfig "github.com/fotomxq/weeekj_core/v5/core/sql/config"
)
type FieldsExcelConfig struct {
//ID
ID int64 `db:"id" json:"id"`
//配置ID
ConfigID int64 `db:"config_id" json:"configID" check:"id"`
//数据表
Sheets FieldsExcelConfigSheetList `db:"sheets" json:"sheets"`
}
type FieldsExcelConfigSheetList []FieldsExcelConfigSheet
// Value sql底层处理器
func (t FieldsExcelConfigSheetList) Value() (driver.Value, error) {
return json.Marshal(t)
}
func (t *FieldsExcelConfigSheetList) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &t)
}
type FieldsExcelConfigSheet struct {
//名称
Name string `db:"name" json:"name" check:"name" min:"1" max:"300"`
//数据集合
// 兼容性数据集合,可剔除掉数值类内容(或不需要统计的内容),放入本集合内
Data string `db:"data" json:"data" check:"des" min:"1" max:"60000" empty:"true"`
//数据集合
RowCols FieldsExcelConfigRowColList `db:"row_cols" json:"rowCols"`
}
// Value sql底层处理器
func (t FieldsExcelConfigSheet) Value() (driver.Value, error) {
return json.Marshal(t)
}
func (t *FieldsExcelConfigSheet) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &t)
}
type FieldsExcelConfigRowColList []FieldsExcelConfigRowCol
// Value sql底层处理器
func (t FieldsExcelConfigRowColList) Value() (driver.Value, error) {
return json.Marshal(t)
}
func (t *FieldsExcelConfigRowColList) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &t)
}
type FieldsExcelConfigRowCol struct {
//位置
Row string `db:"row" json:"row"`
Col string `db:"col" json:"col"`
//默认样式
ClassName string `db:"class_name" json:"className"`
//样式
StyleName string `db:"style_name" json:"styleName"`
//组件默认值
Val string `db:"val" json:"val"`
//整数(内部记录用)
ValInt64 int64 `db:"val_int64" json:"valInt64"`
//浮点数(内部记录用)
ValFloat64 float64 `db:"val_float64" json:"valFloat64"`
//扩展参数
Params CoreSQLConfig.FieldsConfigsType `db:"params" json:"params"`
}
// Value sql底层处理器
func (t FieldsExcelConfigRowCol) Value() (driver.Value, error) {
return json.Marshal(t)
}
func (t *FieldsExcelConfigRowCol) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &t)
}
type FieldsExcelSheet struct {
//ID
ID int64 `db:"id" json:"id"`
//配置ID
ConfigID int64 `db:"config_id" json:"configID" check:"id"`
//文档ID
DocID int64 `db:"doc_id" json:"docID" check:"id"`
//名称
Name string `db:"name" json:"name" check:"name" min:"1" max:"300"`
//数据集合
// 兼容性数据集合,可剔除掉数值类内容(或不需要统计的内容),放入本集合内
Data string `db:"data" json:"data" check:"des" min:"1" max:"60000" empty:"true"`
}
type FieldsExcelRowCol struct {
//ID
ID int64 `db:"id" json:"id"`
//配置ID
ConfigID int64 `db:"config_id" json:"configID" check:"id"`
//文档ID
DocID int64 `db:"doc_id" json:"docID" check:"id"`
//所属文档子表
SheetID int64 `db:"sheet_id" json:"sheetID"`
//位置
Row string `db:"row" json:"row"`
Col string `db:"col" json:"col"`
//默认样式
ClassName string `db:"class_name" json:"className"`
//样式
StyleName string `db:"style_name" json:"styleName"`
//组件默认值
Val string `db:"val" json:"val"`
//整数(内部记录用)
ValInt64 int64 `db:"val_int64" json:"valInt64"`
//浮点数(内部记录用)
ValFloat64 float64 `db:"val_float64" json:"valFloat64"`
//扩展参数
Params CoreSQLConfig.FieldsConfigsType `db:"params" json:"params"`
}