/*
Navicat MySQL Data Transfer

Source Server         : localhost_3306
Source Server Version : 50731
Source Host           : localhost:3306
Source Database       : aldebaran

Target Server Type    : MYSQL
Target Server Version : 50731
File Encoding         : 65001

Date: 2021-08-19 10:09:04
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for `items`
-- ----------------------------
DROP TABLE IF EXISTS `items`;
CREATE TABLE `items` (
  `itemid` int(11) NOT NULL AUTO_INCREMENT,
  `itemname` varchar(255) DEFAULT NULL,
  `itemprice` double DEFAULT NULL,
  PRIMARY KEY (`itemid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of items
-- ----------------------------
INSERT INTO `items` VALUES ('1', '北冰洋', '50');
INSERT INTO `items` VALUES ('2', '可乐', '50');
INSERT INTO `items` VALUES ('3', '耳机', '100');
INSERT INTO `items` VALUES ('4', '鼠标', '100');

-- ----------------------------
-- Table structure for `orders`
-- ----------------------------
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (
  `orderid` int(11) NOT NULL AUTO_INCREMENT,
  `orderprice` double DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`orderid`),
  KEY `orders_fk` (`user_id`),
  CONSTRAINT `orders_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`userid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of orders
-- ----------------------------
INSERT INTO `orders` VALUES ('1', '100', '1');
INSERT INTO `orders` VALUES ('2', '200', '1');
INSERT INTO `orders` VALUES ('3', '500', '2');
INSERT INTO `orders` VALUES ('4', '500', null);

-- ----------------------------
-- Table structure for `orders_items`
-- ----------------------------
DROP TABLE IF EXISTS `orders_items`;
CREATE TABLE `orders_items` (
  `order_id` int(11) NOT NULL,
  `item_id` int(11) NOT NULL,
  PRIMARY KEY (`order_id`,`item_id`),
  KEY `order_item_fk2` (`item_id`),
  CONSTRAINT `order_item_fk1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`orderid`),
  CONSTRAINT `order_item_fk2` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of orders_items
-- ----------------------------
INSERT INTO `orders_items` VALUES ('1', '1');
INSERT INTO `orders_items` VALUES ('1', '2');
INSERT INTO `orders_items` VALUES ('2', '3');
INSERT INTO `orders_items` VALUES ('2', '4');

-- ----------------------------
-- Table structure for `roles`
-- ----------------------------
DROP TABLE IF EXISTS `roles`;
CREATE TABLE `roles` (
  `roleid` int(11) NOT NULL AUTO_INCREMENT,
  `rolename` varchar(30) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`roleid`),
  UNIQUE KEY `roles_fk` (`user_id`) USING BTREE,
  CONSTRAINT `roles_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`userid`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of roles
-- ----------------------------
INSERT INTO `roles` VALUES ('1', '管理者', '1');

-- ----------------------------
-- Table structure for `users`
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
  `userid` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(20) DEFAULT NULL,
  `usersex` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`userid`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES ('1', 'admin', 'male');
INSERT INTO `users` VALUES ('2', '李四', '男');
INSERT INTO `users` VALUES ('3', 'zhangsan', 'male');
INSERT INTO `users` VALUES ('4', '王明', '女');
INSERT INTO `users` VALUES ('5', '张三', '男');
INSERT INTO `users` VALUES ('6', 'admin', '保密');
INSERT INTO `users` VALUES ('19', '林七', '男');
INSERT INTO `users` VALUES ('20', '删除用', '保密');
INSERT INTO `users` VALUES ('21', '小红', '女');
INSERT INTO `users` VALUES ('22', '小紫', '女');
INSERT INTO `users` VALUES ('23', '小美', '女');
INSERT INTO `users` VALUES ('24', '小涛', '男');
INSERT INTO `users` VALUES ('25', '李阳', 'male');

-- ----------------------------
-- Table structure for `users_maven_web_demo`
-- ----------------------------
DROP TABLE IF EXISTS `users_maven_web_demo`;
CREATE TABLE `users_maven_web_demo` (
  `userid` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(30) DEFAULT NULL,
  `userage` int(11) DEFAULT NULL,
  PRIMARY KEY (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of users_maven_web_demo
-- ----------------------------
