database-open-platform.sql 6.5 KB
DROP TABLE IF EXISTS `t_platform_customer`;
CREATE TABLE `t_platform_customer` (
    `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `customer_name` VARCHAR(32) DEFAULT NULL COMMENT '客户名称',
    `contact_person` VARCHAR(32) DEFAULT NULL COMMENT '联系人',
    `password` VARCHAR(64) DEFAULT NULL COMMENT '密码',
    `contact_number` VARCHAR(11) DEFAULT NULL COMMENT '联系电话',
    `contact_email` VARCHAR(32) DEFAULT NULL COMMENT '联系邮箱',
    `province` INT(11) DEFAULT NULL COMMENT '省份 sys_area的id',
    `city` INT(11) DEFAULT NULL COMMENT '城市 sys_area的id',
    `address` VARCHAR(128) DEFAULT NULL COMMENT '详细地址',
    `status` TINYINT(2) DEFAULT NULL COMMENT '账号状态 0 停用 1 正常 2 待审核 3 审核未通过',
    `public_key` VARCHAR(256) DEFAULT NULL COMMENT '公钥',
    `private_key` VARCHAR(256) DEFAULT NULL COMMENT '私钥',
    `channel_number` VARCHAR(32) DEFAULT NULL COMMENT '渠道号',
    `create_time` DATETIME DEFAULT NULL COMMENT '创建d时间',
    `update_time` DATETIME DEFAULT NULL COMMENT '更新时间',
    `create_by` INT(11) DEFAULT NULL COMMENT '创建人',
    `update_by` INT(11) DEFAULT NULL COMMENT '更新人',
    `remark` VARCHAR(50) DEFAULT NULL COMMENT '备注',
    PRIMARY KEY (`id`),
    UNIQUE KEY `contact_channel_number` (`contact_number`, `channel_number`)
) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT ='客户管理表';

DROP TABLE IF EXISTS `t_platform_customer`;
CREATE TABLE `t_platform_device` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `device_sn` varchar(32) DEFAULT NULL COMMENT '设备SN',
  `device_type` varchar(32) DEFAULT NULL COMMENT '类型',
  `customer_id` int(11) DEFAULT NULL COMMENT '客户id  t_platform_customer表的id',
  `activat_time` datetime DEFAULT NULL COMMENT '激活时间',
  `status` tinyint(2) DEFAULT NULL COMMENT '设备状态 0 异常 1 正常',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `create_by` int(11) DEFAULT NULL COMMENT '创建人',
  `update_by` int(11) DEFAULT NULL COMMENT '更新人',
  `remark` varchar(50) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='设备管理表';

DROP TABLE IF EXISTS `t_platform_user`;
CREATE TABLE `t_platform_user` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `nickname` varchar(32) DEFAULT NULL COMMENT '昵称,账号',
  `contact_number` varchar(11) DEFAULT NULL COMMENT '联系电话',
  `wechat_id` varchar(32) DEFAULT NULL COMMENT '微信ID',
  `province` int(11) DEFAULT NULL COMMENT '省份 sys_area的id',
  `city` int(11) DEFAULT NULL COMMENT '城市 sys_area的id',
  `customer_id` int(11) DEFAULT NULL COMMENT '客户id  t_platform_customer表的id',
  `last_login_time` datetime DEFAULT NULL COMMENT '最后登录时间',
  `app_account_id` int(11) DEFAULT NULL COMMENT 'APP 账户ID',
  `tu_ya_id` int(11) DEFAULT NULL COMMENT '涂鸦平台ID',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间  注册时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `create_by` int(11) DEFAULT NULL COMMENT '创建人',
  `update_by` int(11) DEFAULT NULL COMMENT '更新人',
  `remark` varchar(50) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`),
  UNIQUE KEY `contact_number` (`contact_number`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='用户管理表';

DROP TABLE IF EXISTS `t_platform_api`;
CREATE TABLE `t_platform_api` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `api_classification` tinyint(2) DEFAULT NULL COMMENT 'API分类 1 授权管理 2 设备管理 3 数据服务',
  `api_name` varchar(32) DEFAULT NULL COMMENT 'API名称',
  `request_method` tinyint(2) DEFAULT NULL COMMENT '请求方式 1 GET 2 POST',
  `api_interface` varchar(255) DEFAULT NULL COMMENT 'API接口',
  `description` varchar(128) DEFAULT NULL COMMENT '说明',
  `status` tinyint(2) DEFAULT NULL COMMENT '状态 0 停用 1 可用',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `create_by` int(11) DEFAULT NULL COMMENT '创建人',
  `update_by` int(11) DEFAULT NULL COMMENT '更新人',
  `remark` varchar(50) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='api管理表';


DROP TABLE IF EXISTS `t_platform_api_call`;
CREATE TABLE `t_platform_api_call` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `customer_id` int(11) DEFAULT NULL COMMENT '客户id t_platform_customer表的id',
  `api_id` int(11) DEFAULT NULL COMMENT '调用API id  t_platform_api 的id',
  `call_result` tinyint(2) DEFAULT NULL COMMENT '调用结果 0 失败 1 成功',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间 访问时间',
  `create_by` int(11) DEFAULT NULL COMMENT '创建人',
  `remark` varchar(50) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='api调用表';

DROP TABLE IF EXISTS `t_platform_ad`;
CREATE TABLE `t_platform_ad` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `title` varchar(32) DEFAULT NULL COMMENT '标题',
  `image` varchar(128) DEFAULT NULL COMMENT '图片',
  `position` tinyint(2) DEFAULT NULL COMMENT '位置  1 商城banner 2 智能-家 3 启动页',
  `interface_type` tinyint(2) DEFAULT NULL COMMENT ' 界面类型 1 APP 2 H5',
  `interface_url` varchar(128) DEFAULT NULL COMMENT '界面参数',
  `status` tinyint(2) DEFAULT NULL COMMENT '是否上架 0 下架 1 上架',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间 添加时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `create_by` int(11) DEFAULT NULL COMMENT '创建人',
  `update_by` int(11) DEFAULT NULL COMMENT '更新人',
  `remark` varchar(50) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='广告管理表';

DROP TABLE IF EXISTS `t_platform_app_download`;
CREATE TABLE `t_platform_app_download` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `customer_id` int(11) DEFAULT NULL COMMENT '客户id t_platform_customer表的id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间 下载时间',
  `create_by` int(11) DEFAULT NULL COMMENT '创建人',
  `remark` varchar(50) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='APP下载数量表';