24
24
import cn .hutool .core .lang .UUID ;
25
25
import cn .hutool .core .map .MapUtil ;
26
26
import cn .hutool .core .util .CharsetUtil ;
27
- import java .util .HashMap ;
28
- import java .util .Map ;
29
27
import cn .hutool .core .util .EnumUtil ;
30
28
import cn .hutool .core .util .ObjectUtil ;
31
29
import cn .hutool .core .util .StrUtil ;
@@ -790,20 +788,20 @@ private Map<String, Long> buildMultiLevelDeptMapping(List<String> deptNames) {
790
788
* <p>
791
789
* 支持两种格式:
792
790
* <ul>
793
- * <li>多级部门:公司A: 研发部: 前端组</li>
791
+ * <li>多级部门:公司A/ 研发部/ 前端组</li>
794
792
* <li>单级部门:研发部</li>
795
793
* </ul>
796
- * 使用冒号(:) 作为层级分隔符,会逐级查找对应的部门
794
+ * 使用左斜杠/ 作为层级分隔符,会逐级查找对应的部门
797
795
* </p>
798
796
*
799
797
* @param deptPath 部门路径
800
798
* @return 部门信息,未找到时返回null
801
799
*/
802
800
private DeptDO findDeptByHierarchicalPath (String deptPath ) {
803
801
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 ());
807
805
}
808
806
809
807
/**
@@ -816,7 +814,7 @@ private DeptDO findDeptByHierarchicalPath(String deptPath) {
816
814
* @return 部门信息,未找到时返回null
817
815
*/
818
816
private DeptDO findMultiLevelDept (String deptPath ) {
819
- String [] pathParts = deptPath .split (":" );
817
+ String [] pathParts = deptPath .split (StringConstants . SLASH );
820
818
CheckUtils .throwIf (pathParts .length == 0 , "部门路径格式错误:{}" , deptPath );
821
819
822
820
// 从根部门开始逐级查找
0 commit comments