From 8577b7f1e48fd597d816578657e8545f35314ade Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 29 Jun 2022 09:08:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=9B=9E=20238?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/db/R_notice_update.sql | 3 + config/db/V1.6__sys_user_add_col.sql | 1 + config/db/V1.7__notice_add_col.sql | 1 + config/db/V1.8__project_add_table.sql | 77 +++++++++++++++++++ config/db/V1.9__comment_add_col.sql | 1 + config/db/V2.0__comment_add_col.sql | 1 + config/db/V2.1__sys_log_operation_add_col.sql | 1 + config/db/V2.2__project_update_col.sql | 7 ++ config/db/V2.3__addindex.sql | 28 +++++++ config/db/V2.4__create_view_1.sql | 13 ++++ config/db/V2.5__tb_data_resource_addcol.sql | 9 +++ .../db/V2.6__ability_application_add_col.sql | 1 + .../src/main/resources/application-dev.yml | 6 +- 13 files changed, 146 insertions(+), 3 deletions(-) create mode 100644 config/db/R_notice_update.sql create mode 100644 config/db/V1.6__sys_user_add_col.sql create mode 100644 config/db/V1.7__notice_add_col.sql create mode 100644 config/db/V1.8__project_add_table.sql create mode 100644 config/db/V1.9__comment_add_col.sql create mode 100644 config/db/V2.0__comment_add_col.sql create mode 100644 config/db/V2.1__sys_log_operation_add_col.sql create mode 100644 config/db/V2.2__project_update_col.sql create mode 100644 config/db/V2.3__addindex.sql create mode 100644 config/db/V2.4__create_view_1.sql create mode 100644 config/db/V2.5__tb_data_resource_addcol.sql create mode 100644 config/db/V2.6__ability_application_add_col.sql diff --git a/config/db/R_notice_update.sql b/config/db/R_notice_update.sql new file mode 100644 index 00000000..514e2dd4 --- /dev/null +++ b/config/db/R_notice_update.sql @@ -0,0 +1,3 @@ +UPDATE sys_notice SET `from` = '评论' WHERE title LIKE '需求%'; +UPDATE sys_notice SET `from` = '通知' WHERE title LIKE '流程%'; +UPDATE sys_notice SET `from` = '其他' WHERE title IS NULL; \ No newline at end of file diff --git a/config/db/V1.6__sys_user_add_col.sql b/config/db/V1.6__sys_user_add_col.sql new file mode 100644 index 00000000..9d61c61b --- /dev/null +++ b/config/db/V1.6__sys_user_add_col.sql @@ -0,0 +1 @@ +ALTER TABLE `sys_user` ADD COLUMN `guid` varchar(100) NULL; \ No newline at end of file diff --git a/config/db/V1.7__notice_add_col.sql b/config/db/V1.7__notice_add_col.sql new file mode 100644 index 00000000..25c168ee --- /dev/null +++ b/config/db/V1.7__notice_add_col.sql @@ -0,0 +1 @@ +ALTER TABLE `sys_notice` ADD COLUMN `from` varchar(255) NULL COMMENT '通知来源'; \ No newline at end of file diff --git a/config/db/V1.8__project_add_table.sql b/config/db/V1.8__project_add_table.sql new file mode 100644 index 00000000..979f95fb --- /dev/null +++ b/config/db/V1.8__project_add_table.sql @@ -0,0 +1,77 @@ +CREATE TABLE `tb_project` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `project_name` varchar(128) DEFAULT NULL COMMENT '项目名称', + `apply_dep` varchar(128) DEFAULT NULL COMMENT '申请单位', + `apply_user` varchar(128) DEFAULT NULL COMMENT '申请人', + `apply_time` datetime DEFAULT NULL COMMENT '申请时间', + `region_name` varchar(128) DEFAULT NULL COMMENT '所属区市', + `resp_dep` varchar(128) DEFAULT NULL COMMENT '责任处室', + `business_user` varchar(128) DEFAULT NULL COMMENT '业务联系人', + `business_phone` varchar(32) DEFAULT NULL COMMENT '业务联系电话', + `tech_user` varchar(128) DEFAULT NULL COMMENT '技术联系人', + `tech_phone` varchar(32) DEFAULT NULL COMMENT '技术联系电话', + `creator` bigint(20) DEFAULT NULL COMMENT '创建人', + `create_date` datetime DEFAULT NULL COMMENT '创建时间', + `updater` bigint(20) DEFAULT NULL COMMENT '修改人', + `update_date` datetime DEFAULT NULL COMMENT '修改时间', + `note1` longtext COMMENT '备用字段', + `note2` varchar(200) DEFAULT NULL COMMENT '备用字段', + `note3` varchar(500) DEFAULT NULL COMMENT '备用字段', + `note4` varchar(1000) DEFAULT NULL COMMENT '备用字段', + `note5` varchar(2000) DEFAULT NULL COMMENT '备用字段', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='项目表'; + +CREATE TABLE `tb_project_contrib` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `project_name` varchar(128) DEFAULT NULL COMMENT '项目名称', + `resource_name` varchar(128) DEFAULT NULL COMMENT '应用名称', + `ability_name` varchar(128) DEFAULT NULL COMMENT '能力名称', + `ability_type` varchar(64) DEFAULT NULL COMMENT '能力类型', + `apply_time` datetime DEFAULT NULL COMMENT '上架时间', + `apply_num` varchar(10) DEFAULT NULL COMMENT '申请次数', + `browse_num` varchar(10) DEFAULT NULL COMMENT '浏览次数', + `creator` bigint(20) DEFAULT NULL COMMENT '创建人', + `create_date` datetime DEFAULT NULL COMMENT '创建时间', + `updater` bigint(20) DEFAULT NULL COMMENT '修改人', + `update_date` datetime DEFAULT NULL COMMENT '修改时间', + `note1` longtext COMMENT '备用字段', + `note2` varchar(200) DEFAULT NULL COMMENT '备用字段', + `note3` varchar(500) DEFAULT NULL COMMENT '备用字段', + `note4` varchar(1000) DEFAULT NULL COMMENT '备用字段', + `note5` varchar(2000) DEFAULT NULL COMMENT '备用字段', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='项目贡献表'; + +CREATE TABLE `tb_project_use` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `project_name` varchar(128) DEFAULT NULL COMMENT '项目名称', + `resource_name` varchar(128) DEFAULT NULL COMMENT '应用名称', + `ability_name` varchar(128) DEFAULT NULL COMMENT '能力名称', + `ability_type` varchar(64) DEFAULT NULL COMMENT '能力类型', + `apply_time` datetime DEFAULT NULL COMMENT '上架时间', + `apply_num` varchar(10) DEFAULT NULL COMMENT '申请次数', + `browse_num` varchar(10) DEFAULT NULL COMMENT '浏览次数', + `creator` bigint(20) DEFAULT NULL COMMENT '创建人', + `create_date` datetime DEFAULT NULL COMMENT '创建时间', + `updater` bigint(20) DEFAULT NULL COMMENT '修改人', + `update_date` datetime DEFAULT NULL COMMENT '修改时间', + `note1` longtext COMMENT '备用字段', + `note2` varchar(200) DEFAULT NULL COMMENT '备用字段', + `note3` varchar(500) DEFAULT NULL COMMENT '备用字段', + `note4` varchar(1000) DEFAULT NULL COMMENT '备用字段', + `note5` varchar(2000) DEFAULT NULL COMMENT '备用字段', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='项目使用表'; + +CREATE TABLE `tb_data_resource_rel` ( + `key_id` bigint(20) DEFAULT NULL COMMENT '应用资源id', + `reference_id` bigint(20) DEFAULT NULL COMMENT '关联id', + `del_flag` int(11) DEFAULT '0' COMMENT '删除标志:\r\n0:正常;\r\n1:已删除;\r\n2:待审核;\r\n3:审核中;\r\n9其他', + `creator` bigint(20) DEFAULT NULL COMMENT '创建人', + `create_date` datetime DEFAULT NULL COMMENT '创建时间', + `updater` bigint(20) DEFAULT NULL COMMENT '修改人', + `update_date` datetime DEFAULT NULL COMMENT '修改时间', + `id` bigint(20) NOT NULL COMMENT 'id', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='组件-应用资源关系表'; \ No newline at end of file diff --git a/config/db/V1.9__comment_add_col.sql b/config/db/V1.9__comment_add_col.sql new file mode 100644 index 00000000..99342572 --- /dev/null +++ b/config/db/V1.9__comment_add_col.sql @@ -0,0 +1 @@ +ALTER TABLE `t_demand_comment` ADD COLUMN `del_flag` int(11) NULL COMMENT '删除标志:\r\n0:正常;\r\n1:已删除;\r\n2:待审核;\r\n3:审核中;\r\n9其他'; \ No newline at end of file diff --git a/config/db/V2.0__comment_add_col.sql b/config/db/V2.0__comment_add_col.sql new file mode 100644 index 00000000..9423b926 --- /dev/null +++ b/config/db/V2.0__comment_add_col.sql @@ -0,0 +1 @@ +ALTER TABLE `t_demand_comment` ADD COLUMN `instance_id` varchar(64) NULL COMMENT '流程实例ID'; \ No newline at end of file diff --git a/config/db/V2.1__sys_log_operation_add_col.sql b/config/db/V2.1__sys_log_operation_add_col.sql new file mode 100644 index 00000000..f47b6408 --- /dev/null +++ b/config/db/V2.1__sys_log_operation_add_col.sql @@ -0,0 +1 @@ +ALTER TABLE sys_log_operation ADD COLUMN result_data text NULL COMMENT '返回结果'; \ No newline at end of file diff --git a/config/db/V2.2__project_update_col.sql b/config/db/V2.2__project_update_col.sql new file mode 100644 index 00000000..76a96265 --- /dev/null +++ b/config/db/V2.2__project_update_col.sql @@ -0,0 +1,7 @@ +ALTER TABLE `tb_project_contrib` +MODIFY COLUMN `note1` bigint(20) DEFAULT NULL COMMENT '项目id,tb_project主键', +MODIFY COLUMN `note2` bigint(20) DEFAULT NULL COMMENT '应用id,tb_data_resource中类型为应用资源的主键id'; + +ALTER TABLE `tb_project_use` +MODIFY COLUMN `note1` bigint(20) DEFAULT NULL COMMENT '项目id,tb_project主键', +MODIFY COLUMN `note2` bigint(20) DEFAULT NULL COMMENT '应用id,tb_data_resource中类型为应用资源的主键id'; \ No newline at end of file diff --git a/config/db/V2.3__addindex.sql b/config/db/V2.3__addindex.sql new file mode 100644 index 00000000..cefbd950 --- /dev/null +++ b/config/db/V2.3__addindex.sql @@ -0,0 +1,28 @@ +-- 删除索引 +alter table `tb_resource_collection` drop index `resourceid`; +alter table `tb_resource_car` drop index `resourceid`; +alter table `tb_resource_score` drop index `resourceid`; +alter table `tb_resource_browse` drop index `resourceid`; +alter table `t_ability_application` drop index `resourceid`; +alter table `t_ability_application` drop index `userId`; +alter table `tb_data_resource` drop index `type`; +alter table `tb_data_attr` drop index `attr_value`; +alter table `tb_data_resource` drop index `name`; +alter table `tb_data_resource` drop index `deptId`; +alter table `sys_dept` drop index `type`; +alter table `sys_dept` drop index `district`; +alter table `tb_resource_collection` drop index `userId`; +-- 创建索引 +alter table `tb_resource_collection` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '收藏的资源id'; +alter table `tb_resource_car` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '加入申购车的id'; +alter table `tb_resource_score` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '评分的资源id'; +alter table `tb_resource_browse` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '资源id索引'; +alter table `t_ability_application` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '资源id'; +alter table `t_ability_application` ADD INDEX `userId`(`user_id`) USING BTREE comment '用户'; +alter table `tb_data_resource` ADD FULLTEXT INDEX `type`(`type`) with parser ngram; +alter table `tb_data_attr` ADD FULLTEXT INDEX `attr_value`(`attr_value`) with parser ngram; +alter table `tb_data_resource` ADD FULLTEXT INDEX `name`(`name`) with parser ngram; +alter table `tb_data_resource` ADD INDEX `deptId`(`dept_id`) USING BTREE; +alter table `sys_dept` ADD INDEX `type`(`type`) USING BTREE; +alter table `sys_dept` ADD INDEX `district`(`district`) USING BTREE; +alter table `tb_resource_collection` ADD INDEX `userId`(`user_id`) USING BTREE; \ No newline at end of file diff --git a/config/db/V2.4__create_view_1.sql b/config/db/V2.4__create_view_1.sql new file mode 100644 index 00000000..e34de110 --- /dev/null +++ b/config/db/V2.4__create_view_1.sql @@ -0,0 +1,13 @@ +create view `tb_data_resource_assignmark` AS select + tdr.id, + (IFNULL( visits / 100, 0 ) + IFNULL( trs.score, 0 ) + IFNULL( applyCount, 0 ) + IFNULL( collectCount, 0 )) as total +from + tb_data_resource tdr + left join ( select resource_id, avg( score ) as "score" from tb_resource_score where 1 = 1 and del_flag = 0 group by resource_id ) trs on tdr.id = trs.resource_id + left join ( select resource_id, count( id ) as "applyCount" from t_ability_application where 1 = 1 and del_flag = 0 group by resource_id ) taa on tdr.id = taa.resource_id + left join ( select resource_id, count( id ) as "collectCount" from tb_resource_collection where 1 = 1 and del_flag = 0 group by resource_id ) trc on tdr.id = trc.resource_id +where + 1 = 1 + and tdr.del_flag = 0 +order by + total desc ; \ No newline at end of file diff --git a/config/db/V2.5__tb_data_resource_addcol.sql b/config/db/V2.5__tb_data_resource_addcol.sql new file mode 100644 index 00000000..01032f16 --- /dev/null +++ b/config/db/V2.5__tb_data_resource_addcol.sql @@ -0,0 +1,9 @@ +alter table `tb_data_resource` ADD COLUMN `total` int NULL comment '整体评分'; + +update tb_data_resource, +tb_data_resource_assignmark +SET tb_data_resource.total = round(tb_data_resource_assignmark.total) +WHERE + tb_data_resource.id = tb_data_resource_assignmark.id; + +alter table `tb_data_resource`ADD INDEX `total`(`total` DESC) USING BTREE; \ No newline at end of file diff --git a/config/db/V2.6__ability_application_add_col.sql b/config/db/V2.6__ability_application_add_col.sql new file mode 100644 index 00000000..5ff95ae4 --- /dev/null +++ b/config/db/V2.6__ability_application_add_col.sql @@ -0,0 +1 @@ +ALTER TABLE t_ability_application ADD COLUMN `cameraList` json NULL COMMENT '摄像头ID数组'; \ No newline at end of file diff --git a/renren-admin/src/main/resources/application-dev.yml b/renren-admin/src/main/resources/application-dev.yml index 499d2bd5..736e02c0 100644 --- a/renren-admin/src/main/resources/application-dev.yml +++ b/renren-admin/src/main/resources/application-dev.yml @@ -6,10 +6,10 @@ spring: #MySQL driver-class-name: com.mysql.cj.jdbc.Driver - #url: jdbc:mysql://15.2.21.238:3310/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false - url: jdbc:mysql://15.2.21.221:3306/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false + url: jdbc:mysql://15.2.21.238:3310/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false + #url: jdbc:mysql://15.2.21.221:3306/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false username: root - password: Liwen073898! + password: Hisense2019 #Hisense2019 # #Oracle # driver-class-name: oracle.jdbc.OracleDriver