mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-04-15 15:03:16 +08:00
update 优化代码写法
This commit is contained in:
@@ -55,7 +55,7 @@ public class DeptExcelConverter implements Converter<Long> {
|
||||
/**
|
||||
* 构建部门路径 → 树节点映射,供 Converter 和 Options 共用
|
||||
*/
|
||||
static Map<String, Tree<Long>> buildDeptPathMap(ISysDeptService deptService) {
|
||||
private Map<String, Tree<Long>> buildDeptPathMap(ISysDeptService deptService) {
|
||||
return TreeBuildUtils.buildTreeNodeMap(
|
||||
deptService.selectDeptTreeList(new SysDeptBo()),
|
||||
"/",
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package org.dromara.system.listener;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.utils.SpringUtils;
|
||||
import org.dromara.common.core.utils.TreeBuildUtils;
|
||||
import org.dromara.common.excel.core.ExcelOptionsProvider;
|
||||
import org.dromara.system.domain.bo.SysDeptBo;
|
||||
import org.dromara.system.service.ISysDeptService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -23,7 +27,8 @@ public class DeptExcelOptions implements ExcelOptionsProvider {
|
||||
@Override
|
||||
public Set<String> getOptions() {
|
||||
ISysDeptService deptService = SpringUtils.getBean(ISysDeptService.class);
|
||||
return DeptExcelConverter.buildDeptPathMap(deptService).keySet();
|
||||
List<Tree<Long>> trees = deptService.selectDeptTreeList(new SysDeptBo());
|
||||
return TreeBuildUtils.buildTreeNodeMap(trees, "/", Tree::getName).keySet();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user