refactor: 地区支持按分隔符转换名称
This commit is contained in:
@@ -95,6 +95,19 @@ public class AreaUtils {
|
||||
return area;
|
||||
}
|
||||
|
||||
public static Area parseArea(String pathStr, String separator) {
|
||||
String[] paths = pathStr.split(separator);
|
||||
Area area = null;
|
||||
for (String path : paths) {
|
||||
if (area == null) {
|
||||
area = findFirst(areas.values(), item -> item.getName().equals(path));
|
||||
} else {
|
||||
area = findFirst(area.getChildren(), item -> item.getName().equals(path));
|
||||
}
|
||||
}
|
||||
return area;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有节点的全路径名称如:河南省/石家庄市/新华区
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user