Skip to content

Commit

Permalink
优化如果join表时出现重复的字段或者需要有函数时可以导出别名的值 (#1761)
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingkaka authored May 31, 2024
1 parent 23952c5 commit e64be75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions server/service/system/sys_export_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,14 @@ func (sysExportTemplateService *SysExportTemplateService) ExportExcel(templateID
var row []string
for _, column := range columns {
if len(template.JoinTemplate) > 0 {
columnArr := strings.Split(column, ".")
if len(columnArr) > 1 {
column = strings.Split(column, ".")[1]
columnAs := strings.Split(column, " as ")
if len(columnAs) > 1 {
column = strings.TrimSpace(strings.Split(column, " as ")[1])
} else {
columnArr := strings.Split(column, ".")
if len(columnArr) > 1 {
column = strings.Split(column, ".")[1]
}
}
}
row = append(row, fmt.Sprintf("%v", table[column]))
Expand Down
1 change: 1 addition & 0 deletions web/src/view/systemTools/exportTemplate/exportTemplate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ const templatePlaceholder = `模板信息格式:key标识数据库column列名
"table_column4":"第四列",
}
如果增加了JOINS导出key应该列为 {table_name1.table_column1:"第一列",table_name2.table_column2:"第二列"}
如果有重复的列名导出格式应为 {table_name1.table_column1 as key:"第一列",table_name2.table_column2 as key2:"第二列"}
JOINS模式下不支持导入
`
Expand Down

0 comments on commit e64be75

Please sign in to comment.