后台项目递归
@Override
public List<SxZlNode> getAllSxZlNodeListByCondition() {
SxZlNode node = new SxZlNode();
node.setNodeId(null);
List<SxZlNode> nodeList = sxZlNodeMapper.selectNodeListByPid(node);
if (nodeList != null && nodeList.size() > 0) {
return findAllNodeList(nodeList);
} else {
return null;
}
}
// 递归获取所有节点及图片集合
private List<SxZlNode> findAllNodeList(List<SxZlNode> sxZlNodeList) {
for (SxZlNode node : sxZlNodeList) {
List<SxZlNode> nodeList = sxZlNodeMapper.selectNodeListByPid(node);
if (nodeList != null && nodeList.size() > 0) {
node.setSxZlNodeList(findAllNodeList(nodeList));
} else {
SxZlPicture sxZlPicture = new SxZlPicture();
sxZlPicture.setNodeId(node.getNodeId());
List<SxZlPicture> pictureList = sxZlPictureMapper.selectPictureListByNodeId(sxZlPicture);
if (pictureList != null && pictureList.size() > 0) {
node.setSxZlPictureList(pictureList);
}
}
}
return sxZlNodeList;
}