-- 行业发票平台 — 菜单配置
-- 一级目录 (parent_id 后续更新为实际插入的id)
-- type: 0=目录, 1=菜单, 2=按钮

-- 一级目录
INSERT INTO sys_menu (name, type, "order", icon, route_name, route_path, component_path, title, hidden, keep_alive, always_show, parent_id, status, created_time, updated_time)
VALUES ('Invoice', 0, 6, 'file-text', 'Invoice', '/industry-invoice-platform', NULL, '行业发票平台', FALSE, FALSE, TRUE, 0, '1', NOW(), NOW());

-- 二级菜单 (parent_id 需为上面那条的 id，此处用子查询)
DO $$
DECLARE
    parent_id bigint;
BEGIN
    SELECT id INTO parent_id FROM sys_menu WHERE route_name = 'Invoice' AND parent_id = 0;

    -- 交易及发票管理
    INSERT INTO sys_menu (name, type, "order", icon, route_name, route_path, component_path, title, hidden, keep_alive, always_show, parent_id, status, created_time, updated_time)
    VALUES ('InvoiceOrder', 1, 1, 'file-text', 'InvoiceOrder', '/industry-invoice-platform/order', 'module_payment/invoice/order/index', '交易及发票管理', FALSE, TRUE, FALSE, parent_id, '1', NOW(), NOW());

    -- 转账账户管理
    INSERT INTO sys_menu (name, type, "order", icon, route_name, route_path, component_path, title, hidden, keep_alive, always_show, parent_id, status, created_time, updated_time)
    VALUES ('InvoiceAccount', 1, 2, '转账', 'InvoiceAccount', '/industry-invoice-platform/account', 'module_payment/invoice/account/index', '转账账户管理', FALSE, TRUE, FALSE, parent_id, '1', NOW(), NOW());

    -- 缴税管理
    INSERT INTO sys_menu (name, type, "order", icon, route_name, route_path, component_path, title, hidden, keep_alive, always_show, parent_id, status, created_time, updated_time)
    VALUES ('InvoiceTax', 1, 3, 'file-text', 'InvoiceTax', '/industry-invoice-platform/payTaxes', 'module_payment/invoice/tax/index', '缴税管理', FALSE, TRUE, FALSE, parent_id, '1', NOW(), NOW());

    -- 员工管理
    INSERT INTO sys_menu (name, type, "order", icon, route_name, route_path, component_path, title, hidden, keep_alive, always_show, parent_id, status, created_time, updated_time)
    VALUES ('InvoiceEmployee', 1, 4, '员工管理', 'InvoiceEmployee', '/industry-invoice-platform/employeeManagement', 'module_payment/invoice/employee/index', '员工管理', FALSE, TRUE, FALSE, parent_id, '1', NOW(), NOW());

    -- 常用商品管理
    INSERT INTO sys_menu (name, type, "order", icon, route_name, route_path, component_path, title, hidden, keep_alive, always_show, parent_id, status, created_time, updated_time)
    VALUES ('InvoiceGoods', 1, 5, '商品2', 'InvoiceGoods', '/industry-invoice-platform/goods', 'module_payment/invoice/goods/index', '常用商品管理', FALSE, TRUE, FALSE, parent_id, '1', NOW(), NOW());

    -- 企业信息
    INSERT INTO sys_menu (name, type, "order", icon, route_name, route_path, component_path, title, hidden, keep_alive, always_show, parent_id, status, created_time, updated_time)
    VALUES ('InvoiceCompany', 1, 6, '企业信息', 'InvoiceCompany', '/industry-invoice-platform/company', 'module_payment/invoice/company/index', '企业信息', FALSE, TRUE, FALSE, parent_id, '1', NOW(), NOW());

    -- 供应商管理
    INSERT INTO sys_menu (name, type, "order", icon, route_name, route_path, component_path, title, hidden, keep_alive, always_show, parent_id, status, created_time, updated_time)
    VALUES ('InvoiceSupplier', 1, 7, '供应商', 'InvoiceSupplier', '/industry-invoice-platform/suppliers', 'module_payment/invoice/supplier/index', '供应商管理', FALSE, TRUE, FALSE, parent_id, '1', NOW(), NOW());

    -- 任务中心
    INSERT INTO sys_menu (name, type, "order", icon, route_name, route_path, component_path, title, hidden, keep_alive, always_show, parent_id, status, created_time, updated_time)
    VALUES ('InvoiceTask', 1, 8, 'KHCFDC_任务中心', 'InvoiceTask', '/industry-invoice-platform/tasks', 'module_payment/invoice/task/index', '任务中心', FALSE, TRUE, FALSE, parent_id, '1', NOW(), NOW());

END $$;
