/*
Navicat MySQL Data Transfer

Source Server         : 118.178.58.178
Source Server Version : 50627
Source Host           : 118.178.58.178:3306
Source Database       : sq_logistics

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

Date: 2018-02-09 11:33:50
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for `box`
-- ----------------------------
DROP TABLE IF EXISTS `box`;
CREATE TABLE `box` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `box_no` varchar(255) NOT NULL,
  `box_name` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of box
-- ----------------------------
INSERT INTO `box` VALUES ('1', 'FCIU4615791', '小箱子');
INSERT INTO `box` VALUES ('2', 'FCIU4615792', '大箱子');
INSERT INTO `box` VALUES ('3', 'FCIU4615793', '微型箱子');
INSERT INTO `box` VALUES ('4', 'FCIU4615794', '巨型箱子');

-- ----------------------------
-- Table structure for `module`
-- ----------------------------
DROP TABLE IF EXISTS `module`;
CREATE TABLE `module` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `module_id` int(11) NOT NULL,
  `module_name` varchar(255) NOT NULL,
  `module_url` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of module
-- ----------------------------
INSERT INTO `module` VALUES ('1', '1', '计划员订单查询', '/ordersIssue/queryOrdersByPlanner');
INSERT INTO `module` VALUES ('2', '2', '计划员添加订单', '/ordersIssue/addOrder');
INSERT INTO `module` VALUES ('3', '3', '计划员订单跟踪', '/ordersIssue/orderTracking');

-- ----------------------------
-- Table structure for `operation_history`
-- ----------------------------
DROP TABLE IF EXISTS `operation_history`;
CREATE TABLE `operation_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `order_id` int(11) NOT NULL,
  `operation_type_id` int(11) NOT NULL,
  `operator_id` int(11) NOT NULL COMMENT '用户的user_id',
  `operation_time` bigint(20) NOT NULL,
  `hash` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `operator_id` (`operator_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=90 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of operation_history
-- ----------------------------

-- ----------------------------
-- Table structure for `operation_history_admin`
-- ----------------------------
DROP TABLE IF EXISTS `operation_history_admin`;
CREATE TABLE `operation_history_admin` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `operator_id` int(11) NOT NULL,
  `operation_type_id` int(11) NOT NULL,
  `be_operated_id` int(11) NOT NULL,
  `operation_time` bigint(20) NOT NULL,
  `hash` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `operator_id` (`operator_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=292 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of operation_history_admin
-- ----------------------------
INSERT INTO `operation_history_admin` VALUES ('291', '1', '1', '1', '1518144355124', '7446954550830814811');

-- ----------------------------
-- Table structure for `operation_type`
-- ----------------------------
DROP TABLE IF EXISTS `operation_type`;
CREATE TABLE `operation_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `operation_type_id` int(11) NOT NULL,
  `operation_type_name` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of operation_type
-- ----------------------------
INSERT INTO `operation_type` VALUES ('1', '1', '设置管理员公钥');
INSERT INTO `operation_type` VALUES ('2', '2', '创建账号');
INSERT INTO `operation_type` VALUES ('3', '3', '编辑账号');
INSERT INTO `operation_type` VALUES ('4', '4', '删除账号');
INSERT INTO `operation_type` VALUES ('5', '5', '设置供应商');
INSERT INTO `operation_type` VALUES ('6', '6', '创建订单');
INSERT INTO `operation_type` VALUES ('7', '7', '供应商发货');
INSERT INTO `operation_type` VALUES ('8', '8', '承运商运货');
INSERT INTO `operation_type` VALUES ('9', '9', '收货');

-- ----------------------------
-- Table structure for `orders`
-- ----------------------------
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `order_id` int(255) DEFAULT NULL,
  `part_no` varchar(255) DEFAULT NULL,
  `box_no` varchar(255) DEFAULT NULL,
  `box_qty` int(11) DEFAULT NULL COMMENT '箱子的数量？',
  `inbox_qty` int(11) DEFAULT NULL,
  `require_time` bigint(20) DEFAULT NULL,
  `send_time` bigint(20) DEFAULT NULL,
  `planner_id` int(11) DEFAULT NULL COMMENT '计划员的user_id',
  `supplier_id` int(11) DEFAULT NULL COMMENT '供应商的user_id',
  `carrier_id` int(11) DEFAULT NULL COMMENT '承运商的user_id',
  `receiver_id` int(11) DEFAULT NULL COMMENT '收货员的user_id',
  `transport_time` bigint(20) DEFAULT NULL,
  `tally_time` bigint(20) DEFAULT NULL,
  `car_no` varchar(255) DEFAULT NULL,
  `status_id` int(11) DEFAULT NULL,
  `create_time` bigint(20) DEFAULT NULL,
  `update_time` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of orders
-- ----------------------------

-- ----------------------------
-- Table structure for `part`
-- ----------------------------
DROP TABLE IF EXISTS `part`;
CREATE TABLE `part` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `part_no` varchar(255) NOT NULL,
  `part_name` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of part
-- ----------------------------
INSERT INTO `part` VALUES ('1', 'FCIU4615791', '方向盘');
INSERT INTO `part` VALUES ('2', 'FCIU4615792', '挡风玻璃');
INSERT INTO `part` VALUES ('3', 'FCIU4615793', '轮胎');
INSERT INTO `part` VALUES ('4', 'FCIU4615794', '发动机');
INSERT INTO `part` VALUES ('5', 'FCIU4615795', '座椅');
INSERT INTO `part` VALUES ('6', 'FCIU4615796', '后视镜');

-- ----------------------------
-- Table structure for `planner_supplier`
-- ----------------------------
DROP TABLE IF EXISTS `planner_supplier`;
CREATE TABLE `planner_supplier` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `planner_id` int(11) NOT NULL,
  `supplier_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of planner_supplier
-- ----------------------------

-- ----------------------------
-- Table structure for `role`
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `role_id` int(11) NOT NULL,
  `role_name` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of role
-- ----------------------------
INSERT INTO `role` VALUES ('1', '1', '计划员');
INSERT INTO `role` VALUES ('2', '2', '供应商');
INSERT INTO `role` VALUES ('3', '3', '承运商');
INSERT INTO `role` VALUES ('4', '4', '仓库收货员');
INSERT INTO `role` VALUES ('5', '5', '管理员');

-- ----------------------------
-- Table structure for `role_module`
-- ----------------------------
DROP TABLE IF EXISTS `role_module`;
CREATE TABLE `role_module` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `role_id` int(11) NOT NULL,
  `module_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

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

-- ----------------------------
-- Table structure for `status`
-- ----------------------------
DROP TABLE IF EXISTS `status`;
CREATE TABLE `status` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status_id` int(11) NOT NULL,
  `status_name` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of status
-- ----------------------------
INSERT INTO `status` VALUES ('1', '1', '待发货');
INSERT INTO `status` VALUES ('3', '2', '待运输');
INSERT INTO `status` VALUES ('4', '3', '运输中');
INSERT INTO `status` VALUES ('5', '4', '已点货');
INSERT INTO `status` VALUES ('6', '5', '拒收');
INSERT INTO `status` VALUES ('7', '6', '已发货');
INSERT INTO `status` VALUES ('8', '7', '已承运');

-- ----------------------------
-- Table structure for `supplier_carrier`
-- ----------------------------
DROP TABLE IF EXISTS `supplier_carrier`;
CREATE TABLE `supplier_carrier` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `supplier_id` int(11) NOT NULL,
  `carrier_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of supplier_carrier
-- ----------------------------

-- ----------------------------
-- Table structure for `token`
-- ----------------------------
DROP TABLE IF EXISTS `token`;
CREATE TABLE `token` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `token` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of token
-- ----------------------------
INSERT INTO `token` VALUES ('72', '1', '5d576b8423154e8d9f3c9f944d562868');

-- ----------------------------
-- Table structure for `users`
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `p_id` int(11) DEFAULT NULL COMMENT '上级user_id',
  `role_id` int(11) DEFAULT NULL,
  `person_name` varchar(255) DEFAULT NULL,
  `random` varchar(255) DEFAULT NULL,
  `create_time` bigint(20) DEFAULT NULL,
  `update_time` bigint(20) DEFAULT NULL,
  `state` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=319 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES ('318', '1', 'admin', '123456', null, '5', '管理员', 'sA4vfeQGqD', '1518144355022', '1518144355022', '1');
