INSERT INTO platform_permission (id, permission_code, permission_name, module)
VALUES
    (6, 'platform.role.manage', '平台角色管理', 'platform'),
    (7, 'platform.permission.read', '平台权限查看', 'platform')
ON DUPLICATE KEY UPDATE permission_name = VALUES(permission_name), module = VALUES(module);

INSERT INTO platform_role_permission (id, role_id, permission_id)
VALUES
    (6, 1, 6),
    (7, 1, 7)
ON DUPLICATE KEY UPDATE permission_id = VALUES(permission_id);

INSERT INTO platform_menu (id, menu_code, menu_name, route_path, permission_code, sort_no, status, is_deleted, created_by, updated_by)
VALUES
    (4, 'platform_user_manage', '平台用户管理', '/platform/users', 'platform.user.manage', 15, 'ENABLED', 0, 0, 0),
    (5, 'platform_role_manage', '平台角色管理', '/platform/roles', 'platform.role.read', 16, 'ENABLED', 0, 0, 0),
    (6, 'platform_permission_manage', '平台权限管理', '/platform/permissions', 'platform.permission.read', 17, 'ENABLED', 0, 0, 0)
ON DUPLICATE KEY UPDATE
    menu_name = VALUES(menu_name),
    route_path = VALUES(route_path),
    permission_code = VALUES(permission_code),
    sort_no = VALUES(sort_no),
    status = VALUES(status),
    is_deleted = VALUES(is_deleted),
    updated_at = CURRENT_TIMESTAMP;

INSERT INTO platform_role_menu (id, role_id, menu_id)
VALUES
    (4, 1, 4),
    (5, 1, 5),
    (6, 1, 6)
ON DUPLICATE KEY UPDATE menu_id = VALUES(menu_id);
