06-test-module.sql 5.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. 测试模块数据库结构
  3. 业务域:测试和演示相关表
  4. 包含表:test_tree
  5. 说明:此模块用于系统测试和功能演示,包含树形结构测试数据
  6. 创建时间:2025-01-08
  7. 维护人员:项目开发团队
  8. */
  9. SET NAMES utf8mb4;
  10. SET FOREIGN_KEY_CHECKS = 0;
  11. -- ----------------------------
  12. -- Table structure for test_tree
  13. -- ----------------------------
  14. DROP TABLE IF EXISTS `test_tree`;
  15. CREATE TABLE `test_tree` (
  16. `id` bigint(20) NOT NULL COMMENT '主键ID',
  17. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  18. `parent_id` bigint(20) DEFAULT '0' COMMENT '父节点ID',
  19. `dept_id` bigint(20) DEFAULT NULL COMMENT '部门ID,关联sys_dept.dept_id',
  20. `user_id` bigint(20) DEFAULT NULL COMMENT '用户ID,关联sys_user.user_id',
  21. `tree_name` varchar(30) DEFAULT '' COMMENT '节点名称',
  22. `version` int(11) DEFAULT '0' COMMENT '版本号',
  23. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  24. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  25. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  26. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  27. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  28. `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  29. PRIMARY KEY (`id`),
  30. KEY `idx_tenant_id` (`tenant_id`),
  31. KEY `idx_parent_id` (`parent_id`),
  32. KEY `idx_dept_id` (`dept_id`),
  33. KEY `idx_user_id` (`user_id`),
  34. KEY `idx_del_flag` (`del_flag`),
  35. KEY `idx_create_time` (`create_time`)
  36. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='测试树表';
  37. -- ----------------------------
  38. -- Records of test_tree
  39. -- ----------------------------
  40. BEGIN;
  41. INSERT INTO `test_tree` (`id`, `tenant_id`, `parent_id`, `dept_id`, `user_id`, `tree_name`, `version`, `create_dept`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (1, '000000', 0, 102, 4, '测试数据权限', 0, 103, '2025-06-20 16:22:26', 1, NULL, NULL, '0');
  42. INSERT INTO `test_tree` (`id`, `tenant_id`, `parent_id`, `dept_id`, `user_id`, `tree_name`, `version`, `create_dept`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (2, '000000', 1, 102, 3, '子节点1', 0, 103, '2025-06-20 16:22:26', 1, NULL, NULL, '0');
  43. INSERT INTO `test_tree` (`id`, `tenant_id`, `parent_id`, `dept_id`, `user_id`, `tree_name`, `version`, `create_dept`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (3, '000000', 2, 102, 3, '子节点2', 0, 103, '2025-06-20 16:22:26', 1, NULL, NULL, '0');
  44. INSERT INTO `test_tree` (`id`, `tenant_id`, `parent_id`, `dept_id`, `user_id`, `tree_name`, `version`, `create_dept`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (4, '000000', 0, 108, 4, '测试树1', 0, 103, '2025-06-20 16:22:26', 1, NULL, NULL, '0');
  45. INSERT INTO `test_tree` (`id`, `tenant_id`, `parent_id`, `dept_id`, `user_id`, `tree_name`, `version`, `create_dept`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (5, '000000', 4, 108, 3, '子节点11', 0, 103, '2025-06-20 16:22:26', 1, NULL, NULL, '0');
  46. INSERT INTO `test_tree` (`id`, `tenant_id`, `parent_id`, `dept_id`, `user_id`, `tree_name`, `version`, `create_dept`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (6, '000000', 4, 108, 3, '子节点22', 0, 103, '2025-06-20 16:22:26', 1, NULL, NULL, '0');
  47. INSERT INTO `test_tree` (`id`, `tenant_id`, `parent_id`, `dept_id`, `user_id`, `tree_name`, `version`, `create_dept`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (7, '000000', 4, 108, 3, '子节点33', 0, 103, '2025-06-20 16:22:26', 1, NULL, NULL, '0');
  48. INSERT INTO `test_tree` (`id`, `tenant_id`, `parent_id`, `dept_id`, `user_id`, `tree_name`, `version`, `create_dept`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (8, '000000', 5, 108, 3, '子节点44', 0, 103, '2025-06-20 16:22:26', 1, NULL, NULL, '0');
  49. INSERT INTO `test_tree` (`id`, `tenant_id`, `parent_id`, `dept_id`, `user_id`, `tree_name`, `version`, `create_dept`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (9, '000000', 6, 108, 3, '子节点55', 0, 103, '2025-06-20 16:22:26', 1, NULL, NULL, '0');
  50. INSERT INTO `test_tree` (`id`, `tenant_id`, `parent_id`, `dept_id`, `user_id`, `tree_name`, `version`, `create_dept`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (10, '000000', 7, 108, 3, '子节点66', 0, 103, '2025-06-20 16:22:26', 1, NULL, NULL, '0');
  51. INSERT INTO `test_tree` (`id`, `tenant_id`, `parent_id`, `dept_id`, `user_id`, `tree_name`, `version`, `create_dept`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (11, '000000', 7, 108, 3, '子节点77', 0, 103, '2025-06-20 16:22:26', 1, NULL, NULL, '0');
  52. INSERT INTO `test_tree` (`id`, `tenant_id`, `parent_id`, `dept_id`, `user_id`, `tree_name`, `version`, `create_dept`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (12, '000000', 10, 108, 3, '子节点88', 0, 103, '2025-06-20 16:22:26', 1, NULL, NULL, '0');
  53. INSERT INTO `test_tree` (`id`, `tenant_id`, `parent_id`, `dept_id`, `user_id`, `tree_name`, `version`, `create_dept`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (13, '000000', 10, 108, 3, '子节点99', 0, 103, '2025-06-20 16:22:26', 1, NULL, NULL, '0');
  54. COMMIT;
  55. SET FOREIGN_KEY_CHECKS = 1;