更多ruoyi-nbcio功能请看演示系统
gitee源代码地址
前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio
演示地址:RuoYi-Nbcio后台管理系统
1、我看我的原先系统生成的代码id都是很长如下:
-- 菜单 SQL 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(1727583402356690945, '流程操作规则', '3', '1', 'operateRule', 'workflow/operateRule/index', 1, 0, 'C', '0', '0', 'workflow:operateRule:list', '#', 'admin', sysdate(), '', null, '流程操作规则菜单'); -- 按钮 SQL 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(1727583402356690946, '流程操作规则查询', 1727583402356690945, '1', '#', '', 1, 0, 'F', '0', '0', 'workflow:operateRule:query', '#', 'admin', sysdate(), '', null, ''); 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(1727583402356690947, '流程操作规则新增', 1727583402356690945, '2', '#', '', 1, 0, 'F', '0', '0', 'workflow:operateRule:add', '#', 'admin', sysdate(), '', null, ''); 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(1727583402356690948, '流程操作规则修改', 1727583402356690945, '3', '#', '', 1, 0, 'F', '0', '0', 'workflow:operateRule:edit', '#', 'admin', sysdate(), '', null, ''); 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(1727583402356690949, '流程操作规则删除', 1727583402356690945, '4', '#', '', 1, 0, 'F', '0', '0', 'workflow:operateRule:remove', '#', 'admin', sysdate(), '', null, ''); 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(1727583402356690950, '流程操作规则导出', 1727583402356690945, '5', '#', '', 1, 0, 'F', '0', '0', 'workflow:operateRule:export', '#', 'admin', sysdate(), '', null, '');
2、当然也有可能我配置问题,但我还不大熟悉tuoyi平台,有知道的可以知会一下作者,不过后来我看ruoyi-vue与ruoyi-vue-plus都是这样,那我还是自己修改一下生成代码的菜单id吧。
在系统公共服务里增加下面服务SysCommServiceImple
@Override public Long selectMaxId() { return sysMenuMapper.selectMaxId(); } //获取最大id for 生成代码用 add by nbacheng @Select("select max(menu_id) from sys_menu") Long selectMaxId();
在模拟与实际代码增加如下:
List<Long> menuIds = new ArrayList<>(); Long genMenuId = CommonService.selectMaxId(); for (int i = 0; i < 6; i++) { genMenuId = genMenuId + 1 ; menuIds.add(genMenuId); }
3、效果图:
原先菜单数据如下:
修改后模拟生成如下:
4、不过还是网友提醒的好,分布式系统或系统迁移的时候就会出现很多问题,还是雪花算法可能更加合适,所以大家修改也要谨慎。