代码优化及错误返回改进 (#1969)

* Makefile: 使用 '?=' 替代 if-else 的判断

* 移除多余的类型转换

* 移除多余的nil判断

* map 使用简化以及错误处理优化
This commit is contained in:
Feng.YJ
2024-12-22 00:13:22 +08:00
committed by GitHub
parent 532d282509
commit 601aa6e245
5 changed files with 37 additions and 38 deletions
+7 -6
View File
@@ -4,6 +4,12 @@ import (
"bytes"
"encoding/json"
"fmt"
"mime/multipart"
"net/url"
"strconv"
"strings"
"time"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
@@ -11,11 +17,6 @@ import (
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"github.com/xuri/excelize/v2"
"gorm.io/gorm"
"mime/multipart"
"net/url"
"strconv"
"strings"
"time"
)
type SysExportTemplateService struct {
@@ -155,7 +156,7 @@ func (sysExportTemplateService *SysExportTemplateService) ExportExcel(templateID
var tableTitle []string
var selectKeyFmt []string
for _, key := range columns {
selectKeyFmt = append(selectKeyFmt, fmt.Sprintf("%s", key))
selectKeyFmt = append(selectKeyFmt, key)
tableTitle = append(tableTitle, templateInfoMap[key])
}