INSERT INTO `zyt_system_menu`
(`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_show`, `is_disable`, `create_time`, `update_time`)
SELECT
    parent.id,
    'A',
    '删除',
    '',
    4,
    'finance.account_cost/delete',
    '',
    '',
    '',
    '',
    1,
    0,
    UNIX_TIMESTAMP(),
    UNIX_TIMESTAMP()
FROM `zyt_system_menu` parent
WHERE parent.perms = 'finance.account_cost/lists'
  AND NOT EXISTS (
      SELECT 1
      FROM `zyt_system_menu` child
      WHERE child.pid = parent.id
        AND child.perms = 'finance.account_cost/delete'
  );
