字符串形成树形
有的时候我们形成树形不是以ID的关系进行匹配的而是以字符串进行形成
数据
CREATE TABLE `contract_main_org_info` (
`id` bigint(20) NOT NULL COMMENT '组织单位id',
`parent_id` int(11) NULL DEFAULT NULL COMMENT '父组织单位id',
`org_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组织名称',
`org_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组织单位code',
`create_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间'
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
INSERT INTO `contract_main_org_info` VALUES (1676, 1645, '绍兴元气集团有限公司', 'A0001A0004', 'admin', '2024-06-04 20:43:37');
INSERT INTO `contract_main_org_info` VALUES (1748, 1645, '浙江云鱼力业集团有限公司', 'A0001A0005', 'admin', '2024-06-04 20:43:37');
INSERT INTO `contract_main_org_info` VALUES (1977, 1645, '光耀投资集团有限公司', 'A0001A0014', 'admin', '2024-06-04 20:56:17');
INSERT INTO `contract_main_org_info` VALUES (1821, 1645, '衢州明力投资集团有限公司', 'A0001A0013', 'admin', '2024-06-04 22:42:50');
INSERT INTO `contract_main_org_info` VALUES (2196, 1645, '计划展有限公司', 'A0001A0017', 'admin', '2024-06-04 23:04:27');
INSERT INTO `contract_main_org_info` VALUES (1666, 1645, '金华达力团有限公司', 'A0001A0003', 'admin', '2024-06-05 08:49:34');
INSERT INTO `contract_main_org_info` VALUES (2194, 1645, '综合治理部', 'A0001A0015', 'admin', '2024-06-05 09:40:50');
INSERT INTO `contract_main_org_info` VALUES (1646, 1645, '温州盛世集团有限公司', 'A0001A0001', 'admin', '2024-06-05 09:46:19');
INSERT INTO `contract_main_org_info` VALUES (2016, 1977, '招标投资公司', 'A0001A0014A0001', 'admin', '2024-06-05 09:55:31');
INSERT INTO `contract_main_org_info` VALUES (2017, 1977, '大运监理公司', 'A0001A0014A0003', 'admin', '2024-06-05 09:55:31');
INSERT INTO `contract_main_org_info` VALUES (2018, 1977, '大夏设计院有限公司', 'A0001A0014A0004', 'admin', '2024-06-05 09:55:31');
INSERT INTO `contract_main_org_info` VALUES (2019, 1977, '大唐经济技术开发区中原有限责任公司', 'A0001A0014A0005', 'admin', '2024-06-05 09:55:31');
INSERT INTO `contract_main_org_info` VALUES (2170, 1977, '大唐光明发展有限公司', 'A0001A0014A0006', 'admin', '2024-06-05 09:55:31');
INSERT INTO `contract_main_org_info` VALUES (2173, 1977, '大唐核聚变建设有限公司', 'A0001A0014A0007', 'admin', '2024-06-05 09:55:31');
INSERT INTO `contract_main_org_info` VALUES (2181, 1977, '大唐服务有限公司', 'A0001A0014A0008', 'admin', '2024-06-05 09:55:31');
INSERT INTO `contract_main_org_info` VALUES (2186, 1977, '大汉运输工程有限公司', 'A0001A0014A0009', 'admin', '2024-06-05 09:55:31');
INSERT INTO `contract_main_org_info` VALUES (2187, 1977, '大汉晨南力建设有限公司', 'A0001A0014A0010', 'admin', '2024-06-05 09:55:31');
INSERT INTO `contract_main_org_info` VALUES (2188, 1977, '渤海雁山建设有限公司', 'A0001A0014A0011', 'admin', '2024-06-05 09:55:31');
INSERT INTO `contract_main_org_info` VALUES (2192, 1977, '象牙山工业有限公司', 'A0001A0014A0012', 'admin', '2024-06-05 09:55:31');
INSERT INTO `contract_main_org_info` VALUES (2197, 1977, '欧洲永动机产业投资有限公司', 'A0001A0014A0013', 'admin', '2024-06-05 09:55:31');
INSERT INTO `contract_main_org_info` VALUES (2198, 1977, '宏大输工程有限公司', 'A0001A0014A0014', 'admin', '2024-06-05 09:55:31');
INSERT INTO `contract_main_org_info` VALUES (2380, 2340, '创力研究院有限公司', 'A0001A0022A0001', 'admin', '2024-06-05 11:49:41');
INSERT INTO `contract_main_org_info` VALUES (2389, 2340, '创力集团有限公司博创物资分公司', 'A0001A0022A0004', 'admin', '2024-06-05 11:49:41');
INSERT INTO `contract_main_org_info` VALUES (2424, 2340, '纳众提供服务有限公司', 'A0001A0022A0017', 'admin', '2024-06-05 11:49:41');
INSERT INTO `contract_main_org_info` VALUES (4771, 1645, '测试集团有限公司', 'A0001A0043', 'admin', '2024-06-04 22:43:29');
INSERT INTO `contract_main_org_info` VALUES (2910, 2380, '创力研究院有限公司海盐分公司', 'A0001A0022A0001A0010', 'admin', '2024-06-05 14:22:56');
INSERT INTO `contract_main_org_info` VALUES (3540, 2910, '大元北目有限公司', 'A0001A0022A0001A0010A0001', 'admin', '2024-06-05 14:22:56');
INSERT INTO `contract_main_org_info` VALUES (1653, 1645, '北京大明聚力集团有限公司', 'A0001A0002', 'admin', '2024-06-05 14:25:30');
INSERT INTO `contract_main_org_info` VALUES (1657, 1653, '战略发展部', 'A0001A0002A0003', 'admin', '2024-06-05 14:25:30');
INSERT INTO `contract_main_org_info` VALUES (1655, 1653, '综合管理部', 'A0001A0002A0002', 'admin', '2024-06-05 14:26:06');
INSERT INTO `contract_main_org_info` VALUES (1659, 1653, '财务财产部', 'A0001A0002A0004', 'admin', '2024-06-05 14:26:06');
INSERT INTO `contract_main_org_info` VALUES (3893, 1977, '后汉投资集团有限公司东耀汽车运输分公司', 'A0001A0014A0025', 'admin', '2024-06-05 16:17:28');
INSERT INTO `contract_main_org_info` VALUES (4713, 1977, '后汉经济技术开发区北方有限责任公司', 'A0001A0014A0026', 'admin', '2024-06-05 16:20:26');
INSERT INTO `contract_main_org_info` VALUES (3158, 2305, '公司战略发展部', 'A0001A0014A0011A0002A0001', 'admin', '2024-06-05 16:31:29');
INSERT INTO `contract_main_org_info` VALUES (2699, 2018, '项目经理部门', 'A0001A0014A0004A0004', 'admin', '2024-06-05 16:35:42');
INSERT INTO `contract_main_org_info` VALUES (2302, 2186, '大明集团有限公司', 'A0001A0014A0009A0001', 'admin', '2024-06-05 16:35:42');
INSERT INTO `contract_main_org_info` V