Compare commits

...

2 Commits

Author SHA1 Message Date
AprilWind
957b1edd18 update 增加菜单查询方法注释 2026-03-31 10:19:03 +08:00
AprilWind
11d392fb73 update 使用 StringUtils.SLASH 替代硬编码的斜杠 2026-03-31 09:12:57 +08:00
9 changed files with 25 additions and 11 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

@@ -92,7 +92,7 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo>, MPJBa
}
/**
* 根据用户ID查询菜单
* 查询正常状态下的全部的菜单和目录
*
* @return 菜单列表
*/
@@ -129,6 +129,13 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo>, MPJBa
.toList();
}
/**
* 根据条件查询当前用户的菜单列表
*
* @param menu 菜单筛选条件
* @param userId 用户ID
* @return 菜单列表
*/
default List<SysMenuVo> selectMenuListByUserId(SysMenuBo menu, Long userId) {
return this.selectJoinList(SysMenuVo.class, JoinWrappers.lambda("m", SysMenu.class)
.distinct()
@@ -147,6 +154,12 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo>, MPJBa
.orderByAsc("m", SysMenu::getOrderNum));
}
/**
* 查询当前用户的菜单树数据
*
* @param userId 用户ID
* @return 菜单列表
*/
default List<SysMenu> selectMenuTreeByUserId(Long userId) {
return this.selectJoinList(SysMenu.class, JoinWrappers.lambda("m", SysMenu.class)
.distinct()

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());