怎么将多张表信息合并到1个树目录里?

7

  需要增加如下代码信息。 

SELECT NULL AS
	`parentId`,
	`a`.`app_id` AS `id`,
	`a`.`app_name` AS `name`,
	'app' AS `type`,
	`a`.`order_num` AS `order_num`,
	`a`.`app_id` AS `app_id`,
	'' AS `group_id`,
	`a`.`tenant_code` AS `tenant_code` 
FROM
	`v_sys_application` `a` UNION
SELECT
	( CASE WHEN ( `g`.`parent_group_id` IS NOT NULL ) THEN `g`.`parent_group_id` ELSE `g`.`app_id` END ) AS `parentId`,
	`g`.`group_id` AS `id`,
	`g`.`group_name` AS `name`,
	'group' AS `type`,
	`g`.`order_num` AS `order_num`,
	`g`.`app_id` AS `app_id`,
	`g`.`group_id` AS `group_id`,
	`g`.`tenant_code` AS `tenant_code` 
FROM
	`fpj_page_group` `g`

 

用户评价