update 使用 StringUtils.SLASH 替代硬编码的斜杠

This commit is contained in:
AprilWind
2026-03-31 09:12:35 +08:00
parent ec9e98096f
commit 11d392fb73
8 changed files with 11 additions and 10 deletions

View File

@@ -110,7 +110,7 @@ public class SpringDocConfig {
public OpenApiCustomizer openApiCustomizer() {
String contextPath = serverProperties.getServlet().getContextPath();
String finalContextPath;
if (StringUtils.isBlank(contextPath) || "/".equals(contextPath)) {
if (StringUtils.isBlank(contextPath) || StringUtils.SLASH.equals(contextPath)) {
finalContextPath = "";
} else {
finalContextPath = contextPath;

View File

@@ -610,7 +610,7 @@ public class GenTableServiceImpl implements IGenTableService {
*/
public static String getGenPath(GenTable table, String template) {
String genPath = table.getGenPath();
if (StringUtils.equals(genPath, "/")) {
if (StringUtils.equals(genPath, StringUtils.SLASH)) {
return System.getProperty("user.dir") + File.separator + "src" + File.separator + TemplateEngineUtils.getFileName(template, table);
}
return genPath + File.separator + TemplateEngineUtils.getFileName(template, table);

View File

@@ -202,8 +202,8 @@ public class TemplateEngineUtils {
// 业务名称
String businessName = genTable.getBusinessName();
String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/");
String mybatisPath = MYBATIS_PATH + "/" + moduleName;
String javaPath = PROJECT_PATH + StringUtils.SLASH + StringUtils.replace(packageName, ".", StringUtils.SLASH);
String mybatisPath = MYBATIS_PATH + StringUtils.SLASH + moduleName;
String vuePath = "vue";
// templatePath
// genFilePathFormat

View File

@@ -136,11 +136,11 @@ public class SysMenu extends BaseEntity {
// 非外链并且是一级目录(类型为目录)
if (Constants.TOP_PARENT_ID.equals(getParentId()) && SystemConstants.TYPE_DIR.equals(getMenuType())
&& SystemConstants.NO.equals(getIsFrame())) {
routerPath = "/" + this.path;
routerPath = StringUtils.SLASH + this.path;
}
// 非外链并且是一级目录(类型为菜单)
else if (isMenuFrame()) {
routerPath = "/";
routerPath = StringUtils.SLASH;
}
return routerPath;
}

View File

@@ -70,7 +70,7 @@ public class MetaVo {
if (StringUtils.ishttp(link)) {
this.link = link;
}
if (StringUtils.startWithAnyIgnoreCase(activeMenu, "/")) {
if (StringUtils.startWithAnyIgnoreCase(activeMenu, StringUtils.SLASH)) {
this.activeMenu = activeMenu;
}
}

View File

@@ -50,7 +50,7 @@ public class DeptExcelConverter implements Converter<Long> {
Map<String, Tree<Long>> deptPathToTreeMap = TreeBuildUtils.buildTreeNodeMap(
SpringUtils.getBean(ISysDeptService.class).selectDeptTreeList(new SysDeptBo()),
"/",
StringUtils.SLASH,
Tree::getName
);

View File

@@ -2,6 +2,7 @@ package org.dromara.system.listener;
import cn.hutool.core.lang.tree.Tree;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.core.utils.TreeBuildUtils;
import org.dromara.common.excel.core.ExcelOptionsProvider;
import org.dromara.system.domain.bo.SysDeptBo;
@@ -31,7 +32,7 @@ public class DeptExcelOptions implements ExcelOptionsProvider {
@Override
public Set<String> getOptions() {
List<Tree<Long>> trees = deptService.selectDeptTreeList(new SysDeptBo());
Map<String, Tree<Long>> treeMap = TreeBuildUtils.buildTreeNodeMap(trees, "/", Tree::getName);
Map<String, Tree<Long>> treeMap = TreeBuildUtils.buildTreeNodeMap(trees, StringUtils.SLASH, Tree::getName);
return treeMap.keySet();
}

View File

@@ -187,7 +187,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
router.setChildren(childrenList);
} else if (menu.getParentId().equals(Constants.TOP_PARENT_ID) && menu.isInnerLink()) {
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon()));
router.setPath("/");
router.setPath(StringUtils.SLASH);
List<RouterVo> childrenList = new ArrayList<>();
RouterVo children = new RouterVo();
String routerPath = SysMenu.innerLinkReplaceEach(menu.getPath());