|
|
@ -138,25 +138,7 @@ public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn |
|
|
|
public R getsTheSubColumn(Integer pid, String ids) { |
|
|
|
public R getsTheSubColumn(Integer pid, String ids) { |
|
|
|
|
|
|
|
|
|
|
|
List<SysColumn> getsTheSubColumn = baseMapper.getsTheSubColumn(pid, ids); |
|
|
|
List<SysColumn> getsTheSubColumn = baseMapper.getsTheSubColumn(pid, ids); |
|
|
|
//用来保存父节点
|
|
|
|
return R.success( buildTree(getsTheSubColumn,pid)); |
|
|
|
List<SysColumn> rootColumn = new ArrayList<>(); |
|
|
|
|
|
|
|
//用来保存子节点
|
|
|
|
|
|
|
|
List<SysColumn> childList = new ArrayList<>(); |
|
|
|
|
|
|
|
//遍历所有栏目,将所有栏目的父栏目id为0的栏目放入父节点集合中
|
|
|
|
|
|
|
|
for (SysColumn column1 : getsTheSubColumn) { |
|
|
|
|
|
|
|
Integer parentId = column1.getFatherId(); |
|
|
|
|
|
|
|
if (parentId == 0) { |
|
|
|
|
|
|
|
rootColumn.add(column1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (SysColumn sysColumn : rootColumn) { |
|
|
|
|
|
|
|
Integer theColumnId = sysColumn.getId(); |
|
|
|
|
|
|
|
//调用工具类获取子节点
|
|
|
|
|
|
|
|
childList = getChildren(theColumnId, getsTheSubColumn); |
|
|
|
|
|
|
|
sysColumn.setChildren(childList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return R.success(rootColumn); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//return R.success(baseMapper.getsTheSubColumn(parentId, ids));
|
|
|
|
//return R.success(baseMapper.getsTheSubColumn(parentId, ids));
|
|
|
|