导出问题,增加了打印

This commit is contained in:
wucongxing8150 2024-12-06 09:06:50 +08:00
parent 4ad5d2d226
commit 839a490533

View File

@ -1,6 +1,7 @@
package service package service
import ( import (
"encoding/json"
"fmt" "fmt"
"github.com/shopspring/decimal" "github.com/shopspring/decimal"
"hospital-admin-api/api/dao" "hospital-admin-api/api/dao"
@ -1656,6 +1657,15 @@ func (r *ExportService) OrderProduct(d []*model.OrderProduct) (string, error) {
dataSlice = append(dataSlice, data) dataSlice = append(dataSlice, data)
} }
// 转为 JSON
jsonData, err := json.MarshalIndent(dataSlice, "", " ")
if err != nil {
fmt.Println("Error converting to JSON:", err)
return "", err
}
utils.LogJsonInfo("打印数据:", jsonData)
file, err := utils.Export(header, dataSlice) file, err := utils.Export(header, dataSlice)
if err != nil { if err != nil {
return "", err return "", err