Files
X-Agents/team-require/api/subtable-list.md
DESKTOP-72TV0V4\caoxiaozhu b2bc9988a9 feat: 重构前后端架构,添加Go后端和Python Agent服务
- 新增 Go 语言后端服务(server/),包含用户认证、Agent管理、数据库连接等API
- 新增 Python Agent 服务(agent/),实现Agent核心逻辑和工具集
- 前端从原生HTML迁移到Vue.js框架(web/src/)
- 添加 Docker Compose 支持(docker-compose.yml)
- 添加项目架构文档(docs/ARCHITECTURE.md)
- 添加环境变量示例(.env.example)和本地启动脚本(start-local.ps1)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 16:39:42 +08:00

1.8 KiB
Raw Blame History

获取子表列表

接口地址

GET /sub-table/database/:database_id

路径参数

参数 类型 必填 说明
database_id string 数据库ID

返回参数

参数 类型 说明
list array 子表列表

list[] 详情

参数 类型 说明
id string 子表ID
database_id string 关联的数据库ID
parent_table string 原始表名
sub_table_name string 子表别名
sub_table_comment string 子表注释
mapping_type string 映射类型
relation_field string 关联字段
relation_type string 关联类型
fields array 字段映射列表
ddl string 建表 DDL带 COMMENT
created_at string 创建时间

fields[] 详情

参数 类型 说明
column_name string 列名
mapped_name string 中文映射名

返回示例

{
  "list": [
    {
      "id": "xxx-xxx",
      "database_id": "database-xxx",
      "parent_table": "users",
      "sub_table_name": "用户表",
      "sub_table_comment": "用户信息",
      "mapping_type": "horizontal",
      "relation_field": "id",
      "relation_type": "one_to_many",
      "fields": [
        {"column_name": "id", "mapped_name": "用户ID"},
        {"column_name": "name", "mapped_name": "用户名"}
      ],
      "ddl": "CREATE TABLE `users` (\n  `id` int(10) unsigned NOT NULL COMMENT '用户ID'\n  ...\n)",
      "created_at": "2026-03-06T15:00:00Z"
    }
  ]
}

使用场景

用于恢复映射状态:

  1. 用户点击已存在的数据库的 "Map Tables" 按钮
  2. 调用此接口获取已保存的子表信息
  3. 根据 parent_table 勾选已选择的表
  4. 根据 fields 恢复字段映射