SET NAMES utf8mb4;

UPDATE `tb_sys_menu`
SET
  `component` = '',
  `modified` = NOW(),
  `modified_by` = 1,
  `remark` = '审批管理分组菜单'
WHERE `id` = 367100000000000001;

INSERT INTO `tb_sys_menu` (
  `id`, `parent_id`, `menu_type`, `menu_title`, `menu_url`, `component`, `menu_icon`,
  `is_show`, `permission_tag`, `sort_no`, `status`, `created`, `created_by`, `modified`, `modified_by`, `remark`
)
SELECT
  367100000000000002, 367100000000000001, 0, 'menus.system.approvalFlow', '/sys/approval/flow', '/system/approval/ApprovalManage', '',
  1, '', 1, 0, '2026-04-07 18:00:00', 1, '2026-04-07 18:00:00', 1, '审批管理-流程配置'
FROM DUAL
WHERE NOT EXISTS (
  SELECT 1 FROM `tb_sys_menu` WHERE `id` = 367100000000000002
);

INSERT INTO `tb_sys_menu` (
  `id`, `parent_id`, `menu_type`, `menu_title`, `menu_url`, `component`, `menu_icon`,
  `is_show`, `permission_tag`, `sort_no`, `status`, `created`, `created_by`, `modified`, `modified_by`, `remark`
)
SELECT
  367100000000000003, 367100000000000001, 0, 'menus.system.approvalPending', '/sys/approval/pending', '/system/approval/ApprovalManage', '',
  1, '', 2, 0, '2026-04-07 18:00:00', 1, '2026-04-07 18:00:00', 1, '审批管理-待审批'
FROM DUAL
WHERE NOT EXISTS (
  SELECT 1 FROM `tb_sys_menu` WHERE `id` = 367100000000000003
);

INSERT INTO `tb_sys_menu` (
  `id`, `parent_id`, `menu_type`, `menu_title`, `menu_url`, `component`, `menu_icon`,
  `is_show`, `permission_tag`, `sort_no`, `status`, `created`, `created_by`, `modified`, `modified_by`, `remark`
)
SELECT
  367100000000000004, 367100000000000001, 0, 'menus.system.approvalProcessed', '/sys/approval/processed', '/system/approval/ApprovalManage', '',
  1, '', 3, 0, '2026-04-07 18:00:00', 1, '2026-04-07 18:00:00', 1, '审批管理-已审批'
FROM DUAL
WHERE NOT EXISTS (
  SELECT 1 FROM `tb_sys_menu` WHERE `id` = 367100000000000004
);

INSERT INTO `tb_sys_menu` (
  `id`, `parent_id`, `menu_type`, `menu_title`, `menu_url`, `component`, `menu_icon`,
  `is_show`, `permission_tag`, `sort_no`, `status`, `created`, `created_by`, `modified`, `modified_by`, `remark`
)
SELECT
  367100000000000005, 367100000000000001, 0, 'menus.system.approvalInitiated', '/sys/approval/initiated', '/system/approval/ApprovalManage', '',
  1, '', 4, 0, '2026-04-07 18:00:00', 1, '2026-04-07 18:00:00', 1, '审批管理-我发起'
FROM DUAL
WHERE NOT EXISTS (
  SELECT 1 FROM `tb_sys_menu` WHERE `id` = 367100000000000005
);

INSERT INTO `tb_sys_role_menu` (`id`, `role_id`, `menu_id`)
SELECT 367100000000000102, 1, 367100000000000002
FROM DUAL
WHERE NOT EXISTS (
  SELECT 1 FROM `tb_sys_role_menu` WHERE `id` = 367100000000000102
);

INSERT INTO `tb_sys_role_menu` (`id`, `role_id`, `menu_id`)
SELECT 367100000000000103, 1, 367100000000000003
FROM DUAL
WHERE NOT EXISTS (
  SELECT 1 FROM `tb_sys_role_menu` WHERE `id` = 367100000000000103
);

INSERT INTO `tb_sys_role_menu` (`id`, `role_id`, `menu_id`)
SELECT 367100000000000104, 1, 367100000000000004
FROM DUAL
WHERE NOT EXISTS (
  SELECT 1 FROM `tb_sys_role_menu` WHERE `id` = 367100000000000104
);

INSERT INTO `tb_sys_role_menu` (`id`, `role_id`, `menu_id`)
SELECT 367100000000000105, 1, 367100000000000005
FROM DUAL
WHERE NOT EXISTS (
  SELECT 1 FROM `tb_sys_role_menu` WHERE `id` = 367100000000000105
);
