mirror of https://gitee.com/stylefeng/roses
【rule】更新ant正则url校验和layui菜单拼接,增加context-path
parent
f9f016698d
commit
4b702db3e4
|
@ -22,10 +22,10 @@ public class AntPathMatcherUtil {
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2020/12/15 22:31
|
* @date 2020/12/15 22:31
|
||||||
*/
|
*/
|
||||||
public static Boolean getAntMatchFLag(String requestURI, List<String> antPatterns) {
|
public static Boolean getAntMatchFLag(String requestURI, String contextPath, List<String> antPatterns) {
|
||||||
AntPathMatcher antPathMatcher = new AntPathMatcher();
|
AntPathMatcher antPathMatcher = new AntPathMatcher();
|
||||||
for (String notAuthResourcePattern : antPatterns) {
|
for (String notAuthResourcePattern : antPatterns) {
|
||||||
if (antPathMatcher.match(notAuthResourcePattern, requestURI)) {
|
if (antPathMatcher.match(contextPath + notAuthResourcePattern, requestURI)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package cn.stylefeng.roses.kernel.menu.modular.factory;
|
package cn.stylefeng.roses.kernel.menu.modular.factory;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import cn.stylefeng.roses.kernel.menu.modular.entity.SysMenu;
|
import cn.stylefeng.roses.kernel.menu.modular.entity.SysMenu;
|
||||||
import cn.stylefeng.roses.kernel.rule.enums.StatusEnum;
|
|
||||||
import cn.stylefeng.roses.kernel.rule.factory.DefaultTreeBuildFactory;
|
import cn.stylefeng.roses.kernel.rule.factory.DefaultTreeBuildFactory;
|
||||||
|
import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
|
||||||
import cn.stylefeng.roses.kernel.system.AppServiceApi;
|
import cn.stylefeng.roses.kernel.system.AppServiceApi;
|
||||||
import cn.stylefeng.roses.kernel.system.pojo.menu.layui.LayuiAppIndexMenus;
|
import cn.stylefeng.roses.kernel.system.pojo.menu.layui.LayuiAppIndexMenus;
|
||||||
import cn.stylefeng.roses.kernel.system.pojo.menu.layui.LayuiIndexMenuTreeNode;
|
import cn.stylefeng.roses.kernel.system.pojo.menu.layui.LayuiIndexMenuTreeNode;
|
||||||
|
@ -32,6 +31,8 @@ public class LayuiMenusFactory {
|
||||||
*/
|
*/
|
||||||
public static List<LayuiAppIndexMenus> createLayuiAppIndexMenus(List<SysMenu> sysMenuList) {
|
public static List<LayuiAppIndexMenus> createLayuiAppIndexMenus(List<SysMenu> sysMenuList) {
|
||||||
|
|
||||||
|
String contextPath = HttpServletUtil.getRequest().getContextPath();
|
||||||
|
|
||||||
ArrayList<LayuiAppIndexMenus> resultList = new ArrayList<>();
|
ArrayList<LayuiAppIndexMenus> resultList = new ArrayList<>();
|
||||||
|
|
||||||
// 找出用户有多少个应用的菜单
|
// 找出用户有多少个应用的菜单
|
||||||
|
@ -54,6 +55,10 @@ public class LayuiMenusFactory {
|
||||||
for (SysMenu appMenu : appMenus) {
|
for (SysMenu appMenu : appMenus) {
|
||||||
LayuiIndexMenuTreeNode layuiIndexMenuTreeNode = new LayuiIndexMenuTreeNode();
|
LayuiIndexMenuTreeNode layuiIndexMenuTreeNode = new LayuiIndexMenuTreeNode();
|
||||||
BeanUtil.copyProperties(appMenu, layuiIndexMenuTreeNode);
|
BeanUtil.copyProperties(appMenu, layuiIndexMenuTreeNode);
|
||||||
|
|
||||||
|
// 每个节点的url要加上context-path
|
||||||
|
layuiIndexMenuTreeNode.setRouter(contextPath + layuiIndexMenuTreeNode.getRouter());
|
||||||
|
|
||||||
layuiIndexMenuTreeNodes.add(layuiIndexMenuTreeNode);
|
layuiIndexMenuTreeNodes.add(layuiIndexMenuTreeNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue