重构数据引擎和报表引擎
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package api_feature
|
||||
package dict
|
||||
|
||||
import (
|
||||
"dataengine/consts/api-feature"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package api_feature
|
||||
package dict
|
||||
|
||||
import (
|
||||
"dataengine/consts/api-feature"
|
||||
|
||||
62
model/dto/public/public_query_dto.go
Normal file
62
model/dto/public/public_query_dto.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package public
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// QueryReq 公共查询请求
|
||||
type QueryReq struct {
|
||||
g.Meta `path:"/public/query" method:"post" tags:"公共查询" summary:"公共数据查询" dc:"支持字段/表名/过滤/分组/分页的通用查询接口"`
|
||||
Table string `json:"table" v:"required" dc:"表名(白名单限制)"`
|
||||
Fields string `json:"fields" dc:"查询字段,逗号分隔,默认 *"`
|
||||
Where map[string]interface{} `json:"where" dc:"过滤条件,支持操作符: =, !=, >, <, >=, <=, like, in, between"`
|
||||
GroupBy string `json:"groupBy" dc:"分组字段,逗号分隔"`
|
||||
OrderBy string `json:"orderBy" dc:"排序字段,如: create_time desc"`
|
||||
Page int `json:"page" dc:"页码,默认1" d:"1"`
|
||||
PageSize int `json:"pageSize" dc:"每页条数,默认20,最大100" d:"20"`
|
||||
}
|
||||
|
||||
// QueryRes 公共查询响应
|
||||
type QueryRes struct {
|
||||
List []map[string]interface{} `json:"list" dc:"数据列表"`
|
||||
Total int64 `json:"total" dc:"总数"`
|
||||
Page int `json:"page" dc:"当前页码"`
|
||||
Size int `json:"size" dc:"每页条数"`
|
||||
}
|
||||
|
||||
// TableListReq 获取可查询表列表请求
|
||||
type TableListReq struct {
|
||||
g.Meta `path:"/public/tables" method:"get" tags:"公共查询" summary:"获取可查询表列表" dc:"获取配置了表结构的同步表列表"`
|
||||
}
|
||||
|
||||
// TableListRes 获取可查询表列表响应
|
||||
type TableListRes struct {
|
||||
List []TableInfo `json:"list" dc:"表列表"`
|
||||
}
|
||||
|
||||
// TableInfo 表信息
|
||||
type TableInfo struct {
|
||||
TableName string `json:"tableName" dc:"表名"`
|
||||
PlatformName string `json:"platformName" dc:"平台名称"`
|
||||
InterfaceName string `json:"interfaceName" dc:"接口名称"`
|
||||
Columns []string `json:"columns" dc:"可用字段列表"`
|
||||
}
|
||||
|
||||
// ColumnListReq 获取表字段列表请求
|
||||
type ColumnListReq struct {
|
||||
g.Meta `path:"/public/tables/{table}/columns" method:"get" tags:"公共查询" summary:"获取表字段列表" dc:"获取指定表的字段列表"`
|
||||
Table string `json:"table" dc:"表名"`
|
||||
}
|
||||
|
||||
// ColumnListRes 获取表字段列表响应
|
||||
type ColumnListRes struct {
|
||||
TableName string `json:"tableName" dc:"表名"`
|
||||
Columns []Column `json:"columns" dc:"字段列表"`
|
||||
}
|
||||
|
||||
// Column 字段信息
|
||||
type Column struct {
|
||||
Name string `json:"name" dc:"字段名"`
|
||||
Type string `json:"type" dc:"字段类型"`
|
||||
Comment string `json:"comment" dc:"字段说明"`
|
||||
}
|
||||
@@ -36,10 +36,10 @@ type DatasourcePlatform struct {
|
||||
// 自定义认证配置 (JSONB)
|
||||
AuthConfig map[string]interface{} `orm:"auth_config" json:"authConfig" description:"自定义认证配置,支持各平台特有的认证方式"`
|
||||
|
||||
// 元数据
|
||||
CreatedBy string `orm:"created_by" json:"createdBy" description:"创建人"`
|
||||
// 元数据(ORM tag 与数据库列名一致:creator/updater)
|
||||
CreatedBy string `orm:"creator" json:"createdBy" description:"创建人"`
|
||||
CreatedAt *time.Time `orm:"created_at" json:"createdAt" description:"创建时间"`
|
||||
UpdatedBy string `orm:"updated_by" json:"updatedBy" description:"更新人"`
|
||||
UpdatedBy string `orm:"updater" json:"updatedBy" description:"更新人"`
|
||||
UpdatedAt *time.Time `orm:"updated_at" json:"updatedAt" description:"更新时间"`
|
||||
Version int `orm:"version" json:"version" description:"版本号(乐观锁)"`
|
||||
}
|
||||
@@ -64,9 +64,9 @@ type DatasourcePlatformCol struct {
|
||||
MaxRetries string
|
||||
RetryDelayMs string
|
||||
AuthConfig string
|
||||
CreatedBy string
|
||||
CreatedBy string // 对应 DB 列 creator
|
||||
CreatedAt string
|
||||
UpdatedBy string
|
||||
UpdatedBy string // 对应 DB 列 updater
|
||||
UpdatedAt string
|
||||
Version string
|
||||
}
|
||||
@@ -91,9 +91,9 @@ var DatasourcePlatformCols = DatasourcePlatformCol{
|
||||
MaxRetries: "max_retries",
|
||||
RetryDelayMs: "retry_delay_ms",
|
||||
AuthConfig: "auth_config",
|
||||
CreatedBy: "created_by",
|
||||
CreatedBy: "creator",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedBy: "updater",
|
||||
UpdatedAt: "updated_at",
|
||||
Version: "version",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user