Commit 7406afe1 authored by wangyangyang's avatar wangyangyang

文档:文档和目录查询

parent b91dfd53
package com.yonde.dcs.document.core.controller.expand;
import com.yonde.dcs.document.common.vo.ExtReviseVersionVO;
import com.yonde.dcs.document.core.controller.expand.shadow.ExtDxDocumentControllerShadow;
import com.yonde.dcs.document.core.service.expand.ExtDxDocumentService;
import com.yonde.dex.basedata.entity.api.ApiResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import io.swagger.annotations.Api;
......@@ -10,11 +14,11 @@ import com.yonde.dex.basedata.auth.annos.BasePermission;
import com.yonde.dcs.document.core.controller.DocController;
/**
* @description: DxDocument-Controller
* @author: dexadmin
* @version: V
* @date: 2024-8-2 15:26:32
**/
* @description: DxDocument-Controller
* @author: dexadmin
* @version: V
* @date: 2024-8-2 15:26:32
**/
@Api(tags = "DxDocument管理服务")
@RequestMapping("/DxDocument")
@ResponseBody()
......@@ -22,6 +26,14 @@ import com.yonde.dcs.document.core.controller.DocController;
@BasePermission("dcs-doc:DxDocument")
public class ExtDxDocumentController<V extends DxDocumentVO, S extends ExtDxDocumentService<V>> extends ExtDxDocumentControllerShadow<V, S> {
@Autowired
private ExtDxDocumentService<V> service;
@ApiOperation("文档和目录查询")
@GetMapping({"/docAndFloder"})
public ApiResult docAndFloder(@RequestParam Long dxContextId, @RequestParam Long parentId) {
return ApiResult.ok(service.getDocAndFolder(dxContextId, parentId), "查询成功");
}
}
......
......@@ -2,13 +2,28 @@ package com.yonde.dcs.document.core.service.expand;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.document.core.service.expand.shadow.ExtDxDocumentServiceShadow;
import com.yonde.dex.basedata.entity.data.DxPageImpl;
import com.yonde.dex.basedata.entity.vo.IdOnlyVO;
import java.util.List;
import java.util.Map;
/**
* @description: DxDocument-service
* @author: dexadmin
* @version: V
* @date: 2024-8-2 15:26:32
**/
* @description: DxDocument-service
* @author: dexadmin
* @version: V
* @date: 2024-8-2 15:26:32
**/
public interface ExtDxDocumentService<V extends DxDocumentVO> extends ExtDxDocumentServiceShadow<V> {
/**
* 获取文档和文件夹
*
* @param dxContextId 项目id
* @param parentId 目录夹id
* @return
*/
Map<String, DxPageImpl> getDocAndFolder(Long dxContextId, Long parentId);
}
package com.yonde.dcs.document.core.service.impl.expand;
import com.yonde.dcs.document.core.service.ExtDxDocumentFolderService;
import com.yonde.dcs.document.core.service.expand.ExtDxDocumentService;
import com.yonde.dcs.document.core.event.DocumentEvent;
import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchItems;
import com.yonde.dex.basedata.data.search.SearchQueryBuilder;
import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.basedata.entity.data.DxPageImpl;
import com.yonde.dex.basedata.entity.data.VersionRelationType;
import com.yonde.dex.configspec.SpecSearch;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.*;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -14,11 +22,11 @@ import com.yonde.dcs.document.entity.po.DxDocument;
import com.yonde.dcs.document.core.service.impl.DocumentServiceImpl;
/**
* @description: DxDocument-ServiceImpl
* @author: dexadmin
* @version: V
* @date: 2024-8-2 15:26:32
**/
* @description: DxDocument-ServiceImpl
* @author: dexadmin
* @version: V
* @date: 2024-8-2 15:26:32
**/
@Slf4j
@Service(DocumentServiceImpl.BEAN_NAME)
public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentServiceImpl<V> implements ExtDxDocumentService<V> {
......@@ -26,6 +34,9 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
public static final String BEAN_NAME = "documentServiceImpl";
@Autowired
private ExtDxDocumentFolderService dxDocumentFolderService;
@Autowired
DocumentRepository<DxDocument> documentRepository;
@Autowired
......@@ -37,12 +48,49 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
//documentEvent.createDocListener(v);
}
}
@Override
public void beforeUpdate(Collection<V> target, Collection<V> origin) {
for (V v : target) {
//documentEvent.updateDocListener(v);
}
}
@Override
public Map<String, DxPageImpl> getDocAndFolder(Long dxContextId, Long parentId) {
Map<String, DxPageImpl> result = new HashMap<>();
//查询目录
SearchQueryCondition folderCondition = SearchQueryBuilder.openBuild()
.openFilterBuilder()
.setItem("dxContextId", SearchItem.Operator.EQ, dxContextId)
.setItem("parentId", SearchItem.Operator.EQ, parentId)
.builder().build();
DxPageImpl folderPage = dxDocumentFolderService.findRecursion(folderCondition);
result.put("DxDocumentFolder", folderPage);
//查询文档
SearchQueryCondition documentCondition = SearchQueryBuilder.openBuild()
.openFilterBuilder()
.setItem("dxContextId", SearchItem.Operator.EQ, dxContextId)
.setItem("dxDocumentFolderId", SearchItem.Operator.ISNULL, null)
.setItem("latest", SearchItem.Operator.EQ, true)
.setItem("checkOuted", SearchItem.Operator.EQ, false)
.builder().build();
// SearchQueryCondition documentCondition = SearchQueryCondition.builder()
// .searchItems(SearchItems.builder()
// .item(new SearchItem("dxContextId", SearchItem.Operator.EQ, dxContextId, null))
// .item(new SearchItem("dxDocumentFolderId", SearchItem.Operator.ISNULL, null, null))
// .item(new SearchItem("latest", SearchItem.Operator.EQ, true, null))
// .item(new SearchItem("checkOuted", SearchItem.Operator.EQ, false, null))
// .operator(SearchItems.BooleanOperator.AND).build()).build();
SpecSearch specSearch = SpecSearch.builder()
.searchQueryCondition(documentCondition)
.build();
DxPageImpl<V> docPage = this.findByConfigSpec(specSearch);
result.put("DxDocument", docPage);
return result;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment