# Generated by ShowAPI OpenAPI generator
# source: market/27
# generated-at: 2026-06-26T01:58:38.256Z
openapi: 3.0.3
info:
  title: MySQL转HTTP接口
  description: |-
    可将您的Mysql数据库接口转化为http接口，提高开发便利性。提供记录的增删查改、count、discint、建表等功能。 
    演示时默认使用的是公用测试库，数据不定期清理。如需要用于生产环境， 请绑定自己MySQL数据即可。
  termsOfService: https://www.showapi.com/helpcenter/view#/4019/2
  version: 1.0.0
servers:
  - url: https://route.showapi.com
paths:
  /27-19:
    x-pointCode: 19
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: delete-使用预定义sql模板
      description: |-
        使用预定义sql模板删除记录。sql语句为： delete from  user  where id={{@id}} 
         。其中name和id为client端post请求的参数。
      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: 27_19_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语句是：delete from  user  where id={{@id}}
                ds_id:
                  type: string
                  description: 数据源
              required:
                - showapi_sql_params
                - showapi_sql_name
                - ds_id
  /27-18:
    x-pointCode: 18
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: update-使用预定义sql模板
      description: 使用预定义sql模板更新记录。sql语句为：update user  set name={{@name}} where id={{@id}}。其中name和id为client端post请求的参数。
      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: 27_18_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模板是： update user  set name={{@name}} where id={{@id}}
                ds_id:
                  type: string
                  description: 数据源
              required:
                - showapi_sql_params
                - showapi_sql_name
                - ds_id
  /27-16:
    x-pointCode: 16
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: select-list-使用预定义sql模板
      description: 使用预定义sql模板查询记录。sql语句为：select * from user where name={{@name}} and age={{@age}} limit 3。其中age和name为client端post请求的参数。
      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: 27_16_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 name={{@name}} and age={{@age}} limit 3
                ds_id:
                  type: string
                  description: 数据源
              required:
                - showapi_sql_params
                - showapi_sql_name
                - ds_id
  /27-15:
    x-pointCode: 15
    x-mode: mapping
    x-read-timeout: 10
    x-connect-timeout: 10
    post:
      summary: select-one-使用预定义sql模板
      description: 使用预定义sql模板查询记录。sql语句为：select * from user where id={{@id}}。其中age和name为client端post请求的参数。
      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: 27_15_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
  /27-14:
    x-pointCode: 14
    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: 27_14_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
  /27-13:
    x-pointCode: 13
    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: 27_13_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                ds_id:
                  type: string
                  description: 数据源
              required:
                - ds_id
  /27-12:
    x-pointCode: 12
    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: 27_12_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
                - fields_param
                - ds_id
  /27-11:
    x-pointCode: 11
    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: 27_11_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                ds_id:
                  type: string
                  description: 数据源
                table:
                  type: string
                  description: 表名
                where:
                  type: string
                  description: 可写复杂sql语句，重点要求：传入变量必须用?号代替
                where_param:
                  type: string
                  description: 一个json的list类型字符串。对应where条件中的问号变量，区分字符串和数字。本值在替换where中的?号时，会经过反sql注射过滤。
              required:
                - ds_id
                - table
  /27-10:
    x-pointCode: 10
    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: 27_10_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                table:
                  type: string
                  description: 表名
                insert_data:
                  type: object
                  description: 一个map的k=v结构，指示向哪个字段插入什么值。此map需要做json字符串处理。
                ds_id:
                  type: string
                  description: 数据源
              required:
                - table
                - ds_id
  /27-9:
    x-pointCode: 9
    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: 27_9_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                ds_id:
                  type: string
                  description: 数据源
                table:
                  type: string
                  description: 表名
                where:
                  type: string
                  description: 可写复杂sql语句，重点要求：传入变量必须用?号代替
                where_param:
                  type: string
                  description: 一个json的list类型字符串。对应where条件中的问号变量，区分字符串和数字。本值在替换where中的?号时，会经过反sql注射过滤。
                set_data:
                  type: string
                  description: 需要更新的字段
                set_param:
                  type: string
                  description: 字段被更新为什么值。其个数需要和update_data中的?号数量相同。
              required:
                - ds_id
                - table
  /27-8:
    x-pointCode: 8
    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: 27_8_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                ds_id:
                  type: string
                  description: 数据源
                table:
                  type: string
                  description: 表名
                where:
                  type: string
                  description: 可写复杂sql语句，重点要求：传入变量必须用?号代替
                where_param:
                  type: string
                  description: 一个json的list类型字符串。对应where条件中的问号变量，区分字符串和数字。本值在替换where中的?号时，会经过反sql注射过滤。
                distinct:
                  type: string
                  description: 需要distinct的字段
              required:
                - ds_id
                - table
  /27-7:
    x-pointCode: 7
    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: 27_7_POST
      parameters: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                ds_id:
                  type: string
                  description: 数据源
                table:
                  type: string
                  description: 表名
                where:
                  type: string
                  description: 可写复杂sql语句，重点要求：传入变量必须用?号代替
                where_param:
                  type: string
                  description: 一个json的list类型字符串。对应where条件中的问号变量，区分字符串和数字。本值在替换where中的?号时，会经过反sql注射过滤。
              required:
                - ds_id
                - table
  /27-6:
    x-pointCode: 6
    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: 27_6_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的list类型字符串。对应where条件中的问号变量，区分字符串和数字。本值在替换where中的?号时，会经过反sql注射过滤。
                order_by:
                  type: string
                  description: 排序方式
                limit:
                  type: number
                  minimum: 1
                  maximum: 1000
                  description: 列表最大长度。
              required:
                - ds_id
                - table
  /27-5:
    x-pointCode: 5
    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: 27_5_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/27?tab=book
x-apiCode: "27"
x-is-own: false
x-is-op: true
