-- ============================================================
-- 河湖管理系统菜单配置 SQL
-- 适用数据库: 达梦DM / Oracle
-- 说明: 需要先有"系统管理"等RuoYi基础菜单
-- 使用方式: 登录系统 → 系统管理 → 菜单管理 → 或直接执行SQL
-- ============================================================

-- ==================== 一级菜单：河湖管理 ====================
INSERT INTO sys_menu (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 ('河湖管理', 0, 1, 'hzz', NULL, 1, 0, 'M', '0', '0', NULL, 'tree', 'admin', SYSDATE, 'admin', SYSDATE, '河湖管理系统顶级菜单');

-- 达梦获取刚插入的 menu_id 可用 IDENT_CURRENT('sys_menu')
-- 以下SQL假设河湖管理menu_id=1000（请根据实际自增值修改）

-- ==================== 模块1：水域岸线管理 ====================
-- 菜单
INSERT INTO sys_menu (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 ('水域岸线管理', 1000, 1, 'bankline', 'hzz/bankline/index', 1, 0, 'C', '0', '0', 'hzz:bankline:list', 'form', 'admin', SYSDATE, 'admin', SYSDATE, '河湖长制工作制度查询展示');

-- 模块1的按钮权限
INSERT INTO sys_menu (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 menu_id FROM (SELECT menu_id FROM sys_menu WHERE perms = 'hzz:bankline:list') t), 1, '', NULL, 1, 0, 'F', '0', '0', 'hzz:rule:file:list', '#', 'admin', SYSDATE, 'admin', SYSDATE, '');
INSERT INTO sys_menu (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 menu_id FROM (SELECT menu_id FROM sys_menu WHERE perms = 'hzz:bankline:list') t), 2, '', NULL, 1, 0, 'F', '0', '0', 'hzz:rule:article:list', '#', 'admin', SYSDATE, 'admin', SYSDATE, '');

-- ==================== 模块2：水域岸线（涉河项目+岸线统计） ====================
INSERT INTO sys_menu (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 ('涉河项目查询', 1000, 2, 'riverproject', 'hzz/riverproject/index', 1, 0, 'C', '0', '0', 'hzz:riverproject:list', 'build', 'admin', SYSDATE, 'admin', SYSDATE, '涉河项目查询与管理');

-- 涉河项目按钮权限
INSERT INTO sys_menu (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 menu_id FROM (SELECT menu_id FROM sys_menu WHERE perms = 'hzz:riverproject:list') t), 1, '', NULL, 1, 0, 'F', '0', '0', 'hzz:riverproject:add', '#', 'admin', SYSDATE, 'admin', SYSDATE, '');
INSERT INTO sys_menu (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 menu_id FROM (SELECT menu_id FROM sys_menu WHERE perms = 'hzz:riverproject:list') t), 2, '', NULL, 1, 0, 'F', '0', '0', 'hzz:riverproject:edit', '#', 'admin', SYSDATE, 'admin', SYSDATE, '');
INSERT INTO sys_menu (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 menu_id FROM (SELECT menu_id FROM sys_menu WHERE perms = 'hzz:riverproject:list') t), 3, '', NULL, 1, 0, 'F', '0', '0', 'hzz:riverproject:remove', '#', 'admin', SYSDATE, 'admin', SYSDATE, '');

-- 岸线功能区统计
INSERT INTO sys_menu (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 ('岸线功能区统计', 1000, 3, 'shoreline', 'hzz/shoreline/index', 1, 0, 'C', '0', '0', 'hzz:shoreline:list', 'chart', 'admin', SYSDATE, 'admin', SYSDATE, '岸线功能区长度统计');

-- ==================== 模块3：考核评估 ====================
INSERT INTO sys_menu (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 ('考核评估', 1000, 4, 'assess', 'hzz/assess/index', 1, 0, 'C', '0', '0', 'hzz:assess:list', 'edit', 'admin', SYSDATE, 'admin', SYSDATE, '考核评估：工作方案统计、河长湖长统计、公示牌统计、考核文件');

-- 考核评估按钮权限
INSERT INTO sys_menu (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 menu_id FROM (SELECT menu_id FROM sys_menu WHERE perms = 'hzz:assess:list') t), 1, '', NULL, 1, 0, 'F', '0', '0', 'hzz:assess:query', '#', 'admin', SYSDATE, 'admin', SYSDATE, '');

-- ==================== 模块4：督导检查 ====================
INSERT INTO sys_menu (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 ('督导检查', 1000, 5, 'supervision', 'hzz/supervision/index', 1, 0, 'C', '0', '0', 'hzz:supervision:list', 'monitor', 'admin', SYSDATE, 'admin', SYSDATE, '督导检查列表');

-- 督导检查按钮权限
INSERT INTO sys_menu (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 menu_id FROM (SELECT menu_id FROM sys_menu WHERE perms = 'hzz:supervision:list') t), 1, '', NULL, 1, 0, 'F', '0', '0', 'hzz:supervision:audit', '#', 'admin', SYSDATE, 'admin', SYSDATE, '');

-- 涉河项目督查
INSERT INTO sys_menu (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 ('涉河项目督查', 1000, 6, 'wps', 'hzz/wps/index', 1, 0, 'C', '0', '0', 'hzz:wps:list', 'list', 'admin', SYSDATE, 'admin', SYSDATE, '涉河项目督查查询与管理');

-- 涉河项目督查按钮权限
INSERT INTO sys_menu (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 menu_id FROM (SELECT menu_id FROM sys_menu WHERE perms = 'hzz:wps:list') t), 1, '', NULL, 1, 0, 'F', '0', '0', 'hzz:wps:add', '#', 'admin', SYSDATE, 'admin', SYSDATE, '');
INSERT INTO sys_menu (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 menu_id FROM (SELECT menu_id FROM sys_menu WHERE perms = 'hzz:wps:list') t), 2, '', NULL, 1, 0, 'F', '0', '0', 'hzz:wps:edit', '#', 'admin', SYSDATE, 'admin', SYSDATE, '');
INSERT INTO sys_menu (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 menu_id FROM (SELECT menu_id FROM sys_menu WHERE perms = 'hzz:wps:list') t), 3, '', NULL, 1, 0, 'F', '0', '0', 'hzz:wps:remove', '#', 'admin', SYSDATE, 'admin', SYSDATE, '');

-- 一湖两河清四乱
INSERT INTO sys_menu (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 ('一湖两河清四乱', 1000, 7, 'eventclear', 'hzz/eventclear/index', 1, 0, 'C', '0', '0', 'hzz:eventclear:list', 'warning', 'admin', SYSDATE, 'admin', SYSDATE, '一湖两河清四乱信息查询');

-- 清四乱按钮权限
INSERT INTO sys_menu (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 menu_id FROM (SELECT menu_id FROM sys_menu WHERE perms = 'hzz:eventclear:list') t), 1, '', NULL, 1, 0, 'F', '0', '0', 'hzz:eventclear:query', '#', 'admin', SYSDATE, 'admin', SYSDATE, '');

-- ============================================================
-- 分配权限：给超级管理员角色分配所有河湖管理菜单权限
-- ============================================================
-- 假设超级管理员角色 role_id = 1
-- INSERT INTO sys_role_menu (role_id, menu_id)
-- SELECT 1, menu_id FROM sys_menu WHERE menu_name IN (
--   '河湖管理', '水域岸线管理', '涉河项目查询', '岸线功能区统计',
--   '考核评估', '督导检查', '涉河项目督查', '一湖两河清四乱'
-- );
