# 批量新建

批量批量除了逐条新建API，飞布还提供了批量新建功能，用于快速构建针对数据库的增删改查。

{% embed url="<https://www.bilibili.com/video/BV1CN411c7sm>" %}
02功能介绍 如何用飞布新建API？
{% endembed %}

## 快速操作

1. 点击“批量新建”，打开批量新建页（CRUD生成器）
2. 在下拉菜单中，选择数据库，并选择对应表
3. 在表格中逐项设置字段
   1. 主键选择：默认选择当前表的主键，主要用于单条记录操作的API生成，如详情、删除等
   2. 生成接口：当前支持7种不同类型的接口
   3. API目录：当前API生成后所在的目录
   4. 更多设置：高级设置，默认情况下折叠
      1. 授权接口：设置哪些接口需要授权
      2. 登录鉴权：设置所选接口的授权策略，包括是否开启登录以及所需角色
      3. 别名：生成的API，默认基于表名合成，这里可以自定义表名
4. 字段选择：选择生成查询类API时要返回的字段或设置变更类API时入参其是否必填，同时也支持选择关联表包含的字段
5. 点击“创建”按钮，并在弹窗中，进行响应操作
   1. 无重复：点击“全部创建”则生成所有API
   2. 重复：选择“跳过已有API”则只生成不存在的API；选择“全部覆盖”则重新生成所有API

<figure><img src="/files/zw9437bCIpERwwjPd9SX" alt=""><figcaption><p>批量新建页面</p></figcaption></figure>

## 原理解析

批量新建本质上是模板生成。

1. 内省选中的数据库，获得数据库的SDL
2. 从SDL中解析选中表的字段列表及对应数据类型
3. 将用户设置的选项匹配到预制GraphQL模板中，批量生成OPERATION


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fireboom.io/v1.0/ji-chu-ke-shi-hua-kai-fa/api-gou-jian/ding-yue.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
