Skip to content

优化如果join表时出现重复的字段或者需要有函数时可以导出别名的值 #1761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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