From 475a4ad136cb92ea3f3f81a0b2bb2a8b46cd1279 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Mon, 13 May 2024 11:38:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20sql=E7=B3=BB=E7=BB=9F=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- database/install/sys_dept.sql | 8 +-- database/upgrade/upg_sys_dept.sql | 107 +----------------------------- 2 files changed, 5 insertions(+), 110 deletions(-) diff --git a/database/install/sys_dept.sql b/database/install/sys_dept.sql index 9be7b0fa..ba68541a 100644 --- a/database/install/sys_dept.sql +++ b/database/install/sys_dept.sql @@ -45,12 +45,8 @@ CREATE TABLE `sys_dept` ( -- Dumping data for table `sys_dept` -- -LOCK TABLES `sys_dept` WRITE; -/*!40000 ALTER TABLE `sys_dept` DISABLE KEYS */; -INSERT INTO `sys_dept` VALUES (1,0,'0','dept.root',0,'supervisor',NULL,NULL,'1','0','supervisor',1699348237468,NULL,0),(101,100,'0,100','dept.root.item1',1,'supervisor',NULL,NULL,'1','0','supervisor',1699348237468,NULL,0); -/*!40000 ALTER TABLE `sys_dept` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; +INSERT INTO `sys_dept` VALUES (1, 0, '0', 'dept.root', 0, 'supervisor', NULL, NULL, '1', '0', 'supervisor', 1699348237468, NULL, 0); +INSERT INTO `sys_dept` VALUES (2, 1, '0,1', 'dept.root.item1', 1, 'supervisor', NULL, NULL, '1', '0', 'supervisor', 1699348237468, 'supervisor', 1715570736053); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/database/upgrade/upg_sys_dept.sql b/database/upgrade/upg_sys_dept.sql index 2e2a0840..d7878af8 100644 --- a/database/upgrade/upg_sys_dept.sql +++ b/database/upgrade/upg_sys_dept.sql @@ -1,5 +1,6 @@ SET FOREIGN_KEY_CHECKS=0; +DROP TABLE IF EXISTS `sys_menu`; CREATE TABLE IF NOT EXISTS `sys_dept` ( `dept_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '部门id', `parent_id` bigint(20) DEFAULT 0 COMMENT '父部门id 默认0', @@ -18,109 +19,7 @@ CREATE TABLE IF NOT EXISTS `sys_dept` ( PRIMARY KEY (`dept_id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='部门表'; --- -- add default dept - -INSERT - IGNORE INTO `omc_db`.`sys_dept` ( - `dept_id`, - `parent_id`, - `ancestors`, - `dept_name`, - `order_num`, - `leader`, - `phone`, - `email`, - `status`, - `del_flag`, - `create_by`, - `create_time`, - `update_by`, - `update_time` - ) -VALUES ( - 100, - 0, - '0', - '系统维护部', - 0, - 'admin', - '', - '', - '1', - '0', - 'admin', - 1697091866188, - '', - NULL - ); - -INSERT - IGNORE INTO `omc_db`.`sys_dept` ( - `dept_id`, - `parent_id`, - `ancestors`, - `dept_name`, - `order_num`, - `leader`, - `phone`, - `email`, - `status`, - `del_flag`, - `create_by`, - `create_time`, - `update_by`, - `update_time` - ) -VALUES ( - 101, - 100, - '0,100', - '运维一部', - 1, - 'admin', - '', - '', - '1', - '0', - 'admin', - 1697091866192, - '', - NULL - ); - --- for cn/en locale -UPDATE `omc_db`.`sys_dept` -SET - `parent_id` = 0, - `ancestors` = '0', - `dept_name` = 'dept.root', - `order_num` = 0, - `leader` = 'supervisor', - `phone` = NULL, - `email` = NULL, - `status` = '1', - `del_flag` = '0', - `create_by` = 'supervisor', - `create_time` = 1699348237468, - `update_by` = NULL, - `update_time` = 0 -WHERE `dept_id` = 100; - -UPDATE `omc_db`.`sys_dept` -SET - `parent_id` = 100, - `ancestors` = '0,100', - `dept_name` = 'dept.root.item1', - `order_num` = 1, - `leader` = 'supervisor', - `phone` = NULL, - `email` = NULL, - `status` = '1', - `del_flag` = '0', - `create_by` = 'supervisor', - `create_time` = 1699348237468, - `update_by` = NULL, - `update_time` = 0 -WHERE `dept_id` = 101; +INSERT IGNORE INTO `sys_dept` VALUES (1, 0, '0', 'dept.root', 0, 'supervisor', NULL, NULL, '1', '0', 'supervisor', 1699348237468, NULL, 0); +INSERT IGNORE INTO `sys_dept` VALUES (2, 1, '0,1', 'dept.root.item1', 1, 'supervisor', NULL, NULL, '1', '0', 'supervisor', 1699348237468, 'supervisor', 1715570736053); SET FOREIGN_KEY_CHECKS=1; \ No newline at end of file