You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
205 lines
11 KiB
205 lines
11 KiB
-- -- 用户基本信息表
|
|
-- DROP TABLE IF EXISTS `t_sys_user`;
|
|
-- CREATE TABLE `t_sys_user` (
|
|
-- `id` bigint(20) NOT NULL,
|
|
-- `name` varchar(32) DEFAULT '' COMMENT '用户名称',
|
|
-- `gender`tinyint(1) unsigned DEFAULT 0 COMMENT '性别 0女 1男',
|
|
-- `avatar_url` varchar(255) DEFAULT '' COMMENT '头像',
|
|
-- `country` varchar(32) DEFAULT '' COMMENT '国家',
|
|
-- `province` varchar(32) DEFAULT '' COMMENT '省份',
|
|
-- `city` varchar(32) DEFAULT '' COMMENT '城市',
|
|
-- `phone` varchar(32) DEFAULT '' COMMENT '手机号',
|
|
-- `id_card` varchar(32) DEFAULT '' COMMENT '身份证号',
|
|
-- `power` tinyint(1) unsigned DEFAULT 0 COMMENT '访问权限 0客户端 1开放平台 3全部',
|
|
|
|
-- `operator` bigint(20) DEFAULT 0 COMMENT '操作人id',
|
|
-- `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '创建日期',
|
|
-- `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改日期',
|
|
-- `rec_status` tinyint(1) unsigned DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
|
|
-- PRIMARY KEY (`id`) USING BTREE
|
|
-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='用户基本信息表';
|
|
|
|
-- -- 用户认证信息表
|
|
-- DROP TABLE IF EXISTS `t_sys_auth`;
|
|
-- CREATE TABLE `t_sys_auth` (
|
|
-- `id` bigint(20) NOT NULL,
|
|
-- `user_id` bigint(20) DEFAULT 0 COMMENT '用户id',
|
|
-- `identify_type` tinyint(2) unsigned DEFAULT 0 COMMENT '认证的类型 0微信小程序,1电话,2邮箱,3账号,4微信公众号,5微信网页登陆,6微博,7企业微信',
|
|
-- `identifier`varchar(32) DEFAULT '' COMMENT '用户标识()手机号等',
|
|
-- `credential` varchar(32) DEFAULT '' COMMENT '用户凭证/密码',
|
|
-- `salt` varchar(64) DEFAULT '' COMMENT '盐,加密时所需',
|
|
|
|
-- `operator` bigint(20) DEFAULT 0 COMMENT '操作人id',
|
|
-- `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '创建日期',
|
|
-- `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改日期',
|
|
-- `rec_status` tinyint(1) unsigned DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
|
|
-- PRIMARY KEY (`id`) USING BTREE,
|
|
-- INDEX `auth_user_index`(`user_id`) USING BTREE,
|
|
-- INDEX `auth_identify_type_index`(`identify_type`) USING BTREE,
|
|
-- INDEX `auth_identifier_index`(`identifier`) USING BTREE
|
|
-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='用户认证信息表';
|
|
|
|
-- -- 用户登录记录表
|
|
-- DROP TABLE IF EXISTS `t_sys_signin_log`;
|
|
-- CREATE TABLE `t_sys_signin_log` (
|
|
-- `id` bigint(20) NOT NULL,
|
|
-- `user_id` bigint(20) DEFAULT 0 COMMENT '用户id',
|
|
-- `time`bigint(20) DEFAULT 0 COMMENT '登录时间',
|
|
-- `client_type` tinyint(1) unsigned DEFAULT 0 COMMENT '客户端类型 0H5 1App',
|
|
-- `sidentify_type` tinyint(1) unsigned DEFAULT 0 COMMENT '登录类型 0微信小程序,1电话,2邮箱,3账号,4微信公众号,5微信网页登陆,6微博,7企业微信',
|
|
-- `ip_address` varchar(64) DEFAULT '' COMMENT 'ip地址',
|
|
|
|
-- `operator` bigint(20) DEFAULT 0 COMMENT '操作人id',
|
|
-- `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '创建日期',
|
|
-- `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改日期',
|
|
-- `rec_status` tinyint(1) unsigned DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
|
|
-- PRIMARY KEY (`id`) USING BTREE,
|
|
-- INDEX `signin_user_index`(`user_id`) USING BTREE,
|
|
-- INDEX `signin_client_type_index`(`client_type`) USING BTREE,
|
|
-- INDEX `signin_sidentify_type_index`(`sidentify_type`) USING BTREE
|
|
-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='用户登录记录表';
|
|
|
|
|
|
|
|
-- -- 业务信息表
|
|
-- DROP TABLE IF EXISTS `t_sys_business`;
|
|
-- CREATE TABLE `t_sys_business` (
|
|
-- `id` bigint(20) NOT NULL,
|
|
-- `name` varchar(64) DEFAULT '' COMMENT '名称',
|
|
-- `code` varchar(64) DEFAULT '' COMMENT 'code',
|
|
-- `description` VARCHAR(512) DEFAULT '' COMMENT '业务描述',
|
|
-- `url` varchar(512) DEFAULT '' COMMENT '请求路径',
|
|
-- `app_id` varchar(64) DEFAULT '' COMMENT '业务appId',
|
|
-- `secret` varchar(64) DEFAULT '' COMMENT 'secret',
|
|
-- `creator_id` bigint(20) DEFAULT 0 COMMENT '创建者id',
|
|
|
|
-- `operator` bigint(20) DEFAULT 0 COMMENT '操作人id',
|
|
-- `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '创建日期',
|
|
-- `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改日期',
|
|
-- `rec_status` tinyint(1) unsigned DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
|
|
-- PRIMARY KEY (`id`) USING BTREE,
|
|
-- INDEX `business_creator_index`(`creator_id`) USING BTREE
|
|
-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='业务信息表';
|
|
|
|
-- -- 用户业务关联表
|
|
-- DROP TABLE IF EXISTS `t_sys_user_business`;
|
|
-- CREATE TABLE `t_sys_user_business` (
|
|
-- `id` bigint(20) NOT NULL,
|
|
-- `user_id` bigint(20) DEFAULT 0 COMMENT '用户id',
|
|
-- `business_id` bigint(20) DEFAULT 0 COMMENT '业务id',
|
|
|
|
-- `operator` bigint(20) DEFAULT 0 COMMENT '操作人id',
|
|
-- `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '创建日期',
|
|
-- `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改日期',
|
|
-- `rec_status` tinyint(1) unsigned DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
|
|
-- PRIMARY KEY (`id`) USING BTREE,
|
|
-- INDEX `user_idndex`(`user_id`) USING BTREE,
|
|
-- INDEX `business_idndex`(`business_id`) USING BTREE
|
|
-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='用户业务关联表';
|
|
|
|
|
|
|
|
-- 用户基本信息表
|
|
DROP TABLE IF EXISTS `t_sys_user`;
|
|
CREATE TABLE `t_sys_user` (
|
|
`id` bigint(20) NOT NULL,
|
|
`name` varchar(32) DEFAULT '' COMMENT '用户名称',
|
|
`gender`tinyint(1) unsigned DEFAULT 0 COMMENT '性别 0女 1男',
|
|
`avatar_url` varchar(255) DEFAULT '' COMMENT '头像',
|
|
`country` varchar(32) DEFAULT '' COMMENT '国家',
|
|
`province` varchar(32) DEFAULT '' COMMENT '省份',
|
|
`city` varchar(32) DEFAULT '' COMMENT '城市',
|
|
`phone` varchar(32) DEFAULT '' COMMENT '手机号',
|
|
`id_card` varchar(32) DEFAULT '' COMMENT '身份证号',
|
|
`power` tinyint(1) unsigned DEFAULT 0 COMMENT '访问权限 0客户端 1开放平台 3全部',
|
|
`device_id` varchar(64) DEFAULT '' COMMENT '主设备id',
|
|
`auth_type` tinyint(1) unsigned DEFAULT 0 COMMENT '用户认证类型 0未认证 1认证',
|
|
|
|
`operator` bigint(20) DEFAULT 0 COMMENT '操作人id',
|
|
`created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '创建日期',
|
|
`updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改日期',
|
|
`rec_status` tinyint(1) unsigned DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
|
|
PRIMARY KEY (`id`) USING BTREE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='用户基本信息表';
|
|
|
|
-- 用户认证信息表
|
|
DROP TABLE IF EXISTS `t_sys_auth`;
|
|
CREATE TABLE `t_sys_auth` (
|
|
`id` bigint(20) NOT NULL,
|
|
`user_id` bigint(20) DEFAULT 0 COMMENT '用户id',
|
|
`identify_type` tinyint(2) unsigned DEFAULT 0 COMMENT '认证的类型 0微信小程序,1电话,2邮箱,3账号,4微信公众号,5微信网页登陆,6微博,7企业微信',
|
|
`identifier`varchar(32) DEFAULT '' COMMENT '用户标识()手机号等',
|
|
`credential` varchar(32) DEFAULT '' COMMENT '用户凭证/密码',
|
|
`salt` varchar(64) DEFAULT '' COMMENT '盐,加密时所需',
|
|
|
|
`operator` bigint(20) DEFAULT 0 COMMENT '操作人id',
|
|
`created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '创建日期',
|
|
`updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改日期',
|
|
`rec_status` tinyint(1) unsigned DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
|
|
PRIMARY KEY (`id`) USING BTREE,
|
|
INDEX `auth_user_index`(`user_id`) USING BTREE,
|
|
INDEX `auth_identify_type_index`(`identify_type`) USING BTREE,
|
|
INDEX `auth_identifier_index`(`identifier`) USING BTREE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='用户认证信息表';
|
|
|
|
-- 用户登录记录表
|
|
DROP TABLE IF EXISTS `t_sys_signin_log`;
|
|
CREATE TABLE `t_sys_signin_log` (
|
|
`id` bigint(20) NOT NULL,
|
|
`user_id` bigint(20) DEFAULT 0 COMMENT '用户id',
|
|
`auth_id` bigint(20) DEFAULT 0 COMMENT '认证id,临时用户null',
|
|
`time`bigint(20) DEFAULT 0 COMMENT '登录时间',
|
|
`device_id` varchar(64) DEFAULT '' COMMENT '设备id',
|
|
`client_type` tinyint(1) unsigned DEFAULT 0 COMMENT '客户端类型 0H5 1App',
|
|
`ip_address` varchar(64) DEFAULT '' COMMENT 'ip地址',
|
|
|
|
`operator` bigint(20) DEFAULT 0 COMMENT '操作人id',
|
|
`created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '创建日期',
|
|
`updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改日期',
|
|
`rec_status` tinyint(1) unsigned DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
|
|
PRIMARY KEY (`id`) USING BTREE,
|
|
INDEX `signin_user_index`(`user_id`) USING BTREE,
|
|
INDEX `signin_auth_index`(`auth_id`) USING BTREE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='用户登录记录表';
|
|
|
|
-- 用户设备关联表
|
|
DROP TABLE IF EXISTS `t_sys_user_device`;
|
|
CREATE TABLE `t_sys_user_device` (
|
|
`id` bigint(20) NOT NULL,
|
|
`user_id` bigint(20) DEFAULT 0 COMMENT '用户id',
|
|
`device_id` varchar(64) DEFAULT '' COMMENT '设备id',
|
|
`client_type` tinyint(1) unsigned DEFAULT 0 COMMENT '客户端类型 0H5 1App',
|
|
`refresh_token` varchar(256) DEFAULT '' COMMENT '关联refresh_token',
|
|
|
|
`operator` bigint(20) DEFAULT 0 COMMENT '操作人id',
|
|
`created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '创建日期',
|
|
`updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改日期',
|
|
`rec_status` tinyint(1) unsigned DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
|
|
PRIMARY KEY (`id`) USING BTREE,
|
|
INDEX `user_index`(`user_id`) USING BTREE,
|
|
INDEX `device_index`(`device_id`) USING BTREE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='用户设备关联表';
|
|
|
|
|
|
-- 业务信息表
|
|
DROP TABLE IF EXISTS `t_sys_business`;
|
|
CREATE TABLE `t_sys_business` (
|
|
`id` bigint(20) NOT NULL,
|
|
`name` varchar(64) DEFAULT '' COMMENT '名称',
|
|
`code` varchar(64) DEFAULT '' COMMENT 'code',
|
|
`description` VARCHAR(512) DEFAULT '' COMMENT '业务描述',
|
|
`url` varchar(512) DEFAULT '' COMMENT '请求路径',
|
|
`app_id` varchar(64) DEFAULT '' COMMENT '业务appId',
|
|
`secret` varchar(64) DEFAULT '' COMMENT 'secret',
|
|
`creator_id` bigint(20) DEFAULT 0 COMMENT '创建者id',
|
|
`last_ask_time` bigint(20) DEFAULT 0 COMMENT '最后请求时间',
|
|
`last_answer_time` bigint(20) DEFAULT 0 COMMENT '最后应答时间',
|
|
`type` tinyint(1) unsigned DEFAULT 0 COMMENT '业务类型 0业务 1传达室',
|
|
|
|
`operator` bigint(20) DEFAULT 0 COMMENT '操作人id',
|
|
`created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '创建日期',
|
|
`updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改日期',
|
|
`rec_status` tinyint(1) unsigned DEFAULT 0 COMMENT '状态,0正常 1禁用 2删除',
|
|
PRIMARY KEY (`id`) USING BTREE,
|
|
INDEX `business_creator_index`(`creator_id`) USING BTREE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='业务信息表';
|
|
|