From 5b1daf3aebd000838553039d8194f51e1869f717 Mon Sep 17 00:00:00 2001 From: HuangXin Date: Wed, 6 May 2020 17:13:36 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E5=A2=9E=E5=8A=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E8=A1=A8=E5=88=9B=E5=BB=BASQL=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=202.=20=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=88=9D=E5=A7=8B=E5=8C=96=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/application-test.properties | 3 +- src/main/resources/db/data.sql | 4 +- src/main/resources/db/schema.sql | 88 +++++++++++++++++++----------- 3 files changed, 58 insertions(+), 37 deletions(-) diff --git a/config/application-test.properties b/config/application-test.properties index dff55b20..08317543 100644 --- a/config/application-test.properties +++ b/config/application-test.properties @@ -23,8 +23,7 @@ spring.datasource.dbcp2.connection-properties=characterEncoding=utf8 # 下划线转驼峰 将带有下划线的表字段映射为驼峰格式的实体类属性 #mybatis.configuration.map-underscore-to-camel-case: true mybatis.mapper-locations=classpath*:mappers/*.xml -mybatis.type-aliases-package=com.cmcc.hy.phoenix.entity -#config log +mybatis.type-aliases-package=com.dispose.pojo.entity logging.config=file:config/logback.xml #config tomcat server.tomcat.max-threads=128 diff --git a/src/main/resources/db/data.sql b/src/main/resources/db/data.sql index a5400b63..8c0e6e48 100644 --- a/src/main/resources/db/data.sql +++ b/src/main/resources/db/data.sql @@ -1,2 +1,2 @@ --- INSERT INTO `phoenix_user`(`id`,`name`,`password`,`salt`,`email`,`phone_number`) VALUES (1, 'user_1', 'ff342e862e7c3285cdc07e56d6b8973b', '412365a109674b2dbb1981ed561a4c70', 'user1@cmhi.chinamobile.com', '17300000001'); --- INSERT INTO `phoenix_user`(`id`,`name`,`password`,`salt`,`email`,`phone_number`) VALUES (2, 'user_2', '6c6bf02c8d5d3d128f34b1700cb1e32c', 'fcbdd0e8a9404a5585ea4e01d0e4d7a0', 'user2@cmhi.chinamobile.com', '17300000002'); \ No newline at end of file +insert into `dispose_device`(`id`,`ipAddr`,`type`,`areaCode`,`name`,`manufacturer`,`model`,`version`,`readme`,`status`) values (1,'10.88.77.15',0,0,'中移杭研实验室清洗设备','DPTech','UMC','5.7.13','实验室测试设备',0); +insert into `user_account`(`id`,`username`,`password`,`lastLoginTime`,`lockTime`,`status`) values (1,'admin','c3855e6b6bb120450f160ba91134522868f89d36062f2061ebeefd80817e1d58','2020-05-06 11:31:58','0000-00-00 00:00:00',0); \ No newline at end of file diff --git a/src/main/resources/db/schema.sql b/src/main/resources/db/schema.sql index 3181c971..f2bec703 100644 --- a/src/main/resources/db/schema.sql +++ b/src/main/resources/db/schema.sql @@ -1,41 +1,63 @@ -DROP TABLE IF EXISTS `phoenix_user`; -CREATE TABLE `phoenix_user` +/*Table structure for table `dispose_device` */ + +DROP TABLE IF EXISTS `dispose_device`; + +CREATE TABLE IF NOT EXISTS `dispose_device` ( - `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT '主键', - `name` VARCHAR(32) NOT NULL UNIQUE COMMENT '用户名', - `password` VARCHAR(32) NOT NULL COMMENT '加密后的密码', - `salt` VARCHAR(32) NOT NULL COMMENT '加密使用的盐', - `email` VARCHAR(32) NOT NULL UNIQUE COMMENT '邮箱', - `phone_number` VARCHAR(15) NOT NULL UNIQUE COMMENT '手机号码', - `status` INT(2) NOT NULL DEFAULT 1 COMMENT '状态,-1:逻辑删除,0:禁用,1:启用', - `create_time` DATETIME DEFAULT NOW() COMMENT '创建时间', - `last_login_time` DATETIME DEFAULT NULL COMMENT '上次登录时间', - `last_update_time` DATETIME DEFAULT NOW() COMMENT '上次更新时间' + `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '设备唯一标识符', + `ipAddr` varchar(64) DEFAULT NULL COMMENT '设备IP地址, IPv4/IPv6', + `type` int(11) NOT NULL DEFAULT '0' COMMENT '能力节点类型,0:迪普UMC平台,1:浩瀚设备', + `areaCode` int(11) DEFAULT NULL COMMENT '设备物理位置区域码', + `name` varchar(256) DEFAULT NULL COMMENT '设备名称', + `manufacturer` varchar(128) DEFAULT NULL COMMENT '生产厂商', + `model` varchar(128) DEFAULT NULL COMMENT '型号', + `version` varchar(128) DEFAULT NULL COMMENT '软件版本', + `readme` varchar(1024) DEFAULT NULL COMMENT '备注', + `status` int(11) NOT NULL DEFAULT '0' COMMENT '状态,0:正常, 1:删除', + PRIMARY KEY (`id`), + UNIQUE KEY `ipAddr` (`ipAddr`) ) ENGINE = InnoDB - DEFAULT CHARSET = utf8 COMMENT ='phoenix用户示例表'; + AUTO_INCREMENT = 1 + DEFAULT CHARSET = utf8; +/*Table structure for table `user_account` */ +DROP TABLE IF EXISTS `user_account`; -DROP TABLE IF EXISTS `info_collection`; -CREATE TABLE `info_collection` +CREATE TABLE IF NOT EXISTS `user_account` ( - `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT '主键', - `username` VARCHAR(32) NOT NULL COMMENT '联系人', - `organization` VARCHAR(128) NOT NULL COMMENT '单位名称', - `province_code` VARCHAR(32) NOT NULL COMMENT '省编码', - `province` VARCHAR(128) NOT NULL COMMENT '省', - `city` VARCHAR(128) NOT NULL COMMENT '市', - `district` VARCHAR(128) NOT NULL COMMENT '区', - `address` VARCHAR(128) NOT NULL COMMENT '单位地址', - `email` VARCHAR(32) NOT NULL COMMENT '邮箱', - `phone_number` VARCHAR(32) NOT NULL COMMENT '手机号码', - `comment` VARCHAR(128) NOT NULL COMMENT '备注', - `product_type` VARCHAR(32) NOT NULL COMMENT '产品类型waf,ddos', - `sync_status` tinyint NOT NULL DEFAULT -1 COMMENT '是否同步过1同步过,0未同步', - `create_time` DATETIME DEFAULT NOW() COMMENT '创建时间', - `update_time` DATETIME DEFAULT NOW() COMMENT '上次更新时间' + `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '账户唯一编号', + `username` varchar(128) NOT NULL COMMENT '用户名', + `password` varchar(512) NOT NULL COMMENT '密码', + `lastLoginTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后一次成功登录时间', + `lockTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '账户锁定时间', + `status` int(11) DEFAULT NULL COMMENT '账户状态', + PRIMARY KEY (`id`), + UNIQUE KEY `USERNAME` (`username`) ) ENGINE = InnoDB - DEFAULT CHARSET = utf8 COMMENT ='信息收集表'; - -CREATE UNIQUE INDEX ic_phone_pt_index ON info_collection (phone_number, product_type); + AUTO_INCREMENT = 1 + DEFAULT CHARSET = utf8; +/*Table structure for table `dispose_task` */ +DROP TABLE IF EXISTS `dispose_task`; +CREATE TABLE IF NOT EXISTS `dispose_task` +( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '处置任务唯一标识符', + `deviceId` int(10) unsigned NOT NULL COMMENT '处置设备唯一标识符', + `accountId` int(10) unsigned NOT NULL COMMENT '用户唯一标识符', + `type` int(11) unsigned NOT NULL COMMENT '处置能力类型:0:清洗 1:高防 2:黑洞 3:检测', + `disposeIp` varchar(128) NOT NULL COMMENT '处置IP', + `beginTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '开始时间', + `planEndTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '计划结束时间', + `endTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '实际结束时间', + `flowDirection` int(11) DEFAULT '2' COMMENT '流量方向, 0:流入;1:流出;2:双向', + `attackType` varchar(1024) DEFAULT '0' COMMENT '攻击类型,默认0, 全部攻击', + `flowBandWidth` int(10) unsigned DEFAULT '1024' COMMENT '攻击流量占用带宽', + `currentStatus` int(11) NOT NULL DEFAULT '0' COMMENT '状态,0:停止。1:启动', + PRIMARY KEY (`id`), + KEY `dispose_task_device_capacity_id_fk` (`type`), + KEY `dispose_task_user_account_id_fk` (`accountId`), + CONSTRAINT `dispose_task_user_account_id_fk` FOREIGN KEY (`accountId`) REFERENCES `user_account` (`id`) ON DELETE NO ACTION +) ENGINE = InnoDB + AUTO_INCREMENT = 1 + DEFAULT CHARSET = utf8;