【fix sonar】PermissionDataUtil文件
This commit is contained in:
+20
-13
@@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.jero.common.util.oConvertUtils;
|
import com.jero.common.util.oConvertUtils;
|
||||||
import com.jero.modules.system.entity.SysPermission;
|
import com.jero.modules.system.entity.SysPermission;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: scott
|
* @Author: scott
|
||||||
@@ -26,19 +27,7 @@ public class PermissionDataUtil {
|
|||||||
|
|
||||||
// 组件
|
// 组件
|
||||||
if (oConvertUtils.isNotEmpty(permission.getComponent())) {
|
if (oConvertUtils.isNotEmpty(permission.getComponent())) {
|
||||||
String component = permission.getComponent();
|
String component = getComponent(permission);
|
||||||
if (component.startsWith("/")) {
|
|
||||||
component = component.substring(1);
|
|
||||||
}
|
|
||||||
if (component.startsWith("views/")) {
|
|
||||||
component = component.replaceFirst("views/", "");
|
|
||||||
}
|
|
||||||
if (component.startsWith("src/views/")) {
|
|
||||||
component = component.replaceFirst("src/views/", "");
|
|
||||||
}
|
|
||||||
if (component.endsWith(".vue")) {
|
|
||||||
component = component.replace(".vue", "");
|
|
||||||
}
|
|
||||||
permission.setComponent(component);
|
permission.setComponent(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,6 +51,24 @@ public class PermissionDataUtil {
|
|||||||
return permission;
|
return permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static String getComponent(SysPermission permission) {
|
||||||
|
String component = permission.getComponent();
|
||||||
|
if (component.startsWith("/")) {
|
||||||
|
component = component.substring(1);
|
||||||
|
}
|
||||||
|
if (component.startsWith("views/")) {
|
||||||
|
component = component.replaceFirst("views/", "");
|
||||||
|
}
|
||||||
|
if (component.startsWith("src/views/")) {
|
||||||
|
component = component.replaceFirst("src/views/", "");
|
||||||
|
}
|
||||||
|
if (component.endsWith(".vue")) {
|
||||||
|
component = component.replace(".vue", "");
|
||||||
|
}
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 如果没有index页面 需要new 一个放到list中
|
* 如果没有index页面 需要new 一个放到list中
|
||||||
* @param metaList
|
* @param metaList
|
||||||
|
|||||||
Reference in New Issue
Block a user