function main() {
	// 验证用户权限
	'use api/user/acl/excerpt.js'

	let filter = payload.get().path.split('/').pop();
	const res1 = SQL.query('system_sql', 'SELECT menu_id FROM sys_role_menus_rel WHERE delete_time IS NULL AND role_id = ?', filter);
	const res = SQL.query('system_sql', 'SELECT menu_id, menu_name,parent_id FROM sys_menus WHERE delete_time IS NULL');
	if (res && res1) {
		const checkedKeys = res1.map((item) => item.menu_id);
		// 格式化数据
		const newResult = res.map((itemO) => {
			const newObj = {};
			Object.keys(itemO).forEach((item) => {
				newObj[underscoreToCamel(item)] = itemO[item];
			});
			return {
				...newObj,
				parentId: newObj.parentId == 0 ? null : newObj.parentId
			};
		});
		const formatRes = formatOrgData(newResult);
		return okMsg({ checkedKeys, menus: formatRes });
	}
	return errMsg(404, '查询失败');
}

function formatOrgData(data, parentId = null) {
	return data
		.filter((item) => item.parentId == parentId)
		.map((item) => ({
			...item,
			children: formatOrgData(data, item.menuId),
		}));
}
