Files
zmkgC/test/kdTree_test.go

30 lines
675 B
Go
Raw Normal View History

2025-07-07 20:11:59 +08:00
package test
import (
"context"
"encoding/json"
"os"
"testing"
"github.com/tiger1103/gfast/v3/internal/app/system/dao"
"github.com/tiger1103/gfast/v3/internal/app/system/model/entity"
)
// 获取指定方阵所有的数据
func TestGetMatrixData(t *testing.T) {
var matrix []entity.PvModule
// 获取指定方阵所有的数据
FangzhenID := 23
if err := dao.PvModule.Ctx(context.Background()).Where(dao.PvModule.Columns().SubProjectid, FangzhenID).
Where(dao.PvModule.Columns().Type, 15).
Limit(100000).Scan(&matrix); err != nil {
t.Fatal(err)
}
// json
data, _ := json.Marshal(matrix)
// 保存为文件
os.WriteFile("matrix.json", data, 0o644)
}