USE cattletrade;

-- 插入屠宰场管理菜单（一级目录 + 两个二级菜单 + 按钮权限）
-- 菜单类型：0-目录，1-菜单，2-按钮

-- 1) 一级菜单：屠宰场管理
INSERT INTO sys_menu (parent_id, type, icon, name, sort, route_url, page_url, org_type, authority, create_time, update_time, is_delete)
VALUES (
    0,
    0,
    'el-icon-knife-fork',
    '屠宰场管理',
    70,
    NULL,
    NULL,
    2,
    NULL,
    NOW(),
    NOW(),
    0
);

SET @slaughter_parent_id = LAST_INSERT_ID();

-- 2) 二级菜单：屠宰场管理（列表页）
INSERT INTO sys_menu (parent_id, type, icon, name, sort, route_url, page_url, org_type, authority, create_time, update_time, is_delete)
VALUES (
    @slaughter_parent_id,
    1,
    'el-icon-office-building',
    '屠宰场管理',
    1,
    'house',
    'slaughter/house',
    2,
    'slaughterHouse:list',
    NOW(),
    NOW(),
    0
);
SET @slaughter_house_menu_id = LAST_INSERT_ID();

INSERT INTO sys_menu (parent_id, type, icon, name, sort, route_url, page_url, org_type, authority, create_time, update_time, is_delete)
VALUES
    (@slaughter_house_menu_id, 2, NULL, '新增', 1, NULL, NULL, 2, 'slaughterHouse:add', NOW(), NOW(), 0),
    (@slaughter_house_menu_id, 2, NULL, '编辑', 2, NULL, NULL, 2, 'slaughterHouse:edit', NOW(), NOW(), 0),
    (@slaughter_house_menu_id, 2, NULL, '删除', 3, NULL, NULL, 2, 'slaughterHouse:delete', NOW(), NOW(), 0),
    (@slaughter_house_menu_id, 2, NULL, '查询', 4, NULL, NULL, 2, 'slaughterHouse:query', NOW(), NOW(), 0);

-- 3) 二级菜单：进场管理
INSERT INTO sys_menu (parent_id, type, icon, name, sort, route_url, page_url, org_type, authority, create_time, update_time, is_delete)
VALUES (
    @slaughter_parent_id,
    1,
    'el-icon-truck',
    '进场管理',
    2,
    'entry',
    'slaughter/entry',
    2,
    'slaughterEntry:list',
    NOW(),
    NOW(),
    0
);
SET @slaughter_entry_menu_id = LAST_INSERT_ID();

INSERT INTO sys_menu (parent_id, type, icon, name, sort, route_url, page_url, org_type, authority, create_time, update_time, is_delete)
VALUES
    (@slaughter_entry_menu_id, 2, NULL, '新增', 1, NULL, NULL, 2, 'slaughterEntry:add', NOW(), NOW(), 0),
    (@slaughter_entry_menu_id, 2, NULL, '编辑', 2, NULL, NULL, 2, 'slaughterEntry:edit', NOW(), NOW(), 0),
    (@slaughter_entry_menu_id, 2, NULL, '删除', 3, NULL, NULL, 2, 'slaughterEntry:delete', NOW(), NOW(), 0),
    (@slaughter_entry_menu_id, 2, NULL, '查询', 4, NULL, NULL, 2, 'slaughterEntry:query', NOW(), NOW(), 0);

