feat: 树形改为isLeaf

This commit is contained in:
2024-08-06 20:32:11 +08:00
parent 941bf5179e
commit 5640c9ed85
4 changed files with 10 additions and 10 deletions
@@ -179,11 +179,11 @@ public class SysDictItem implements TreeNode {
private List<SysDictItem> childrenList; private List<SysDictItem> childrenList;
/** /**
* 是否还有子集 * 是否是叶子节点
*/ */
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "是否还有子集") @ApiModelProperty(value = "是否是叶子节点")
private boolean hasChild; private boolean isLeaf;
@Override @Override
public String obtainTreeNodeId() { public String obtainTreeNodeId() {
@@ -99,11 +99,11 @@ public class PartName implements Serializable, TreeNode {
private String parentCode; private String parentCode;
/** /**
* 父级分类内部码(根节点0) * 是否是叶子节点
*/ */
@ApiModelProperty(value = "父级分类内部码(根节点0)") @ApiModelProperty(value = "是否是叶子节点")
@TableField(exist = false) @TableField(exist = false)
private boolean hasChild; private boolean isLeaf;
/** /**
* 子零部件 * 子零部件
@@ -40,7 +40,7 @@ public class DictTreeService {
List<SysDictItem> childList = dictItemService.list(queryWrapper); List<SysDictItem> childList = dictItemService.list(queryWrapper);
list.forEach(item -> { list.forEach(item -> {
if (childList.stream().anyMatch(child -> child.getParentId().equals(item.getId()))) { if (childList.stream().anyMatch(child -> child.getParentId().equals(item.getId()))) {
item.setHasChild(true); item.setLeaf(false);
} }
}); });
return list; return list;
@@ -73,7 +73,7 @@ public class DictTreeService {
List<SysDictItem> childList = dictItemService.list(queryWrapper); List<SysDictItem> childList = dictItemService.list(queryWrapper);
list.forEach(item -> { list.forEach(item -> {
if (childList.stream().anyMatch(child -> child.getParentId().equals(item.getId()))) { if (childList.stream().anyMatch(child -> child.getParentId().equals(item.getId()))) {
item.setHasChild(true); item.setLeaf(false);
} }
}); });
return list; return list;
@@ -196,7 +196,7 @@ public class PartNameServiceImpl extends ServiceImpl<PartNameMapper, PartName>
List<PartName> childList = list(queryWrapper); List<PartName> childList = list(queryWrapper);
list.forEach(item -> { list.forEach(item -> {
if (childList.stream().anyMatch(child -> child.getParentCode().equals(item.getCode()))) { if (childList.stream().anyMatch(child -> child.getParentCode().equals(item.getCode()))) {
item.setHasChild(true); item.setLeaf(false);
} }
}); });
return list; return list;
@@ -221,7 +221,7 @@ public class PartNameServiceImpl extends ServiceImpl<PartNameMapper, PartName>
List<PartName> childList = list(queryWrapper); List<PartName> childList = list(queryWrapper);
list.forEach(item -> { list.forEach(item -> {
if (childList.stream().anyMatch(child -> child.getParentCode().equals(item.getCode()))) { if (childList.stream().anyMatch(child -> child.getParentCode().equals(item.getCode()))) {
item.setHasChild(true); item.setLeaf(false);
} }
}); });
return list; return list;