调整项目架构,让框架更优化

This commit is contained in:
2026-07-20 21:39:01 +08:00
parent 987b16fd41
commit 121928733b
16 changed files with 866 additions and 689 deletions

View File

@@ -87,9 +87,12 @@ type ExportData interface {
//
// excel.ExportToWriter(w, "用户列表", columns, users)
func (e *Excel) ExportToWriter(w io.Writer, sheetName string, columns []ExportColumn, data interface{}) error {
if e.file == nil {
e.file = excelize.NewFile()
}
// 每次导出使用新文件,避免同实例多次/并发导出互相污染
e.file = excelize.NewFile()
defer func() {
_ = e.file.Close()
e.file = nil
}()
// 设置工作表名称
if sheetName == "" {