feat: 代码生成路由菜单时同时添加CURD按钮权限
This commit is contained in:
@@ -408,6 +408,21 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||||||
String treePath = generateMenuTreePath(parentMenuId);
|
String treePath = generateMenuTreePath(parentMenuId);
|
||||||
menu.setTreePath(treePath);
|
menu.setTreePath(treePath);
|
||||||
this.updateById(menu);
|
this.updateById(menu);
|
||||||
|
|
||||||
|
// 生成CURD按钮权限
|
||||||
|
String permPrefix = genConfig.getModuleName() + ":" + StrUtil.lowerFirst(entityName) + ":";
|
||||||
|
String[] actions = {"查询", "新增", "编辑", "删除"};
|
||||||
|
String[] perms = {"query", "add", "edit", "delete"};
|
||||||
|
|
||||||
|
for (int i = 0; i < actions.length; i++) {
|
||||||
|
SysMenu button = new SysMenu();
|
||||||
|
button.setParentId(menu.getId());
|
||||||
|
button.setType(MenuTypeEnum.BUTTON);
|
||||||
|
button.setName(actions[i]);
|
||||||
|
button.setPerm(permPrefix + perms[i]);
|
||||||
|
this.save(button);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user