资料中心显示根据当前树节点及子节点显示全部数据
This commit is contained in:
@@ -5,6 +5,7 @@ import com.adc.da.slrs.zlTree.entity.ZlTree;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -51,4 +52,6 @@ public interface IZlTreeService extends IService<ZlTree> {
|
||||
* @return
|
||||
*/
|
||||
ZlTree queryTree(String treeId);
|
||||
|
||||
void subordinateTreeNodes(List<String> treeIds,String parentTreeId);
|
||||
}
|
||||
|
||||
@@ -154,4 +154,23 @@ public class ZlTreeServiceImpl extends ServiceImpl<ZlTreeDao, ZlTree> implements
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据树的父节点查询所有子节点id
|
||||
*
|
||||
* @param parentTreeId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void subordinateTreeNodes(List<String> treeIds, String parentTreeId) {
|
||||
treeIds.add(parentTreeId);
|
||||
QueryWrapper<ZlTree> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("p_id", parentTreeId);
|
||||
List<ZlTree> list = list(queryWrapper);
|
||||
if (ObjectUtils.isNotEmpty(list)) {
|
||||
for (ZlTree zlTree : list) {
|
||||
subordinateTreeNodes(treeIds,zlTree.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user