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

This commit is contained in:
poppingkaka
2024-05-31 10:45:39 +08:00
committed by GitHub
parent 23952c5f5f
commit e64be755f9
2 changed files with 9 additions and 3 deletions

View File

@@ -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]))