}
return false;
}
public String toRootJson(boolean recursion){
Position rootPosition=getRootPosition();
if(rootPosition==null){
LOG.error("获取根岗位失败!");
return "";
}
StringBuilder json=new StringBuilder();
json.append("[");
json.append("{'text':'")
.append(rootPosition.getPositionName())
.append("','id':'position-")
.append(rootPosition.getId());
if(rootPosition.getChild().isEmpty()){
json.append("','leaf':true,'cls':'file'");
}else{
json.append("','leaf':false,'cls':'folder'");
if (recursion) {
for(Position item : rootPosition.getChild()){
json.append(",children:").append(toJson(item.getId(), recursion));
}
}
}
json.append("}");