Skip to content

Commit ac2e16c

Browse files
committed
chore(user): 用户导入多部门分隔符变更 : -> /
1 parent 2b795b9 commit ac2e16c

File tree

2 files changed

+6
-8
lines changed
  • continew-server/src/main/resources/templates/import
  • continew-system/src/main/java/top/continew/admin/system/service/impl

2 files changed

+6
-8
lines changed
0 Bytes
Binary file not shown.

continew-system/src/main/java/top/continew/admin/system/service/impl/UserServiceImpl.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
import cn.hutool.core.lang.UUID;
2525
import cn.hutool.core.map.MapUtil;
2626
import cn.hutool.core.util.CharsetUtil;
27-
import java.util.HashMap;
28-
import java.util.Map;
2927
import cn.hutool.core.util.EnumUtil;
3028
import cn.hutool.core.util.ObjectUtil;
3129
import cn.hutool.core.util.StrUtil;
@@ -790,20 +788,20 @@ private Map<String, Long> buildMultiLevelDeptMapping(List<String> deptNames) {
790788
* <p>
791789
* 支持两种格式:
792790
* <ul>
793-
* <li>多级部门:公司A:研发部:前端组</li>
791+
* <li>多级部门:公司A/研发部/前端组</li>
794792
* <li>单级部门:研发部</li>
795793
* </ul>
796-
* 使用冒号(:)作为层级分隔符,会逐级查找对应的部门
794+
* 使用左斜杠/作为层级分隔符,会逐级查找对应的部门
797795
* </p>
798796
*
799797
* @param deptPath 部门路径
800798
* @return 部门信息,未找到时返回null
801799
*/
802800
private DeptDO findDeptByHierarchicalPath(String deptPath) {
803801
CheckUtils.throwIfBlank(deptPath, "部门路径不能为空");
804-
805-
// 根据是否包含冒号选择处理方式
806-
return deptPath.contains(":") ? findMultiLevelDept(deptPath) : findSingleLevelDept(deptPath.trim());
802+
return deptPath.contains(StringConstants.SLASH)
803+
? findMultiLevelDept(deptPath)
804+
: findSingleLevelDept(deptPath.trim());
807805
}
808806

809807
/**
@@ -816,7 +814,7 @@ private DeptDO findDeptByHierarchicalPath(String deptPath) {
816814
* @return 部门信息,未找到时返回null
817815
*/
818816
private DeptDO findMultiLevelDept(String deptPath) {
819-
String[] pathParts = deptPath.split(":");
817+
String[] pathParts = deptPath.split(StringConstants.SLASH);
820818
CheckUtils.throwIf(pathParts.length == 0, "部门路径格式错误:{}", deptPath);
821819

822820
// 从根部门开始逐级查找

0 commit comments

Comments
 (0)