Browse Source

同步最新sql

master
review512jwy@163.com 4 weeks ago
parent
commit
54fd4cbc13
  1. 231
      dongjian-center-admin-controller/src/main/resources/sql/initDatabase.sql
  2. 2
      dongjian-center-admin-controller/src/main/resources/sql/init_admin.sql

231
dongjian-center-admin-controller/src/main/resources/sql/initDatabase.sql

@ -109,6 +109,18 @@ CREATE TABLE `aurora_trends_stats_total` (
KEY `aurora_trends_stats_total_date_index` (`created_date` DESC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='Aurora统计信息总量';
/*Table structure for table `ba_status_history` */
DROP TABLE IF EXISTS `ba_status_history`;
CREATE TABLE `ba_status_history` (
`id` bigint NOT NULL AUTO_INCREMENT,
`device_info_id` int NOT NULL,
`is_running` int DEFAULT NULL,
`update_ts` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*Table structure for table `ba_status_statistics` */
DROP TABLE IF EXISTS `ba_status_statistics`;
@ -701,23 +713,193 @@ CREATE TABLE `dashboard_device_group` (
`id` bigint NOT NULL AUTO_INCREMENT,
`company_id` bigint DEFAULT NULL,
`building_id` bigint DEFAULT NULL COMMENT '所属楼宇ID',
`class_id` int DEFAULT NULL COMMENT '2-积算、3-计测、4-状态',
`name` varchar(500) NOT NULL,
`remark` varchar(500) DEFAULT NULL,
`flag` int DEFAULT '0' COMMENT '0-正常,1-删除',
`created_by` bigint DEFAULT NULL,
`created_at` bigint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='dashboard设备分组表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='dashboard设备分组表';
/*Table structure for table `dashboard_device_group_relation` */
DROP TABLE IF EXISTS `dashboard_device_group_relation`;
CREATE TABLE `dashboard_device_group_relation` (
`device_info_id` int NOT NULL COMMENT 'device_info表里的id',
`device_group_id` bigint NOT NULL COMMENT 'dashboard_device_group表里的id'
`device_info_id` int NOT NULL COMMENT 'device_info表里的id',
`device_group_id` bigint NOT NULL COMMENT 'dashboard_device_group表里的id'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='dashboard设备分组归属关系';
/*Table structure for table `dashboard_level_area` */
DROP TABLE IF EXISTS `dashboard_level_area`;
CREATE TABLE `dashboard_level_area` (
`id` bigint NOT NULL AUTO_INCREMENT,
`company_id` bigint DEFAULT NULL,
`name` varchar(255) NOT NULL,
`remark` varchar(255) DEFAULT NULL,
`flag` int NOT NULL DEFAULT '0' COMMENT '0-正常,1-删除',
`created_by` bigint DEFAULT NULL,
`created_at` bigint DEFAULT NULL,
`updated_at` bigint DEFAULT NULL,
`updated_by` bigint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='区域表';
/*Table structure for table `dashboard_level_branch` */
DROP TABLE IF EXISTS `dashboard_level_branch`;
CREATE TABLE `dashboard_level_branch` (
`id` bigint NOT NULL AUTO_INCREMENT,
`company_id` bigint DEFAULT NULL,
`name` varchar(255) NOT NULL,
`remark` varchar(255) DEFAULT NULL,
`flag` int NOT NULL DEFAULT '0' COMMENT '0-正常,1-删除',
`created_by` bigint DEFAULT NULL,
`created_at` bigint DEFAULT NULL,
`updated_at` bigint DEFAULT NULL,
`updated_by` bigint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支社表';
/*Table structure for table `dashboard_level_relation_area_site` */
DROP TABLE IF EXISTS `dashboard_level_relation_area_site`;
CREATE TABLE `dashboard_level_relation_area_site` (
`area_id` bigint NOT NULL,
`site_id` bigint NOT NULL,
`created_by` bigint DEFAULT NULL,
`created_at` bigint DEFAULT NULL,
KEY `idx_area_site_area_id` (`area_id`),
KEY `idx_area_site_site_id` (`site_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='区域-site关系表';
/*Table structure for table `dashboard_level_relation_branch_store` */
DROP TABLE IF EXISTS `dashboard_level_relation_branch_store`;
CREATE TABLE `dashboard_level_relation_branch_store` (
`branch_id` bigint NOT NULL,
`store_id` bigint NOT NULL,
`created_by` bigint DEFAULT NULL,
`created_at` bigint DEFAULT NULL,
KEY `idx_branch_store_branch_id` (`branch_id`),
KEY `idx_branch_store_store_id` (`store_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支社-支店关系表';
/*Table structure for table `dashboard_level_relation_site_building` */
DROP TABLE IF EXISTS `dashboard_level_relation_site_building`;
CREATE TABLE `dashboard_level_relation_site_building` (
`site_id` bigint NOT NULL,
`building_id` bigint NOT NULL,
`created_by` bigint DEFAULT NULL,
`created_at` bigint DEFAULT NULL,
KEY `idx_site_building_site_id` (`site_id`),
KEY `idx_site_building_building_id` (`building_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='site-楼宇关系表';
/*Table structure for table `dashboard_level_relation_store_area` */
DROP TABLE IF EXISTS `dashboard_level_relation_store_area`;
CREATE TABLE `dashboard_level_relation_store_area` (
`store_id` bigint NOT NULL,
`area_id` bigint NOT NULL,
`created_by` bigint DEFAULT NULL,
`created_at` bigint DEFAULT NULL,
KEY `idx_store_area_store_id` (`store_id`),
KEY `idx_store_area_area_id` (`area_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支店-区域关系表';
/*Table structure for table `dashboard_level_role` */
DROP TABLE IF EXISTS `dashboard_level_role`;
CREATE TABLE `dashboard_level_role` (
`id` bigint NOT NULL AUTO_INCREMENT,
`company_id` bigint DEFAULT NULL,
`name` varchar(100) NOT NULL,
`remark` varchar(255) DEFAULT NULL,
`flag` int NOT NULL DEFAULT '0' COMMENT '0-正常,1-删除',
`created_by` bigint DEFAULT NULL,
`created_at` bigint DEFAULT NULL,
`updated_at` bigint DEFAULT NULL,
`updated_by` bigint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB CHARSET=utf8mb4 COMMENT='支社、分店等多层级控制角色';
/*Table structure for table `dashboard_level_role_object` */
DROP TABLE IF EXISTS `dashboard_level_role_object`;
CREATE TABLE `dashboard_level_role_object` (
`level_role_id` bigint NOT NULL,
`ref_type` enum('BRANCH','STORE','AREA','SITE','BUILDING') NOT NULL COMMENT '角色绑定的实体类型(指向哪个表)',
`ref_id` bigint NOT NULL COMMENT '对应层级表中的实体ID,例如:ref_type=SITE, ref_id=15 表示绑定了id=15的site',
`created_by` bigint DEFAULT NULL,
`created_at` bigint DEFAULT NULL,
`updated_at` bigint DEFAULT NULL,
`updated_by` bigint DEFAULT NULL,
UNIQUE KEY `ux_role_ref` (`ref_type`,`ref_id`,`level_role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色绑定的层级关系表';
/*Table structure for table `dashboard_level_role_user` */
DROP TABLE IF EXISTS `dashboard_level_role_user`;
CREATE TABLE `dashboard_level_role_user` (
`id` bigint NOT NULL AUTO_INCREMENT,
`user_id` bigint NOT NULL,
`level_role_id` bigint NOT NULL,
`ref_type` int NOT NULL DEFAULT '0' COMMENT '0-普通用户,1-管理员',
`created_by` bigint DEFAULT NULL,
`created_at` bigint DEFAULT NULL,
`updated_at` bigint DEFAULT NULL,
`updated_by` bigint DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_user_role_ref` (`user_id`,`level_role_id`,`ref_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='层级角色和用户关系表';
/*Table structure for table `dashboard_level_site` */
DROP TABLE IF EXISTS `dashboard_level_site`;
CREATE TABLE `dashboard_level_site` (
`id` bigint NOT NULL AUTO_INCREMENT,
`company_id` bigint DEFAULT NULL,
`name` varchar(255) NOT NULL,
`remark` varchar(255) DEFAULT NULL,
`flag` int NOT NULL DEFAULT '0' COMMENT '0-正常,1-删除',
`created_by` bigint DEFAULT NULL,
`created_at` bigint DEFAULT NULL,
`updated_at` bigint DEFAULT NULL,
`updated_by` bigint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='site表';
/*Table structure for table `dashboard_level_store` */
DROP TABLE IF EXISTS `dashboard_level_store`;
CREATE TABLE `dashboard_level_store` (
`id` bigint NOT NULL AUTO_INCREMENT,
`company_id` bigint DEFAULT NULL,
`name` varchar(255) NOT NULL,
`remark` varchar(255) DEFAULT NULL,
`flag` int NOT NULL DEFAULT '0' COMMENT '0-正常,1-删除',
`created_by` bigint DEFAULT NULL,
`created_at` bigint DEFAULT NULL,
`updated_at` bigint DEFAULT NULL,
`updated_by` bigint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='分店表';
/*Table structure for table `dashboard_notice_ignored` */
DROP TABLE IF EXISTS `dashboard_notice_ignored`;
@ -731,6 +913,42 @@ CREATE TABLE `dashboard_notice_ignored` (
UNIQUE KEY `redis_key` (`redis_key`,`member_value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='平台告警通知已读表';
/*Table structure for table `dashboard_notification` */
DROP TABLE IF EXISTS `dashboard_notification`;
CREATE TABLE `dashboard_notification` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`company_id` bigint DEFAULT NULL COMMENT '公司ID',
`demand_time` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '要求时间',
`category` varchar(255) DEFAULT NULL COMMENT '分类',
`category_id` bigint DEFAULT NULL,
`content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '通知内容',
`flag` int DEFAULT '0',
`created_at` bigint DEFAULT NULL COMMENT '创建时间',
`created_by` bigint DEFAULT NULL COMMENT '创建人',
`updated_at` bigint DEFAULT NULL COMMENT '更新时间',
`updated_by` bigint DEFAULT NULL COMMENT '更新人',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='通知表';
/*Table structure for table `dashboard_notification_category` */
DROP TABLE IF EXISTS `dashboard_notification_category`;
CREATE TABLE `dashboard_notification_category` (
`id` bigint NOT NULL AUTO_INCREMENT,
`company_id` bigint DEFAULT NULL,
`name` varchar(255) NOT NULL,
`remark` varchar(255) DEFAULT NULL,
`flag` int NOT NULL DEFAULT '0' COMMENT '0-正常,1-删除',
`created_by` bigint DEFAULT NULL,
`created_at` bigint DEFAULT NULL,
`updated_at` bigint DEFAULT NULL,
`updated_by` bigint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='通知表里的分类';
/*Table structure for table `dashboard_operation_log` */
DROP TABLE IF EXISTS `dashboard_operation_log`;
@ -1000,6 +1218,7 @@ CREATE TABLE `device_info` (
`remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
`building_id` bigint DEFAULT NULL COMMENT '楼宇ID',
`asset_id` bigint DEFAULT NULL COMMENT '资产ID',
`gateway_client_id` int DEFAULT NULL,
`flag` int DEFAULT '0' COMMENT '0:正常;1:删除',
`company_id` bigint DEFAULT NULL COMMENT '公司ID',
`created_by` bigint DEFAULT NULL,
@ -1015,6 +1234,9 @@ CREATE TABLE `device_info` (
`gateway_info_id` bigint DEFAULT NULL COMMENT '网关情报',
`alarm_level` int DEFAULT NULL COMMENT 'dashboard警报的级别,1-正常,2-紧急,3-严重故障,4-中等故障,5-轻微故障',
`retain_alert` int DEFAULT '0' COMMENT 'dashboard自动恢复告警时是否保留告警:0-不保留,1-保留',
`unit` varchar(45) DEFAULT NULL,
`data_mapping` json DEFAULT NULL COMMENT '数据映射关系,格式为:{"default":{"1":"漏水","2":"漏电","3":"起火"},"status":{"1":"开门","2":"关门"}},默认只有default一个字段,预留多字段设计',
`dashboard_decimal_places` int DEFAULT '2' COMMENT 'dashboard显示小数位数',
PRIMARY KEY (`id`),
KEY `idx_device_info` (`device_id`,`flag`,`type_id`),
KEY `idx_device_info_query` (`device_id`,`flag`)
@ -1037,6 +1259,7 @@ CREATE TABLE `device_rawdata_realtime` (
`upload_year` int DEFAULT NULL,
`upload_month` int DEFAULT NULL,
`upload_day` int DEFAULT NULL,
`dashboard_status` varchar(255) DEFAULT NULL,
PRIMARY KEY (`device_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
@ -1133,6 +1356,8 @@ CREATE TABLE `gateway_clients` (
`data_amount_threshold_alarm` int DEFAULT '0' COMMENT '数据量阈值告警,0=正常,1=告警',
`data_accumulated_totals` int DEFAULT NULL COMMENT '累计数据量',
`alert_switch` int DEFAULT '1' COMMENT '告警开关,1:开,0:关',
`project_id` bigint DEFAULT '0',
`building_id` bigint DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

2
dongjian-center-admin-controller/src/main/resources/sql/init_admin.sql

@ -135,6 +135,8 @@ CREATE TABLE `basic_user` (
`modifier_id` bigint DEFAULT NULL,
`super_role` int DEFAULT '0' COMMENT '超管权限,1超管,0普通',
`create_platform` int DEFAULT '0' COMMENT '创建平台,0-business, 1-dashboard',
`last_name` varchar(50) DEFAULT NULL COMMENT '',
`first_name` varchar(50) DEFAULT NULL COMMENT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

Loading…
Cancel
Save