| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- create database if not exists `open_api_platform`;
- USE `open_api_platform`;
- -- 创建一个名为users的表,用于存储用户信息
- CREATE TABLE if NOT EXISTS `user` (
- `id` BIGINT NOT NULL PRIMARY KEY COMMENT '用户ID',
- `user_account` VARCHAR(255) NOT NULL COMMENT '用户账号',
- `user_password` VARCHAR(255) NOT NULL COMMENT '用户密码',
- `user_name` VARCHAR(255) NOT NULL COMMENT '用户名称',
- `user_avatar` VARCHAR(1024) DEFAULT NULL COMMENT '用户头像',
- `user_role` CHAR(32) NOT NULL DEFAULT '用户' COMMENT '用户角色',
- `access_key` CHAR(32) NOT NULL COMMENT '访问接口的accessKey',
- `secret_key` CHAR(32) NOT NULL COMMENT '访问接口的secretKey',
- `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
- `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
- `delete_flag` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '删除标志,0:未删除,1:已删除'
- ) COMMENT='用户表';
- -- 接口信息
- create table if not exists `interface_info`
- (
- `id` bigint not null auto_increment comment '主键' primary key,
- `name` varchar(256) not null comment '名称',
- `description` varchar(256) null comment '描述',
- `url` varchar(512) not null comment '接口地址',
- `request_header` text null comment '请求头',
- `response_header` text null comment '响应头',
- `status` int default 0 not null comment '接口状态(0-关闭,1-开启)',
- `method` varchar(256) not null comment '请求类型',
- `user_id` bigint not null comment '创建人',
- `create_time` datetime default CURRENT_TIMESTAMP not null comment '创建时间',
- `update_time` datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
- `delete_flag` tinyint default 0 not null comment '是否删除(0-未删, 1-已删)'
- ) comment '接口信息';
- -- 接口参数
- create table if not exists `interface_param`
- (
- `id` bigint not null comment '主键' primary key,
- `interface_info_id` bigint not null comment '接口信息id',
- `name` varchar(256) not null comment '参数名称(参数类型为body时,名称使用body)',
- `description` varchar(256) null comment '参数描述',
- `type` int default 0 not null comment '参数类型(0:query,1:body)',
- `param_type` char(32) default 'string' not null comment '数据类型',
- `user_id` bigint not null comment '创建人',
- `create_time` datetime default CURRENT_TIMESTAMP not null comment '创建时间',
- `update_time` datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
- `delete_flag` tinyint default 0 not null comment '是否删除(0-未删, 1-已删)'
- ) comment '接口参数';
|