优化代码,children为空则不序列化

This commit is contained in:
smallchill 2018-12-25 22:41:05 +08:00
parent 716448593e
commit 4afe559cf0

View File

@ -15,6 +15,7 @@
*/ */
package org.springblade.core.tool.node; package org.springblade.core.tool.node;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data; import lombok.Data;
import java.util.ArrayList; import java.util.ArrayList;
@ -28,8 +29,20 @@ import java.util.List;
@Data @Data
public class BaseNode implements INode { public class BaseNode implements INode {
protected Integer id;//主键ID /**
protected Integer parentId;//父节点ID * 主键ID
protected List<INode> children = new ArrayList<>();//子孙节点 */
protected Integer id;
/**
* 父节点ID
*/
protected Integer parentId;
/**
* 子孙节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected List<INode> children = new ArrayList<>();
} }