修改[获取当前标签的父级路径]接口
This commit is contained in:
+2
-2
@@ -51,9 +51,9 @@ public class TreeLabelManagerController {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取当前标签的路径List")
|
||||
@ApiOperation("获取当前标签的父级路径")
|
||||
@GetMapping("/labelList/{id}")
|
||||
public ResponseMessage add(@PathVariable String id) {
|
||||
public ResponseMessage parentLabelList(@PathVariable String id) {
|
||||
List<String> labelList = iTreeLabelService.getLabelList(id);
|
||||
return Result.success(labelList);
|
||||
}
|
||||
|
||||
+4
-3
@@ -152,12 +152,13 @@ public class ITreeLabelServiceImpl extends ServiceImpl<TreeLabelDao, TreeLabelEn
|
||||
public List<String> getLabelList(String id) {
|
||||
List<String> labelList = new ArrayList<>();
|
||||
TreeLabelEntity treeLabelEntity = getById(id);
|
||||
//获取上层标签
|
||||
treeLabelEntity = getById(treeLabelEntity.getParentId());
|
||||
labelList.add(treeLabelEntity.getId());
|
||||
while (!TreeLabelConstants.ROOT_TAG_PARENT_ID.equals(treeLabelEntity.getParentId())) {
|
||||
labelList.add(treeLabelEntity.getId());
|
||||
treeLabelEntity = getById(treeLabelEntity.getParentId());
|
||||
labelList.add(treeLabelEntity.getId());
|
||||
}
|
||||
TreeLabelEntity root = getById(TreeLabelConstants.ROOT_LABEL_ID);
|
||||
labelList.add(root.getId());
|
||||
Collections.reverse(labelList);
|
||||
return labelList;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user