domain_service.go
4.3 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
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
package domain
// FileTableService 文件表服务(导入模块)
type FileTableService interface {
// Preview 预览(Excel文件)
Preview(ctx *Context, fileId int, fields []*Field, where Where) (interface{}, error)
// Edit 编辑表
Edit()
// Flush 保存编辑状态的表元数据
Flush(ctx *Context, fileId int, table *Table) (interface{}, error)
// DeleteFiles 批量删除文件
DeleteFiles(ctx *Context, files ...*File) error
// GenerateTable 生成主表
GenerateTable(ctx *Context, fileId int, tableName string) (interface{}, error)
}
// TableService 表服务
type TableService interface {
// Preview 预览
Preview(ctx *Context, tableId int, where Where) (interface{}, error)
// CopyTable 拷贝表
CopyTable(ctx *Context, tableId int, tableName string) (interface{}, error)
// DeleteTables 删除表
DeleteTables(ctx *Context, tables ...*Table) error
// AppendData 追加表数据
AppendData(ctx *Context, fileId int, tableId int, mappingFields []*MappingField) (interface{}, error)
// UpdateTableStruct 更新表结构(分表)
UpdateTableStruct(ctx *Context, tableId int, fields []*Field, name string) (interface{}, error)
// AddTableStruct 添加表结构(分表)
AddTableStruct(ctx *Context, parentTableId int, fields []*Field, name string) (interface{}, error)
}
// PreviewDataTableService 具体的表预览服务
type PreviewDataTableService interface {
// Preview 预览
Preview(ctx *Context, fileId int, fields []*Field, where Where) (interface{}, error)
// RePreview 重新预览
RePreview(ctx *Context, fileId int, fields []*Field, where Where) (interface{}, error)
// CreateTemporaryFile 创建临时文件(计算集修改的时候,先创建临时文件,保存成功后覆盖原文件)
CreateTemporaryFile(ctx *Context, fileId int) (*File, error)
GetFileId() int
}
// EditDataTableService 编辑表数据(副表)
type EditDataTableService interface {
Edit(ctx *Context, param EditTableRequest) (*DataEditDataTable, error)
}
// FlushDataTableService 保存编辑状态的表
type FlushDataTableService interface {
Flush(ctx *Context, fileId int, table *Table) (interface{}, error)
}
// DeleteFileService 删除文件服务
type DeleteFileService interface {
DeleteFiles(ctx *Context, files ...*File) error
}
// GenerateMainTableService 生成主表服务
type GenerateMainTableService interface {
GenerateTable(ctx *Context, fileId int, tableName string) (interface{}, error)
}
// CopyDataTableService 拷贝表服务
type CopyDataTableService interface {
CopyTable(ctx *Context, tableId int, tableName string) (interface{}, error)
}
// DeleteDataTableService 删除表服务
type DeleteDataTableService interface {
DeleteTable(ctx *Context, tableId int) (interface{}, error)
DeleteTables(ctx *Context, tables ...*Table) error
}
// AppendDataToTableService 追加数据服务
type AppendDataToTableService interface {
AppendData(ctx *Context, fileId int, tableId int, mappingFields []*MappingField) (interface{}, error)
PreflightCheck(ctx *Context, fileId int, tableId int, mappingFields []*MappingField) (interface{}, error)
}
/************************************/
// UpdateTableStructService 更新表结构服务(分表)
type UpdateTableStructService interface {
UpdateTableStruct(ctx *Context, tableId int, fields []*Field, name string) (interface{}, error)
}
// AddTableStructService 添加表结构服务(分表)
type AddTableStructService interface {
AddTableStruct(ctx *Context, parentTableId int, fields []*Field, name string) (*Table, error)
}
type EditTableRequest struct {
FileId int `json:"objectId"`
Fields []*Field `json:"fields"`
ProcessFieldNames []string `json:"processFields"`
ProcessFields []*Field `json:"-" `
Where Where `json:"where"`
Action string `json:"action"`
Params map[string]interface{} `json:"params"`
}
type TableEditDataService interface {
RowEdit(ctx *Context, request EditDataRequest) (interface{}, error)
}
type EditDataRequest struct {
TableId int `json:"tableId"`
Table *Table
UpdateList []*FieldValues `json:"updateList"`
RemoveList []*FieldValues `json:"removeList"`
AddList []*FieldValues `json:"addList"`
Where Where `json:"where"`
}