~~~[sql]
/*
Navicat Premium Data Transfer
Source Server : dfc
Source Server Type : MySQL
Source Server Version : 50717
Source Host : localhost:3306
Source Schema : convenient_people
Target Server Type : MySQL
Target Server Version : 50717
File Encoding : 65001
Date: 14/06/2018 17:47:29
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for admin_named_user
-- ----------------------------
DROP TABLE IF EXISTS `admin_named_user`;
CREATE TABLE `admin_named_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名',
`password` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码',
`user_id` int(11) NOT NULL COMMENT '所属用户id',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `user_id`(`user_id`) USING BTREE,
UNIQUE INDEX `username`(`username`) USING BTREE,
CONSTRAINT `admin_named_user_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `admin_user_info` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '命名用户登录表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for admin_oauth_user
-- ----------------------------
DROP TABLE IF EXISTS `admin_oauth_user`;
CREATE TABLE `admin_oauth_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`open_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'open_id',
`type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '第三方登录类型,qq、wechat等',
`user_id` int(11) NOT NULL COMMENT '所属用户id',
`ext` json NULL COMMENT '额外信息',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `type`(`type`, `open_id`) USING BTREE,
INDEX `user_id`(`user_id`) USING BTREE,
CONSTRAINT `admin_oauth_user_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `admin_user_info` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '第三方登录表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for admin_phone_user
-- ----------------------------
DROP TABLE IF EXISTS `admin_phone_user`;
CREATE TABLE `admin_phone_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '手机号',
`password` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码',
`user_id` int(11) NOT NULL COMMENT '所属用户id',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `user_id`(`user_id`) USING BTREE,
UNIQUE INDEX `phone`(`phone`) USING BTREE,
CONSTRAINT `admin_phone_user_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `admin_user_info` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '手机号登录表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for admin_user_config
-- ----------------------------
DROP TABLE IF EXISTS `admin_user_config`;
CREATE TABLE `admin_user_config` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`configs` json NULL COMMENT '配置项',
`user_id` int(11) NOT NULL COMMENT '所属用户',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `user_id`(`user_id`) USING BTREE,
CONSTRAINT `admin_user_config_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `admin_user_info` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户配置信息' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for admin_user_info
-- ----------------------------
DROP TABLE IF EXISTS `admin_user_info`;
CREATE TABLE `admin_user_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户昵称',
`recent_login_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后登录',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for banner
-- ----------------------------
DROP TABLE IF EXISTS `banner`;
CREATE TABLE `banner` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题',
`img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '图片地址',
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '链接地址',
`is_enable` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否启用',
`position` int(11) NOT NULL COMMENT '所在位置',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'banner' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for city
-- ----------------------------
DROP TABLE IF EXISTS `city`;
CREATE TABLE `city` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`province_id` int(10) UNSIGNED NOT NULL COMMENT '地级市id',
`city_id` bigint(20) UNSIGNED NOT NULL COMMENT '县级市id',
`city_name` char(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `city_id`(`city_id`) USING BTREE,
INDEX `province_id`(`province_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 348 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '县级市数据库' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for community
-- ----------------------------
DROP TABLE IF EXISTS `community`;
CREATE TABLE `community` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '小区名',
`county_id` bigint(20) NOT NULL COMMENT '区域id',
`name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '管理人姓名',
`phone` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '管理人手机号',
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '登录密码',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '小区状态,启用/冻结',
`last_login_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后登录时间',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `phone`(`phone`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '小区' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for county
-- ----------------------------
DROP TABLE IF EXISTS `county`;
CREATE TABLE `county` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '地级市主键ID',
`city_id` bigint(20) UNSIGNED NOT NULL COMMENT '地级市id',
`county_id` bigint(20) UNSIGNED NOT NULL COMMENT '县级id',
`county_name` char(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `county_id`(`county_id`) USING BTREE,
INDEX `city_id`(`city_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3140 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '地区市数据库' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for faq
-- ----------------------------
DROP TABLE IF EXISTS `faq`;
CREATE TABLE `faq` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题',
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '答案内容',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '常见问题及答疑' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for merchants
-- ----------------------------
DROP TABLE IF EXISTS `merchants`;
CREATE TABLE `merchants` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '合作人姓名',
`phone` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '手机号',
`address` varchar(160) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '所在地址',
`business` varchar(160) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '合作业务',
`remark` varchar(160) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '备注',
`status` enum('pending','approve','refuse') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'pending' COMMENT '合作信息状态',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '招商合作信息' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for message_content
-- ----------------------------
DROP TABLE IF EXISTS `message_content`;
CREATE TABLE `message_content` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '站内信标题',
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '站内信内容',
`receiver_group` enum('personal','admin','store','community','all','user','other') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '接收消息用户组',
`creator_type` enum('admin','user','store','community') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '消息发送人类型',
`creator_id` int(11) NOT NULL COMMENT '发送人id',
`link` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '跳转链接',
`delete_time` timestamp(0) NULL DEFAULT NULL COMMENT '标记删除时间',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '站内信内容' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for migrations
-- ----------------------------
DROP TABLE IF EXISTS `migrations`;
CREATE TABLE `migrations` (
`version` bigint(20) NOT NULL,
`migration_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`start_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`end_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`breakpoint` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`version`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for province
-- ----------------------------
DROP TABLE IF EXISTS `province`;
CREATE TABLE `province` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`province_id` int(11) UNSIGNED NOT NULL COMMENT '省份id、省份编号',
`province_name` char(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '省份名称',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `provice_id`(`province_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '省份数据库' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for rbac_permissions
-- ----------------------------
DROP TABLE IF EXISTS `rbac_permissions`;
CREATE TABLE `rbac_permissions` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Lft` int(11) NOT NULL,
`Rght` int(11) NOT NULL,
`Title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`Description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
PRIMARY KEY (`ID`) USING BTREE,
INDEX `Lft`(`Lft`) USING BTREE,
INDEX `Rght`(`Rght`) USING BTREE,
INDEX `Title`(`Title`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for rbac_rolepermissions
-- ----------------------------
DROP TABLE IF EXISTS `rbac_rolepermissions`;
CREATE TABLE `rbac_rolepermissions` (
`RoleID` int(11) NOT NULL,
`PermissionID` int(11) NOT NULL,
`AssignmentDate` int(11) NOT NULL,
PRIMARY KEY (`RoleID`, `PermissionID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for rbac_roles
-- ----------------------------
DROP TABLE IF EXISTS `rbac_roles`;
CREATE TABLE `rbac_roles` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Lft` int(11) NOT NULL,
`Rght` int(11) NOT NULL,
`Title` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`Description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
PRIMARY KEY (`ID`) USING BTREE,
INDEX `Lft`(`Lft`) USING BTREE,
INDEX `Rght`(`Rght`) USING BTREE,
INDEX `Title`(`Title`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for rbac_userroles
-- ----------------------------
DROP TABLE IF EXISTS `rbac_userroles`;
CREATE TABLE `rbac_userroles` (
`UserID` int(11) NOT NULL,
`RoleID` int(11) NOT NULL,
`AssignmentDate` int(11) NOT NULL,
PRIMARY KEY (`UserID`, `RoleID`) USING BTREE,
CONSTRAINT `rbac_userroles_ibfk_1` FOREIGN KEY (`UserID`) REFERENCES `admin_user_info` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for service_items
-- ----------------------------
DROP TABLE IF EXISTS `service_items`;
CREATE TABLE `service_items` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '服务名',
`icon` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '手机图标',
`img` varchar(160) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '图片',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否启用',
`parent_id` int(11) NULL DEFAULT NULL COMMENT '上级id',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '服务项目' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for store
-- ----------------------------
DROP TABLE IF EXISTS `store`;
CREATE TABLE `store` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '门店名',
`address` varchar(160) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '详细地址',
`county_id` bigint(20) NOT NULL COMMENT '区域id',
`name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '店长姓名',
`phone` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '负责人手机号',
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '登录密码',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '门店状态,启用/冻结',
`service_id` int(11) NULL DEFAULT NULL COMMENT '服务项目id',
`service_item` json NULL COMMENT '门店具体的服务项目',
`extra` json NULL COMMENT '额外数据',
`last_login_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后登录时间',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `phone`(`phone`) USING BTREE,
INDEX `service_id`(`service_id`) USING BTREE,
CONSTRAINT `store_ibfk_1` FOREIGN KEY (`service_id`) REFERENCES `service_items` (`id`) ON DELETE SET NULL ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '门店' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for system_config
-- ----------------------------
DROP TABLE IF EXISTS `system_config`;
CREATE TABLE `system_config` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`about` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '关于我们',
`protocol` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '平台协议',
`mall_url` varchar(160) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商城地址',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统配置' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for system_jobs
-- ----------------------------
DROP TABLE IF EXISTS `system_jobs`;
CREATE TABLE `system_jobs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`queue` char(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '队列名称,对应到命令行的 --queue',
`payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '消息内容,为json结构',
`attempts` int(3) UNSIGNED NOT NULL COMMENT '任务已经尝试的次数',
`reserved` int(3) UNSIGNED NOT NULL COMMENT '任务是否处于执行中的状态 0 未执行 1 已执行',
`reserved_at` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '任务被标记为已执行中的状态的时刻',
`available_at` int(10) UNSIGNED NOT NULL COMMENT '该任务运行执行的最高时刻,用于任务的定时,任务的延迟执行',
`created_at` int(10) UNSIGNED NOT NULL COMMENT '任务的创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '消息队列使用的表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for user_info
-- ----------------------------
DROP TABLE IF EXISTS `user_info`;
CREATE TABLE `user_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '头像地址',
`nickname` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '昵称',
`gender` enum('male','female','secret') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'secret' COMMENT '性别',
`birthday` date NULL DEFAULT NULL COMMENT '生日',
`signature` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '个性签名',
`last_login_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后登录时间',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '用户状态,启用/冻结',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for user_message
-- ----------------------------
DROP TABLE IF EXISTS `user_message`;
CREATE TABLE `user_message` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`message_id` int(11) NOT NULL COMMENT '消息内容id',
`receiver_type` enum('admin','user','store','community') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '接收者类型',
`receiver_id` int(11) NOT NULL COMMENT '接收者id',
`creator_type` enum('admin','user','store','community') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '消息发送人类型',
`creator_id` int(11) NOT NULL COMMENT '发送人id',
`is_read` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已读',
`delete_time` timestamp(0) NULL DEFAULT NULL COMMENT '标记删除时间',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `message_id`(`message_id`) USING BTREE,
CONSTRAINT `user_message_ibfk_1` FOREIGN KEY (`message_id`) REFERENCES `message_content` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户站内信' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for user_oauth_user
-- ----------------------------
DROP TABLE IF EXISTS `user_oauth_user`;
CREATE TABLE `user_oauth_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`open_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'open_id',
`type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '第三方登录类型,qq、wechat等',
`user_id` int(11) NOT NULL COMMENT '所属用户id',
`ext` json NULL COMMENT '额外信息',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `type`(`type`, `open_id`) USING BTREE,
INDEX `user_id`(`user_id`) USING BTREE,
CONSTRAINT `user_oauth_user_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user_info` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户端第三方登录表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for user_order
-- ----------------------------
DROP TABLE IF EXISTS `user_order`;
CREATE TABLE `user_order` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '联系人姓名',
`phone` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '联系人手机号',
`store_id` int(11) NOT NULL COMMENT '门店id',
`service_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '服务项目名',
`user_id` int(11) NOT NULL COMMENT '用户id',
`status` enum('pending','receive','finish','cancel') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单状态',
`cancel_type` enum('merchant','user','system','normal') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'normal' COMMENT '取消类型',
`cancel_reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '取消或者关闭原因',
`address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '所在地址',
`other` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '其他说明',
`receive_time` timestamp(0) NULL DEFAULT NULL COMMENT '商家接受时间',
`finish_time` timestamp(0) NULL DEFAULT NULL COMMENT '完成时间',
`extra` json NULL COMMENT '额外数据',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp(0) NULL DEFAULT NULL,
`delete_time` timestamp(0) NULL DEFAULT NULL COMMENT '标记删除时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `user_id`(`user_id`) USING BTREE,
CONSTRAINT `user_order_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user_info` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户订单' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for user_phone
-- ----------------------------
DROP TABLE IF EXISTS `user_phone`;
CREATE TABLE `user_phone` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`phone` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '手机号',
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '登录密码',
`user_id` int(11) NOT NULL COMMENT '用户id',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `phone`(`phone`, `user_id`) USING BTREE,
INDEX `user_id`(`user_id`) USING BTREE,
CONSTRAINT `user_phone_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user_info` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户登录表' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
~~~