Table mode
Table mode uses a two-dimensional table to select fields and conditions, and the platform generates SQL automatically. It is suitable for business users who are not familiar with SQL to quickly develop standard query APIs.
Creation steps
- Go to the Workbench and click Table Mode.
- Select a data source and schema.
- Select a table; the platform loads column names, types and descriptions automatically.
- Select items in the field table:
| Selection type | Effect |
|---|---|
| Condition parameter | Generates a request parameter for WHERE filtering |
| Response parameter | Generates SELECT columns and response fields |
| Sort field | Added to the sort list; ascending or descending order can be selected |
- Confirm parameter types, required flags, examples and descriptions in the right panel.
- After tests pass, save and release.
Generation logic
Selections on the page are converted to SQL:
SELECT id, order_no, amount, status
FROM orders
WHERE status = #{status}
AND created_at >= #{startTime}
ORDER BY created_at DESC
- Condition parameters are automatically populated in the request parameter panel on the right; custom additions are not supported.
- Response parameters are linked to the response parameter panel on the right.
- Field descriptions come from database comments.
- Sort fields support multiple fields;
ORDER BYis generated in page order. - Condition operators default to
=; use Filter Conditions to configurelike, range comparisons orinwith multiple values.
Visual filter configuration
Selecting a condition parameter only produces an equality condition. Use the Filter Conditions dialog to configure like, >=, in and other operators.
How to open
- After selecting a table, click Filter Conditions in the header of the Select Parameters card.
- Add, edit or remove conditions in the dialog, then click OK to write them back to the request parameter list. Cancel discards every change.
The button is disabled when no table is selected, or when the operation type is not a query (insert / delete) — only query APIs generate a WHERE clause, so operators configured for other types would have no effect.
Configurable fields
| Column | Description |
|---|---|
| Filter field | Selected from the columns of the current table; searchable; each option shows "column name + comment" |
| Parameter name | Generated by camel-casing the column name; editable |
| Operator | =, !=, >, >=, <, <=, like, not like, in, not in |
| Parameter type | String, Int, Float, Date, Array, Boolean; mapped from the column type when a field is selected |
| Required | Off by default and wrapped in <if>, ignored when not passed; when on, it becomes a hard condition that must be passed |
| Default value | Default parameter value; optional |
| Example | Used for documentation and test prefill only; separate multiple values of in with commas |
| Delete | Removes the condition together with its request parameter |
Operators and generated SQL
| Operator | Generated WHERE fragment |
|---|---|
=, !=, >, >=, <, <= | Comparison expressions such as col>=#{param} |
like / not like | col like concat('%', concat(#{param}, '%')) |
in / not in | col in <foreach collection="param" item="item" open="(" separator="," close=")">#{item}</foreach> |
- Values are always bound with
#{}; only column names come from table metadata, so user input is never concatenated. - Conditions are joined with
andin list order; when the first condition is optional and not passed,<where>strips the leadingand. - Optional numeric conditions (
Int/Float/Double/Boolean) only checknull, so a passed0is not dropped.
Synchronization and validation
- Linked with the request parameter panel: both edit the same set of parameters. Renaming a parameter or changing its type, required flag or default value in the dialog is reflected in the panel, and vice versa.
- Operators are maintained in the dialog only: the operator column in the request parameter panel is read-only to avoid conflicting edits.
- Parameter name rules: Chinese, English letters, digits and underscores only, and it must not start with a digit. Names must be unique within one API.
pageNum/pageSizeare reserved for pagination and cannot be used when pagination is off. in/not inrequiresArray: choosingin/not inswitches the parameter type toArray, andArrayparameters only support=,inandnot in; switching back to a scalar type resets the operator to=.- Inline validation: rows with an empty, invalid or duplicate parameter name, no filter field, or an
inoperator on a non-Arraytype are highlighted, and OK stays disabled with the reason shown. - Pagination parameters are excluded:
pageNum/pageSizenever appear in the condition list. - Non-relational data sources: for MongoDB, Elasticsearch and similar sources the operator is locked to
=, and other operators are rejected on save.
Relationship with result preview
Result preview only checks the table structure and samples data; it does not apply filter conditions, so previewed data is unaffected by them. Use Test and fill in Query parameters to verify the actual filtering.
Generated example
Conditions: status = (required), amount >=, order_no like, tenant_id in:
SELECT id, order_no, amount, status
FROM orders
<where>
status = #{status}
and amount >= #{minAmount}
and order_no like concat('%', concat(#{orderNo}, '%'))
and tenant_id in
<foreach collection="tenantId" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</where>
Parameters and pagination
Request parameters in table mode come from the selected condition fields:
- The parameter location defaults to Query and can be adjusted as needed.
- Types are inferred from column types and must be confirmed manually.
- After pagination is selected, callers must pass
pageNumandpageSize. pageSizehas an upper limit of 1000.
Capability boundaries
| Item | Limitation |
|---|---|
| Operation type | Query only; insert, update and delete are not available in table mode |
| HTTP method | PUT / PATCH / DELETE are not provided |
| Number of tables | Single table only; JOIN is not supported |
| Custom SQL | Not supported; use script mode for complex queries |
| Hive data source | Insert is not provided; update and delete are also unavailable |
| Elasticsearch | HTTP methods and operation types are further narrowed; refer to the options available on the page |
| Filter operators | Only query APIs can configure them; non-relational data sources such as MongoDB / Elasticsearch support = only |
| Condition combination | Conditions are always joined with and; or and grouping are not supported |
| Parameters | Cannot be added manually; they can only come from selected fields |
Use SQL script mode when you need multi-table joins, aggregation, subqueries, dynamic conditions, batch writes or stored procedures.
Testing and release
Table APIs also support:
- Online testing: fill in Query / Body / Header according to parameter locations.
- Test cases: save request snapshots and run regression.
- Mock: simulate responses when real data is unavailable.
- Release to environments, version management and synchronization.
The release flow is the same as script mode. See Workbench overview.
FAQ
| Symptom | Cause | Resolution |
|---|---|---|
| Field has no description | The database does not maintain comments | Add the description manually in response parameters |
| Query result is empty | Condition parameters are not passed or types do not match | Check required flags and parameter types |
| Cannot select insert/update | Table mode supports queries only | Switch to script mode |
| Sorting does not take effect | No sort field is selected or no direction is set | Confirm the settings in the sort list |
| Parameters cannot be added | Table mode parameters are linked to fields | Use script mode or adjust the table fields |
| Filter Conditions button is disabled | No table is selected, or the operation type is not a query | Select a table first; use script mode for insert/delete APIs |
like / >= has no effect | The data source is non-relational, or the API is not a query | Non-relational sources support = only; make sure the operation type is query |
| Preview shows no filtering | Result preview does not run the WHERE clause | Use Test with parameters to verify |
| Save reports an invalid parameter name | The name contains spaces, dots or hyphens, or starts with a digit | Use Chinese characters, letters, digits and underscores |
| Save reports a duplicate parameter name | It clashes with an existing request or pagination parameter | Rename it or delete the duplicate condition in the dialog |