正在显示
12 个修改的文件
包含
36 行增加
和
100 行删除
| @@ -24,14 +24,11 @@ type ( | @@ -24,14 +24,11 @@ type ( | ||
| 24 | Url string `json:"url"` | 24 | Url string `json:"url"` |
| 25 | Ext string `json:"ext"` | 25 | Ext string `json:"ext"` |
| 26 | Where | 26 | Where |
| 27 | - OriginalTableId string `json:"originalTableId"` | ||
| 28 | - IsFromOriginalTable bool `json:"isFromOriginalTable"` | ||
| 29 | - TableFileUrl string `json:"tableFileUrl"` | ||
| 30 | - ColumnSchemas []ColumnSchema `json:"columnSchemas"` | ||
| 31 | - //PageNumber int `json:"pageNumber"` | ||
| 32 | - //PageSize int `json:"pageSize"` | ||
| 33 | - //QueryParameters []QueryParameter `json:"queryParameters"` | ||
| 34 | - SortParameters map[string]interface{} `json:"sortParameters"` | 27 | + OriginalTableId string `json:"originalTableId"` |
| 28 | + IsFromOriginalTable bool `json:"isFromOriginalTable"` | ||
| 29 | + TableFileUrl string `json:"tableFileUrl"` | ||
| 30 | + ColumnSchemas []ColumnSchema `json:"columnSchemas"` | ||
| 31 | + SortParameters map[string]interface{} `json:"sortParameters"` | ||
| 35 | } | 32 | } |
| 36 | 33 | ||
| 37 | DataLoadDataTable struct { | 34 | DataLoadDataTable struct { |
| @@ -50,14 +47,6 @@ type ( | @@ -50,14 +47,6 @@ type ( | ||
| 50 | ColumnContents []string `json:"columnContents"` | 47 | ColumnContents []string `json:"columnContents"` |
| 51 | IsContainContent bool `json:"isContainContent"` | 48 | IsContainContent bool `json:"isContainContent"` |
| 52 | } | 49 | } |
| 53 | - //Field struct { | ||
| 54 | - // // 索引序号 | ||
| 55 | - // Index int `json:"index"` | ||
| 56 | - // // 名称 | ||
| 57 | - // Name string `json:"name"` | ||
| 58 | - // // 对应数据库类型 | ||
| 59 | - // Type string `json:"sqlType"` | ||
| 60 | - //} | ||
| 61 | 50 | ||
| 62 | InValidCell struct { | 51 | InValidCell struct { |
| 63 | Col string `json:"col"` | 52 | Col string `json:"col"` |
| @@ -157,11 +146,6 @@ type ( | @@ -157,11 +146,6 @@ type ( | ||
| 157 | MainTable *Table | 146 | MainTable *Table |
| 158 | Table *Table | 147 | Table *Table |
| 159 | CopyToTable *Table | 148 | CopyToTable *Table |
| 160 | - | ||
| 161 | - // 数据列 | ||
| 162 | - //DataFields []*Field `json:"dataFields"` | ||
| 163 | - // 手动添加的列 | ||
| 164 | - //ManualFields []*Field `json:"manualFields"` | ||
| 165 | } | 149 | } |
| 166 | 150 | ||
| 167 | DataCopyTable struct { | 151 | DataCopyTable struct { |
| @@ -249,34 +233,13 @@ func ToFields(fields []*Field) []*Field { | @@ -249,34 +233,13 @@ func ToFields(fields []*Field) []*Field { | ||
| 249 | return result | 233 | return result |
| 250 | } | 234 | } |
| 251 | 235 | ||
| 252 | -//func ToFieldData(fields []*Field, data [][]string, byteName bool) []map[string]string { | ||
| 253 | -// var result = make([]map[string]string, 0) | ||
| 254 | -// var key string | ||
| 255 | -// for _, d := range data { | ||
| 256 | -// var item = make(map[string]string) | ||
| 257 | -// for j, f := range fields { | ||
| 258 | -// key = f.Name | ||
| 259 | -// if byteName { | ||
| 260 | -// key = f.Name | ||
| 261 | -// } | ||
| 262 | -// if len(d) >= j { | ||
| 263 | -// item[key] = d[j] | ||
| 264 | -// } else { | ||
| 265 | -// item[key] = "" | ||
| 266 | -// } | ||
| 267 | -// } | ||
| 268 | -// result = append(result, item) | ||
| 269 | -// } | ||
| 270 | -// return result | ||
| 271 | -//} | ||
| 272 | - | ||
| 273 | type ( | 236 | type ( |
| 274 | ReqFormulasGenerate struct { | 237 | ReqFormulasGenerate struct { |
| 275 | QuerySet *QuerySet | 238 | QuerySet *QuerySet |
| 276 | Table *Table | 239 | Table *Table |
| 277 | QueryComponents []*QueryComponent | 240 | QueryComponents []*QueryComponent |
| 278 | QuerySetService interface{} | 241 | QuerySetService interface{} |
| 279 | - Context interface{} | 242 | + Context interface{} |
| 280 | } | 243 | } |
| 281 | 244 | ||
| 282 | DataFormulasGenerate struct { | 245 | DataFormulasGenerate struct { |
| @@ -9,7 +9,7 @@ type Context struct { | @@ -9,7 +9,7 @@ type Context struct { | ||
| 9 | OperatorName string `json:"operatorName"` | 9 | OperatorName string `json:"operatorName"` |
| 10 | // 租户 (个人、企业) | 10 | // 租户 (个人、企业) |
| 11 | TenantId int `json:"tenantId"` | 11 | TenantId int `json:"tenantId"` |
| 12 | - | 12 | + // 附加数据 |
| 13 | data map[string]interface{} | 13 | data map[string]interface{} |
| 14 | } | 14 | } |
| 15 | 15 |
| @@ -16,8 +16,6 @@ type File struct { | @@ -16,8 +16,6 @@ type File struct { | ||
| 16 | FileInfo *FileInfo `json:"fileInfo"` | 16 | FileInfo *FileInfo `json:"fileInfo"` |
| 17 | // 源文件Id(FileType为TemporaryFile或VerifiedFile时有值) | 17 | // 源文件Id(FileType为TemporaryFile或VerifiedFile时有值) |
| 18 | SourceFileId int `json:"sourceFileId"` | 18 | SourceFileId int `json:"sourceFileId"` |
| 19 | - // 操作人 | ||
| 20 | - // Operator string `json:"operator"` | ||
| 21 | // 创建时间 | 19 | // 创建时间 |
| 22 | CreatedAt time.Time `json:"createdAt"` | 20 | CreatedAt time.Time `json:"createdAt"` |
| 23 | // 更新时间 | 21 | // 更新时间 |
| @@ -78,8 +76,7 @@ func (file *File) CopyTo(fileType FileType, ctx *Context) *File { | @@ -78,8 +76,7 @@ func (file *File) CopyTo(fileType FileType, ctx *Context) *File { | ||
| 78 | CreatedAt: time.Now(), | 76 | CreatedAt: time.Now(), |
| 79 | UpdatedAt: time.Now(), | 77 | UpdatedAt: time.Now(), |
| 80 | SourceFileId: file.FileId, | 78 | SourceFileId: file.FileId, |
| 81 | - //Operator: file.Operator, | ||
| 82 | - Context: ctx, | 79 | + Context: ctx, |
| 83 | } | 80 | } |
| 84 | return t | 81 | return t |
| 85 | } | 82 | } |
| @@ -8,8 +8,6 @@ type FileInfo struct { | @@ -8,8 +8,6 @@ type FileInfo struct { | ||
| 8 | Url string `json:"url"` | 8 | Url string `json:"url"` |
| 9 | // 文件大小 | 9 | // 文件大小 |
| 10 | FileSize int `json:"fileSize"` | 10 | FileSize int `json:"fileSize"` |
| 11 | - // 文件编号,以固定字符“F”+4位年+2位月+2位日+三位流水,每天编号从001开始 | ||
| 12 | - // FileCode string `json:"fileCode"` | ||
| 13 | // 后缀扩展 | 11 | // 后缀扩展 |
| 14 | Ext string `json:"ext"` | 12 | Ext string `json:"ext"` |
| 15 | // 记录数 | 13 | // 记录数 |
| @@ -45,6 +45,5 @@ func (log *Log) Identify() interface{} { | @@ -45,6 +45,5 @@ func (log *Log) Identify() interface{} { | ||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | func (log *Log) Update(data map[string]interface{}) error { | 47 | func (log *Log) Update(data map[string]interface{}) error { |
| 48 | - | ||
| 49 | return nil | 48 | return nil |
| 50 | } | 49 | } |
| @@ -2,7 +2,7 @@ package domain | @@ -2,7 +2,7 @@ package domain | ||
| 2 | 2 | ||
| 3 | import "time" | 3 | import "time" |
| 4 | 4 | ||
| 5 | -// 匹配规则配置 | 5 | +// MappingRule 匹配规则配置 |
| 6 | type MappingRule struct { | 6 | type MappingRule struct { |
| 7 | // 匹配规则ID | 7 | // 匹配规则ID |
| 8 | MappingRuleId int `json:"mappingRuleId"` | 8 | MappingRuleId int `json:"mappingRuleId"` |
| @@ -53,7 +53,6 @@ type MappingField struct { | @@ -53,7 +53,6 @@ type MappingField struct { | ||
| 53 | 53 | ||
| 54 | func NewMappingFields(all []*Field, some []*Field) []*MappingField { | 54 | func NewMappingFields(all []*Field, some []*Field) []*MappingField { |
| 55 | var result []*MappingField | 55 | var result []*MappingField |
| 56 | - //allMap :=(Fields)(all).ToMap() | ||
| 57 | someMap := (Fields)(some).ToMap() | 56 | someMap := (Fields)(some).ToMap() |
| 58 | for _, f := range all { | 57 | for _, f := range all { |
| 59 | item := &MappingField{ | 58 | item := &MappingField{ |
| @@ -76,7 +76,6 @@ type SelectExpr struct { // 查询表达式 | @@ -76,7 +76,6 @@ type SelectExpr struct { // 查询表达式 | ||
| 76 | FieldLeft FieldExpr `json:"fieldLeft"` | 76 | FieldLeft FieldExpr `json:"fieldLeft"` |
| 77 | FieldRight FieldExpr `json:"fieldRight"` // has value when type is equal to 1 | 77 | FieldRight FieldExpr `json:"fieldRight"` // has value when type is equal to 1 |
| 78 | Type string `json:"type"` // 1.拆分 2.拆方赋值 3.正常赋值 | 78 | Type string `json:"type"` // 1.拆分 2.拆方赋值 3.正常赋值 |
| 79 | - //SubGroup []SelectExpr `json:"subGroup,omitempty"` | ||
| 80 | } | 79 | } |
| 81 | 80 | ||
| 82 | func (s SelectExpr) Equal(compare SelectExpr) bool { | 81 | func (s SelectExpr) Equal(compare SelectExpr) bool { |
| @@ -94,7 +93,6 @@ type SelectExprGroup struct { // 查询表达式 | @@ -94,7 +93,6 @@ type SelectExprGroup struct { // 查询表达式 | ||
| 94 | } | 93 | } |
| 95 | 94 | ||
| 96 | type FieldExpr struct { | 95 | type FieldExpr struct { |
| 97 | - //LabelColumns []LabelColumn `json:"labelColumns"` | ||
| 98 | TableFields []TableField `json:"tableFields"` | 96 | TableFields []TableField `json:"tableFields"` |
| 99 | ExprHuman string `json:"exprHuman"` | 97 | ExprHuman string `json:"exprHuman"` |
| 100 | ExprSql string `json:"exprSql"` | 98 | ExprSql string `json:"exprSql"` |
| @@ -104,15 +102,11 @@ func (expr *FieldExpr) Complete() string { | @@ -104,15 +102,11 @@ func (expr *FieldExpr) Complete() string { | ||
| 104 | exprSql := expr.ExprSql | 102 | exprSql := expr.ExprSql |
| 105 | for _, f := range expr.TableFields { | 103 | for _, f := range expr.TableFields { |
| 106 | sql := fmt.Sprintf("%s.%s", f.TableSqlName, f.FieldSqlName) | 104 | sql := fmt.Sprintf("%s.%s", f.TableSqlName, f.FieldSqlName) |
| 107 | - //zhSql := fmt.Sprintf("%s.%s", f.TableName, f.FieldSqlName) | ||
| 108 | sub := fmt.Sprintf("max(%s.%s)", f.TableSqlName, f.FieldSqlName) | 105 | sub := fmt.Sprintf("max(%s.%s)", f.TableSqlName, f.FieldSqlName) |
| 109 | - //zhSub := fmt.Sprintf("max(%s.%s)", f.TableName, f.FieldSqlName) | ||
| 110 | if strings.Contains(expr.ExprSql, fmt.Sprintf("(%s)", sql)) { | 106 | if strings.Contains(expr.ExprSql, fmt.Sprintf("(%s)", sql)) { |
| 111 | continue | 107 | continue |
| 112 | } | 108 | } |
| 113 | exprSql = strings.ReplaceAll(exprSql, sql, sub) | 109 | exprSql = strings.ReplaceAll(exprSql, sql, sub) |
| 114 | - //expr.ExprSql = strings.ReplaceAll(expr.ExprSql, sql, sub) | ||
| 115 | - //expr.ExprHuman = strings.ReplaceAll(expr.ExprHuman, zhSql, zhSub) | ||
| 116 | } | 110 | } |
| 117 | return exprSql | 111 | return exprSql |
| 118 | } | 112 | } |
| @@ -2,8 +2,8 @@ package domain | @@ -2,8 +2,8 @@ package domain | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "github.com/zeromicro/go-zero/core/collection" | 4 | "github.com/zeromicro/go-zero/core/collection" |
| 5 | - "strings" | ||
| 6 | "sort" | 5 | "sort" |
| 6 | + "strings" | ||
| 7 | ) | 7 | ) |
| 8 | 8 | ||
| 9 | const ( | 9 | const ( |
| @@ -44,24 +44,12 @@ type Location struct { | @@ -44,24 +44,12 @@ type Location struct { | ||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | type LayoutCellData struct { | 46 | type LayoutCellData struct { |
| 47 | - //Table *Table `json:"table,omitempty"` | ||
| 48 | - //Field *Field `json:"field,omitempty"` | ||
| 49 | TableField *TableField `json:"tableField"` | 47 | TableField *TableField `json:"tableField"` |
| 50 | Text string `json:"text,omitempty"` | 48 | Text string `json:"text,omitempty"` |
| 51 | } | 49 | } |
| 52 | 50 | ||
| 53 | func (l *LayoutRuleItem) LayoutCells() []*LayoutCell { | 51 | func (l *LayoutRuleItem) LayoutCells() []*LayoutCell { |
| 54 | var cells = make([]*LayoutCell, 0) | 52 | var cells = make([]*LayoutCell, 0) |
| 55 | - //for i, rows := range l.Cells { | ||
| 56 | - // for j, item := range rows { | ||
| 57 | - // if item.Type == CellTypeNull || item.Type == "" { | ||
| 58 | - // continue | ||
| 59 | - // } | ||
| 60 | - // item.X = i | ||
| 61 | - // item.Y = j | ||
| 62 | - // cells = append(cells, item) | ||
| 63 | - // } | ||
| 64 | - //} | ||
| 65 | for _, item := range l.Cells { | 53 | for _, item := range l.Cells { |
| 66 | item.X = item.Position.X | 54 | item.X = item.Position.X |
| 67 | item.Y = item.Position.Y | 55 | item.Y = item.Position.Y |
| @@ -70,19 +58,18 @@ func (l *LayoutRuleItem) LayoutCells() []*LayoutCell { | @@ -70,19 +58,18 @@ func (l *LayoutRuleItem) LayoutCells() []*LayoutCell { | ||
| 70 | return cells | 58 | return cells |
| 71 | } | 59 | } |
| 72 | 60 | ||
| 73 | - | ||
| 74 | type LayoutCells []*LayoutCell | 61 | type LayoutCells []*LayoutCell |
| 75 | 62 | ||
| 76 | -func(cells LayoutCells)CellsRange(direction string)[]int{ | ||
| 77 | - list:=collection.NewSet() | ||
| 78 | - for i:=range cells{ | ||
| 79 | - if strings.ToLower(direction)=="x"{ | 63 | +func (cells LayoutCells) CellsRange(direction string) []int { |
| 64 | + list := collection.NewSet() | ||
| 65 | + for i := range cells { | ||
| 66 | + if strings.ToLower(direction) == "x" { | ||
| 80 | list.Add(cells[i].X) | 67 | list.Add(cells[i].X) |
| 81 | - }else{ | 68 | + } else { |
| 82 | list.Add(cells[i].Y) | 69 | list.Add(cells[i].Y) |
| 83 | } | 70 | } |
| 84 | } | 71 | } |
| 85 | - sortList :=list.KeysInt() | 72 | + sortList := list.KeysInt() |
| 86 | sort.Ints(sortList) | 73 | sort.Ints(sortList) |
| 87 | return sortList | 74 | return sortList |
| 88 | -} | ||
| 75 | +} |
| @@ -114,42 +114,42 @@ func (table *Table) Update(data map[string]interface{}) error { | @@ -114,42 +114,42 @@ func (table *Table) Update(data map[string]interface{}) error { | ||
| 114 | return nil | 114 | return nil |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | -func (t *Table) Fields(includePK bool) []*Field { | 117 | +func (table *Table) Fields(includePK bool) []*Field { |
| 118 | var fields []*Field | 118 | var fields []*Field |
| 119 | 119 | ||
| 120 | - if includePK && t.PK != nil { | ||
| 121 | - fields = append(fields, t.PK) | 120 | + if includePK && table.PK != nil { |
| 121 | + fields = append(fields, table.PK) | ||
| 122 | } | 122 | } |
| 123 | - fields = append(fields, t.DataFields...) | ||
| 124 | - if t.TableType == SubTable.ToString() { | ||
| 125 | - fields = append(fields, t.ManualFields...) | 123 | + fields = append(fields, table.DataFields...) |
| 124 | + if table.TableType == SubTable.ToString() { | ||
| 125 | + fields = append(fields, table.ManualFields...) | ||
| 126 | } | 126 | } |
| 127 | - t.fields = fields | 127 | + table.fields = fields |
| 128 | 128 | ||
| 129 | - return t.fields | 129 | + return table.fields |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | -func (t *Table) MatchField(field *Field) (*Field, bool) { | ||
| 133 | - if len(t.fields) == 0 { | ||
| 134 | - t.fields = t.Fields(true) | 132 | +func (table *Table) MatchField(field *Field) (*Field, bool) { |
| 133 | + if len(table.fields) == 0 { | ||
| 134 | + table.fields = table.Fields(true) | ||
| 135 | } | 135 | } |
| 136 | - mField := (Fields)(t.fields).ToMap() | 136 | + mField := (Fields)(table.fields).ToMap() |
| 137 | if v, ok := mField[field.Name]; ok { | 137 | if v, ok := mField[field.Name]; ok { |
| 138 | return v, true | 138 | return v, true |
| 139 | } | 139 | } |
| 140 | return nil, false | 140 | return nil, false |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | -func (t *Table) DependencyTables() []int { | ||
| 144 | - if t.TableInfo == nil { | 143 | +func (table *Table) DependencyTables() []int { |
| 144 | + if table.TableInfo == nil { | ||
| 145 | return []int{} | 145 | return []int{} |
| 146 | } | 146 | } |
| 147 | - return t.TableInfo.DependencyTables | 147 | + return table.TableInfo.DependencyTables |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | -func (t *Table) AssertTableType(types ...TableType) bool { | 150 | +func (table *Table) AssertTableType(types ...TableType) bool { |
| 151 | for _, item := range types { | 151 | for _, item := range types { |
| 152 | - if t.TableType == item.ToString() { | 152 | + if table.TableType == item.ToString() { |
| 153 | return true | 153 | return true |
| 154 | } | 154 | } |
| 155 | } | 155 | } |
-
请 注册 或 登录 后发表评论