dev
parent
ac452af8ed
commit
366402eb13
|
@ -97,14 +97,18 @@ public class ApiGroupServiceImpl extends BaseServiceImpl<ApiGroupDao, ApiGroupEn
|
||||||
* @param path 父级路径
|
* @param path 父级路径
|
||||||
* @return 完整路径
|
* @return 完整路径
|
||||||
*/
|
*/
|
||||||
|
//1
|
||||||
private String recursionPath(ApiGroupEntity groupEntity, String path) {
|
private String recursionPath(ApiGroupEntity groupEntity, String path) {
|
||||||
if (StringUtil.isBlank(path)) {
|
if (StringUtil.isBlank(path)) {
|
||||||
|
// 如果路径为空,则将路径设置为组实体的名称
|
||||||
path = groupEntity.getName();
|
path = groupEntity.getName();
|
||||||
}
|
}
|
||||||
if (groupEntity.getParentId() != 0) {
|
if (groupEntity.getParentId() != 0) {
|
||||||
ApiGroupEntity parent = getById(groupEntity.getParentId());
|
// 如果组实体的父ID不为0
|
||||||
path = parent.getName() + "/" + path;
|
// 查询父级组实体
|
||||||
return recursionPath(parent, path);
|
ApiGroupEntity parent = getById(groupEntity.getParentId()); // 通过父ID获取父级组实体
|
||||||
|
path = parent.getName() + "/" + path; // 将父级组实体的名称与当前路径拼接起来,中间以斜杠分隔
|
||||||
|
return recursionPath(parent, path); // 递归调用recursionPath方法,传入父级组实体和拼接后的路径
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue