瀏覽代碼

收藏夹优化

lvy 6 天之前
父節點
當前提交
b67f19e0df

+ 3 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsTreeContractTreeAllVO.java

@@ -59,6 +59,9 @@ public class WbsTreeContractTreeAllVO implements INode<WbsTreeContractTreeAllVO>
     @ApiModelProperty(value = "是否隐藏,2为隐藏")
     private Integer isBussShow;
 
+    @ApiModelProperty("是否存在下级")
+    private Boolean notExsitChild;
+
     @Override
     public List<WbsTreeContractTreeAllVO> getChildren() {
         if (this.children == null) {

+ 2 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ContractInfoController.java

@@ -920,7 +920,7 @@ public class ContractInfoController extends BladeController {
     }
     @GetMapping("/getCollectTreeNodeByQuery")
     @ApiOperationSupport(order = 27)
-    @ApiOperation(value = "获取收藏节点树", notes = "获取收藏节点树")
+    @ApiOperation(value = "搜索收藏节点树", notes = "搜索收藏节点树")
     public R<Object> getCollectTreeNodeByQuery(@RequestParam String queryValue, @RequestParam String contractId, @RequestParam String tableOwner, @RequestParam Long folderId) {
         R<Object> result = contractInfoService.getCollectTreeNodeByQuery(contractId, tableOwner,folderId, queryValue);
         R<Object> data = doResult(contractId, result);
@@ -965,7 +965,7 @@ public class ContractInfoController extends BladeController {
                                     .collect(Collectors.toList());
                             for (WbsTreeContractTreeAllVO wbsTreeContractVO : typedList) {
                                 if (ObjectUtil.isNotEmpty(wbsTreeContractVO.getParentId()) && 0L == wbsTreeContractVO.getParentId()) {
-                                    wbsTreeContractVO.setTitle(contractInfoJlYz.getContractName());
+                                    wbsTreeContractVO.setTitle(contractInfoJlYz == null ? wbsTreeContractVO.getTitle() : contractInfoJlYz.getContractName());
                                     break;
                                 }
                             }

+ 10 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -861,7 +861,7 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                     .thenComparing(new ComplexStringComparator<>(obj ->
                             obj.getTitle() != null ? obj.getTitle() : ""))
                     .thenComparing(
-                            WbsTreeContractTreeAllVO::getId,
+                            WbsTreeContractTreeAllVO::getPrimaryKeyId,
                             Comparator.nullsLast(Comparator.reverseOrder()));
             Map<Long, List<WbsTreeContractTreeAllVO>> map = wbsTreeVO2s.stream().collect(Collectors.groupingBy(WbsTreeContractTreeAllVO::getParentId,
                     Collectors.collectingAndThen(Collectors.toList(), items -> items.stream().sorted(safeComparator).collect(Collectors.toList()))));
@@ -1666,6 +1666,7 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                                         vo.setColorStatus(1);
                                         vo.setHasChildren(false);
                                     }
+                                    vo.setNotExsitChild(!vo.getHasChildren());
                                     if(CollectionUtil.isNotEmpty(syncPKeyIds)){
                                         //判断是否展示同步标识
                                         vo.setIsSync(syncPKeyIds.contains(vo.getPrimaryKeyId().toString()) ? 1 : 0);
@@ -1679,6 +1680,14 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                                 return vo;
                             }).collect(Collectors.toList());
 //                    List<WbsTreeContractTreeAllVO> resultList = this.buildWbsTreeByStreamByTreeAll(wbsTreeContractTreeAllVOS);
+                    Comparator<WbsTreeContractTreeAllVO> safeComparator = Comparator
+                            .comparing(WbsTreeContractTreeAllVO::getSort, Comparator.nullsFirst(Comparator.naturalOrder()))
+                            .thenComparing(new ComplexStringComparator<>(obj ->
+                                    obj.getTitle() != null ? obj.getTitle() : ""))
+                            .thenComparing(
+                                    WbsTreeContractTreeAllVO::getPrimaryKeyId,
+                                    Comparator.nullsLast(Comparator.reverseOrder()));
+                    wbsTreeContractTreeAllVOS.sort(safeComparator);
                     if (StringUtil.hasText(queryValue)) {
                         resultMaps.put(Long.parseLong(cId), this.queryTreeResult(wbsTreeContractTreeAllVOS, queryValue));
                     } else {