# Generated by ShowAPI OpenAPI generator
# source: market/2028
# generated-at: 2026-06-26T06:01:35.785Z
openapi: 3.0.3
info:
  title: MariaDB转HTTP接口
  description: 可将您的MariaDB数据库接口转化为HTTP接口，大大提升开发效率。包括增删查改以及数据库级别的建表、建索引等所有指令。也可以自定义SQL语句并嵌入变量的方式调用。演示时默认使用的是公用测试库，数据不定期清理。如需要用于生产环境， 请绑定自己的postgreSQL数据即可。
  termsOfService: https://www.showapi.com/helpcenter/view#/4019/2
  version: 1.0.0
servers:
  - url: https://route.showapi.com
paths:
  /2028-11:
    x-pointCode: 11
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: select-one-使用预定义sql模板
      description: 自定义sql 语句，在sql里面挖空嵌入变量，变量由客户端post过来。系统自带反sql 注射功能。
      responses:
        "200":
          description: 成功响应
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ShowapiResEnvelope"
                  - type: object
                    properties:
                      showapi_res_body:
                        type: object
                        properties:
                          ret_code:
                            type: string
                            description: 0为操作成功
                        description: 业务返回体
      operationId: 2028_11_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                showapi_sql_params:
                  type: object
                  description: 传入的sql参数，对应于sql_name模板中的变量。
                showapi_sql_name:
                  type: string
                  description: 自定义sql的模板名称。本例中sql语句为：select * from user where id={{@id}}
                ds_id:
                  type: string
                  description: 数据源
              required:
                - showapi_sql_params
                - showapi_sql_name
                - ds_id
  /2028-10:
    x-pointCode: 10
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: drop-table
      description: 删除某张表。危险！
      responses:
        "200":
          description: 成功响应
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ShowapiResEnvelope"
                  - type: object
                    properties:
                      showapi_res_body:
                        type: object
                        properties:
                          ret_code:
                            type: string
                            description: 0为操作成功
                        description: 业务返回体
      operationId: 2028_10_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                table:
                  type: string
                  description: 要删除的表名。
                ds_id:
                  type: string
                  description: 数据源
              required:
                - table
                - ds_id
  /2028-9:
    x-pointCode: 9
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: show-tables
      description: 返回当前库中的所有数据表。
      responses:
        "200":
          description: 成功响应
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ShowapiResEnvelope"
                  - type: object
                    properties:
                      showapi_res_body:
                        type: object
                        properties:
                          table_list:
                            type: string
                            description: 返回所有数据表列表。
                          ret_code:
                            type: string
                            description: 0为操作成功
                        description: 业务返回体
      operationId: 2028_9_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                ds_id:
                  type: string
                  description: 数据源
              required:
                - ds_id
  /2028-8:
    x-pointCode: 8
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: create-table
      description: 创建一张新表。
      responses:
        "200":
          description: 成功响应
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ShowapiResEnvelope"
                  - type: object
                    properties:
                      showapi_res_body:
                        type: object
                        properties:
                          ret_code:
                            type: string
                            description: 0为创建成功
                        description: 业务返回体
      operationId: 2028_8_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                table:
                  type: string
                  description: 表名
                fields_param:
                  type: string
                  description: 一个map对象，key值是字段名，value是字段类型。其中字段类型与数据库字段定义相同。
                ds_id:
                  type: string
                  description: 数据源
              required:
                - table
                - ds_id
  /2028-7:
    x-pointCode: 7
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: delete
      description: 根据条件，删除0或多条记录。
      responses:
        "200":
          description: 成功响应
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ShowapiResEnvelope"
                  - type: object
                    properties:
                      showapi_res_body:
                        type: object
                        properties:
                          ret_code:
                            type: string
                            description: 0为操作成功
                          affected_rows:
                            type: string
                            description: 此次接口操作影响的记录数。>=1时为实际删除了记录。
                        description: 业务返回体
      operationId: 2028_7_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                table:
                  type: string
                  description: 表名
                where:
                  type: string
                  description: 可写复杂sql语句，重点要求：传入变量必须用?号代替
                where_param:
                  type: string
                  description: 一个json的lists类型字符串。对应where条件中的问号变量，区分字符串和数字。本值在替换where中的?号时，会经过反sql注射过滤。
                ds_id:
                  type: string
                  description: 数据源
              required:
                - table
                - ds_id
  /2028-6:
    x-pointCode: 6
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: insert
      description: 将一条记录插入一张表。
      responses:
        "200":
          description: 成功响应
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ShowapiResEnvelope"
                  - type: object
                    properties:
                      showapi_res_body:
                        type: object
                        properties:
                          insert_id:
                            type: string
                            description: 返回插入新记录的id值。
                          ret_code:
                            type: string
                            description: 0为操作成功
                          affected_rows:
                            type: string
                            description: 此次接口操作影响的记录数。插入成功此值为1。
                        description: 业务返回体
      operationId: 2028_6_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                table:
                  type: string
                  description: 表名
                insert_data:
                  type: string
                  description: 一个map的k=v结构，指示向哪个字段插入什么值。此map需要做json字符串处理。
                ds_id:
                  type: string
                  description: 数据源
              required:
                - table
                - ds_id
  /2028-5:
    x-pointCode: 5
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: update
      description: 根据条件，查询不同的记录列表。
      responses:
        "200":
          description: 成功响应
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ShowapiResEnvelope"
                  - type: object
                    properties:
                      showapi_res_body:
                        type: object
                        properties:
                          affected_rows:
                            type: string
                            description: 更新记录数。>=1为实际操作成功。
                          ret_code:
                            type: string
                            description: 0为操作成功
                        description: 业务返回体
      operationId: 2028_5_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                table:
                  type: string
                  description: 表名
                where:
                  type: string
                  description: 可写复杂sql语句，重点要求：传入变量必须用?号代替
                where_param:
                  type: string
                  description: 一个json的lists类型字符串。对应where条件中的问号变量，区分字符串和数字。本值在替换where中的?号时，会经过反sql注射过滤。
                set_data:
                  type: string
                  description: 需要更新的字段
                set_param:
                  type: string
                  description: 字段被更新为什么值。其个数需要和update_data中的?号数量相同。
                ds_id:
                  type: string
                  description: 数据源
              required:
                - table
                - ds_id
  /2028-4:
    x-pointCode: 4
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: select-distinct
      description: 根据条件，查询不同的记录列表。
      responses:
        "200":
          description: 成功响应
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ShowapiResEnvelope"
                  - type: object
                    properties:
                      showapi_res_body:
                        type: object
                        properties:
                          list:
                            type: string
                            description: 一个list结构，查询出来的记录列表。
                          ret_code:
                            type: string
                            description: 0为操作成功
                        description: 业务返回体
      operationId: 2028_4_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                table:
                  type: string
                  description: 表名
                where:
                  type: string
                  description: 可写复杂sql语句，重点要求：传入变量必须用?号代替
                where_param:
                  type: string
                  description: 一个json的lists类型字符串。对应where条件中的问号变量，区分字符串和数字。本值在替换where中的?号时，会经过反sql注射过滤。
                distinct:
                  type: string
                  description: 需要distinct的字段
                ds_id:
                  type: string
                  description: 数据源
              required:
                - table
                - ds_id
  /2028-3:
    x-pointCode: 3
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: select-count
      description: 根据条件上，查询某个table的记录条数。
      responses:
        "200":
          description: 成功响应
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ShowapiResEnvelope"
                  - type: object
                    properties:
                      showapi_res_body:
                        type: object
                        properties:
                          count_num:
                            type: string
                            description: 记录数量。
                          ret_code:
                            type: string
                            description: 0为操作成功
                        description: 业务返回体
      operationId: 2028_3_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                table:
                  type: string
                  description: 表名
                where:
                  type: string
                  description: 可写复杂sql语句，重点要求：传入变量必须用?号代替
                where_param:
                  type: string
                  description: 一个json的lists类型字符串。对应where条件中的问号变量，区分字符串和数字。本值在替换where中的?号时，会经过反sql注射过滤。
                ds_id:
                  type: string
                  description: 数据源
              required:
                - table
                - ds_id
  /2028-2:
    x-pointCode: 2
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: select-list
      description: 根据条件上，查询某个table的记录列表。
      responses:
        "200":
          description: 成功响应
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ShowapiResEnvelope"
                  - type: object
                    properties:
                      showapi_res_body:
                        type: object
                        properties:
                          list:
                            type: string
                            description: 返回的记录列表。
                          ret_code:
                            type: string
                            description: 0为操作成功。
                          ret_num:
                            type: string
                            description: 返回的记录数。
                        description: 业务返回体
      operationId: 2028_2_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                ds_id:
                  type: string
                  description: 数据源
                table:
                  type: string
                  description: 表名
                fields:
                  type: string
                  description: 需要返回的字段名
                where:
                  type: string
                  description: 可写复杂sql语句，重点要求：传入变量必须用?号代替
                where_param:
                  type: string
                  description: 一个json的lists类型字符串。对应where条件中的问号变量，区分字符串和数字。本值在替换where中的?号时，会经过反sql注射过滤。
                order_by:
                  type: string
                  description: 排序方式
                limit:
                  type: number
                  minimum: 1
                  maximum: 1000
                  description: 列表最大长度。
              required:
                - ds_id
                - table
  /2028-1:
    x-pointCode: 1
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: select-one
      description: 查询某个table的一条记录。
      responses:
        "200":
          description: 成功响应
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/ShowapiResEnvelope"
                  - type: object
                    properties:
                      showapi_res_body:
                        type: object
                        properties:
                          one:
                            type: string
                            description: 一个map结构，代表查询出来的一条记录。
                          ret_code:
                            type: string
                            description: 0为操作成功
                        description: 业务返回体
      operationId: 2028_1_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                table:
                  type: string
                  description: 表名
                fields:
                  type: string
                  description: 需要返回的字段名
                where:
                  type: string
                  description: 可写复杂sql语句，重点要求：传入变量必须用?号代替
                where_param:
                  type: string
                  description: 对应where条件中的问号变量，区分字符串和数字。本值在替换where中的?号，会经过反sql注射。
                order_by:
                  type: string
                  description: 排序参数
                ds_id:
                  type: string
                  description: 数据源
              required:
                - table
                - ds_id
components:
  securitySchemes:
    AppKeyAuth:
      type: apiKey
      in: query
      name: appKey
      description: 从 ShowAPI 控制台获取的 appKey，管理地址：https://www.showapi.com/console#/myApp
  schemas:
    ShowapiResEnvelope:
      type: object
      description: ShowAPI 统一返回包裹（业务数据位于 showapi_res_body）
      properties:
        showapi_res_code:
          type: integer
          description: API 返回的状态码
        showapi_res_error:
          type: string
          description: API 返回的错误信息
        showapi_res_id:
          type: string
          description: API 请求的唯一标识
        showapi_fee_num:
          type: integer
          description: API 调用计费次数
security:
  - AppKeyAuth: []
externalDocs:
  url: https://www.showapi.com/apiGateway/view/2028?tab=book
x-apiCode: "2028"
x-is-own: false
x-is-op: true
