| | |
| | | * @param queryVO |
| | | * @return |
| | | */ |
| | | /* |
| | | public List<Long> searchDrawing(NcNodeQueryVO queryVO) { |
| | | List<NcNode> nodes = lambdaQuery().eq(NcNode::getNodeType,NcNode.TYPE_DRAWING_NO) |
| | | .eq(NcNode::getIsLastEdition,1) |
| | |
| | | }).list(); |
| | | |
| | | return nodes.stream().map(NcNode::getId).toList(); |
| | | } |
| | | }*/ |
| | | /** |
| | | * 首页树查询 |
| | | * @param queryVO |
| | |
| | | return rootVos; |
| | | } |
| | | |
| | | /** |
| | | * 首页搜索 新的 |
| | | * @param queryVO 查询参数 |
| | | * @return |
| | | */ |
| | | public List<NcNodeVO> searchList2(NcNodeQueryVO queryVO) { |
| | | //1.根据零组件号和创建时间查询初始列表,查询的原始列表,需要hasChild字段,所以使用mapper.xml |
| | | List<NcNodeVO> oriList = this.getBaseMapper().searchList2(queryVO); |
| | | |
| | | |
| | | List<NcNodeVO> allVos = new ArrayList<>();//已经加入过的节点,用于去重 |
| | | List<NcNodeVO> rootVos = new ArrayList<>(); |
| | | |
| | | for(NcNodeVO vo : oriList){ |
| | | allVos.add(vo); |
| | | //上级各级的节点 |
| | | List<NcNodeVO> parents = this.getBaseMapper().searchListInIds(Func.toLongList(vo.getParentIds())); |
| | | |
| | | for(NcNodeVO pvo : parents){ |
| | | if(pvo.getParentId() == 0L){ |
| | | rootVos.add(pvo); |
| | | } |
| | | allVos.add(pvo); |
| | | } |
| | | } |
| | | for(NcNodeVO root : rootVos){ |
| | | addNodeChildren(root, allVos); |
| | | } |
| | | return rootVos; |
| | | } |
| | | |
| | | void addNodeChildren(NcNodeVO node, List<NcNodeVO> allNodes) { |
| | | for(NcNodeVO vo : allNodes){ |
| | | if(Objects.equals(vo.getParentId(), node.getId())){ |