调整Excel导出时使用的方法
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"git.toowon.com/jimmy/go-common/excel"
|
||||
"git.toowon.com/jimmy/go-common/factory"
|
||||
"git.toowon.com/jimmy/go-common/tools"
|
||||
)
|
||||
|
||||
// User 用户结构体示例
|
||||
@@ -111,7 +112,7 @@ func example3(fac *factory.Factory) {
|
||||
Header: "创建时间",
|
||||
Field: "CreatedAt",
|
||||
Width: 20,
|
||||
Format: excel.FormatDateTimeDefault, // 使用便捷的格式化函数
|
||||
Format: excel.AdaptTimeFormatter(tools.FormatDateTime), // 使用适配器直接调用tools函数
|
||||
},
|
||||
{
|
||||
Header: "状态",
|
||||
@@ -174,7 +175,7 @@ func (d *UserExportData) GetExportColumns() []excel.ExportColumn {
|
||||
Header: "创建时间",
|
||||
Field: "CreatedAt",
|
||||
Width: 20,
|
||||
Format: excel.FormatDateTimeDefault,
|
||||
Format: excel.AdaptTimeFormatter(tools.FormatDateTime),
|
||||
},
|
||||
{
|
||||
Header: "状态",
|
||||
@@ -230,4 +231,3 @@ func (w *mockResponseWriter) Write(data []byte) (int, error) {
|
||||
func (w *mockResponseWriter) WriteHeader(statusCode int) {
|
||||
// 模拟实现
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user