修改标签维护字段名
This commit is contained in:
@@ -31,7 +31,7 @@ public class TreeLabelEntity implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String name;
|
||||
private String label;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
+6
-6
@@ -140,7 +140,7 @@ public class ITreeLabelServiceImpl extends ServiceImpl<TreeLabelDao, TreeLabelEn
|
||||
List<TreeLabelVo> tree = new ArrayList<>();
|
||||
for (TreeLabelVo label : treeLabelVos) {
|
||||
if (label.getParentId().equals(rootParentId)) {
|
||||
label.setChildLabel(createTree(label.getId(), treeLabelVos));
|
||||
label.setChildren(createTree(label.getId(), treeLabelVos));
|
||||
tree.add(label);
|
||||
}
|
||||
}
|
||||
@@ -150,20 +150,20 @@ public class ITreeLabelServiceImpl extends ServiceImpl<TreeLabelDao, TreeLabelEn
|
||||
public static TreeLabelVo filterByName(TreeLabelVo root, String name) {
|
||||
TreeLabelVo newRoot = new TreeLabelVo();
|
||||
newRoot.setId(root.getId());
|
||||
newRoot.setName(root.getName());
|
||||
newRoot.setLabel(root.getLabel());
|
||||
newRoot.setParentId(root.getParentId());
|
||||
newRoot.setOrderNum(root.getOrderNum());
|
||||
List<TreeLabelVo> childLabel = new ArrayList<>();
|
||||
if (root.getChildLabel() != null) {
|
||||
for (TreeLabelVo child : root.getChildLabel()) {
|
||||
if (root.getChildren() != null) {
|
||||
for (TreeLabelVo child : root.getChildren()) {
|
||||
TreeLabelVo newChild = filterByName(child, name);
|
||||
if (newChild != null) {
|
||||
childLabel.add(newChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
newRoot.setChildLabel(childLabel.isEmpty() ? null : childLabel);
|
||||
return root.getName().contains(name) || !childLabel.isEmpty() ? newRoot : null;
|
||||
newRoot.setChildren(childLabel.isEmpty() ? null : childLabel);
|
||||
return root.getLabel().contains(name) || !childLabel.isEmpty() ? newRoot : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class TreeLabelVo {
|
||||
* 标签名称
|
||||
*/
|
||||
@NotBlank(message = "名称不能为空")
|
||||
private String name;
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
@@ -48,10 +48,10 @@ public class TreeLabelVo {
|
||||
/**
|
||||
* 子标签
|
||||
*/
|
||||
private List<TreeLabelVo> childLabel;
|
||||
private List<TreeLabelVo> children;
|
||||
|
||||
public TreeLabelVo(String parentId) {
|
||||
this.parentId = parentId;
|
||||
this.childLabel = new ArrayList<>();
|
||||
this.children = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user