/*
 Navicat Premium Data Transfer

 Source Server         : Mysql
 Source Server Type    : MySQL
 Source Server Version : 80026
 Source Host           : localhost:3306
 Source Schema         : jiudianmanage

 Target Server Type    : MySQL
 Target Server Version : 80026
 File Encoding         : 65001

 Date: 20/10/2021 18:46:26
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;--临时禁用外键约束检查，便于删除和重建表

-- ----------------------------
-- Table structure for config
-- ----------------------------
DROP TABLE IF EXISTS `config`;
CREATE TABLE `config`  (
  `id` int NOT NULL,-- 配置ID，主键，整数类型
  `managesalary` double(10, 2) NULL DEFAULT NULL,--经理工资，双精度浮点数，最多10位，2位小数
  `staffsalary` double(10, 2) NULL DEFAULT NULL,--员工工资，同上
  `cleanerssalary` double(10, 2) NULL DEFAULT NULL,--清洁员工资，同上
  `manage` double(10, 2) NULL DEFAULT NULL,--经理数量，同上
  `staff` double(10, 2) NULL DEFAULT NULL,--员工数量，同上
  `cleaner` double(10, 2) NULL DEFAULT NULL,--清洁员数量，同上
  `totalmoney` double(10, 2) NULL DEFAULT NULL,-- 总金额，同上
  `totalroom` double(10, 2) NULL DEFAULT NULL, --总客房数，同上
  PRIMARY KEY (`id`) USING BTREE--指定索引使用的数据结构
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
--使用InnoDB存储引擎，支持事务，字符集为utf8，动态行格式，优化存储
-- ----------------------------
-- Table structure for order
-- ----------------------------
DROP TABLE IF EXISTS `order`;
CREATE TABLE `order`  (
  `orderid` int NOT NULL,--订单ID，主键，整数类型
  `householdname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,--住户姓名，可变长度字符串，最多255字符
  `ID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,--身份证号，同上
  `starttime` datetime NULL DEFAULT NULL,--创建一个名为starttime的字段，类型为datetime，允许为空，且默认值为NULL。
  `endtime` datetime NULL DEFAULT NULL,--创建一个名为endtime的字段，类型为datetime，允许为空，且默认值为NULL。
  `money` double NULL DEFAULT NULL,
  `state` int NULL DEFAULT NULL,
  `roomid` int NULL DEFAULT NULL,
  `userid` int NULL DEFAULT NULL,
  PRIMARY KEY (`orderid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for room
-- ----------------------------
DROP TABLE IF EXISTS `room`;
CREATE TABLE `room`  (
  `roomid` int NOT NULL,
  `local` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `money` double NULL DEFAULT NULL,
  `state` int NULL DEFAULT NULL,
  `type` int NULL DEFAULT NULL,
  PRIMARY KEY (`roomid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user`  (
  `userid` int NOT NULL,
  `useraccount` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `age` int NULL DEFAULT NULL,
  `power` int NULL DEFAULT NULL,--权限等级，整数类型
  `IDnumber` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `money` double NULL DEFAULT NULL,
  `photoUrl` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `phonenumber` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`userid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;--重新启用外键约束检查，确保数据完整性。
