-- 车辆里程统计菜单权限
-- 父菜单ID需要根据实际系统中的"系统管理"或"车辆管理"菜单ID进行调整

-- 1. 添加车辆里程统计菜单
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES (
  (SELECT IFNULL(MAX(menu_id), 0) + 1 FROM sys_menu t),
  '车辆里程统计', 
  3, -- 系统工具，请根据实际情况修改parent_id
  6, 
  'mileageStats', 
  'system/mileageStats/index', 
  1, 
  0, 
  'C', 
  '0', 
  '0', 
  'system:mileageStats:list', 
  'chart', 
  'admin', 
  NOW(), 
  '', 
  NULL, 
  '车辆里程统计菜单'
);

-- 获取刚插入的菜单ID（用于后续按钮权限）
SET @menuId = (SELECT MAX(menu_id) FROM sys_menu WHERE menu_name = '车辆里程统计');

-- 2. 添加查询按钮
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES ((SELECT IFNULL(MAX(menu_id), 0) + 1 FROM sys_menu t), '车辆里程统计查询', @menuId, 1, '#', '', 1, 0, 'F', '0', '0', 'system:mileageStats:query', '#', 'admin', NOW(), '', NULL, '');

-- 3. 添加新增按钮
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES ((SELECT IFNULL(MAX(menu_id), 0) + 1 FROM sys_menu t), '车辆里程统计新增', @menuId, 2, '#', '', 1, 0, 'F', '0', '0', 'system:mileageStats:add', '#', 'admin', NOW(), '', NULL, '');

-- 4. 添加修改按钮
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES ((SELECT IFNULL(MAX(menu_id), 0) + 1 FROM sys_menu t), '车辆里程统计修改', @menuId, 3, '#', '', 1, 0, 'F', '0', '0', 'system:mileageStats:edit', '#', 'admin', NOW(), '', NULL, '');

-- 5. 添加删除按钮
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES ((SELECT IFNULL(MAX(menu_id), 0) + 1 FROM sys_menu t), '车辆里程统计删除', @menuId, 4, '#', '', 1, 0, 'F', '0', '0', 'system:mileageStats:remove', '#', 'admin', NOW(), '', NULL, '');

-- 6. 添加导出按钮
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES ((SELECT IFNULL(MAX(menu_id), 0) + 1 FROM sys_menu t), '车辆里程统计导出', @menuId, 5, '#', '', 1, 0, 'F', '0', '0', 'system:mileageStats:export', '#', 'admin', NOW(), '', NULL, '');

-- 7. 添加计算按钮
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES ((SELECT IFNULL(MAX(menu_id), 0) + 1 FROM sys_menu t), '车辆里程统计计算', @menuId, 6, '#', '', 1, 0, 'F', '0', '0', 'system:mileageStats:calculate', '#', 'admin', NOW(), '', NULL, '');

-- 8. 添加批量计算按钮
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES ((SELECT IFNULL(MAX(menu_id), 0) + 1 FROM sys_menu t), '车辆里程统计批量计算', @menuId, 7, '#', '', 1, 0, 'F', '0', '0', 'system:mileageStats:batch', '#', 'admin', NOW(), '', NULL, '');
