|
@@ -10,6 +10,7 @@ import com.doc.biz.service.IDocInfoService;
|
|
import com.doc.biz.service.IDocSpaceService;
|
|
import com.doc.biz.service.IDocSpaceService;
|
|
import com.doc.biz.vo.TreeVO;
|
|
import com.doc.biz.vo.TreeVO;
|
|
import com.doc.common.annotation.Log;
|
|
import com.doc.common.annotation.Log;
|
|
|
|
+import com.doc.common.constant.Constants;
|
|
import com.doc.common.core.controller.BaseController;
|
|
import com.doc.common.core.controller.BaseController;
|
|
import com.doc.common.core.domain.AjaxResult;
|
|
import com.doc.common.core.domain.AjaxResult;
|
|
import com.doc.common.enums.BusinessType;
|
|
import com.doc.common.enums.BusinessType;
|
|
@@ -67,33 +68,56 @@ public class DocDirController extends BaseController {
|
|
@ApiOperation("目录树")
|
|
@ApiOperation("目录树")
|
|
@GetMapping(value = "/dir-tree/{type}")
|
|
@GetMapping(value = "/dir-tree/{type}")
|
|
public TreeVO dirTree(@ApiParam(value = "目录类型(1.公共 2.部门 3.个人)", required = true) @PathVariable("type") String type) {
|
|
public TreeVO dirTree(@ApiParam(value = "目录类型(1.公共 2.部门 3.个人)", required = true) @PathVariable("type") String type) {
|
|
- return tree(type, false);
|
|
|
|
|
|
+ return tree(type, dirTree);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 文件树
|
|
|
|
+ */
|
|
|
|
+ private final String fileTree = "1";
|
|
|
|
+ /**
|
|
|
|
+ * 目录树
|
|
|
|
+ */
|
|
|
|
+ private final String dirTree = "2";
|
|
|
|
+ /**
|
|
|
|
+ * 图片树
|
|
|
|
+ */
|
|
|
|
+ private final String picTree = "3";
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 获取文件树
|
|
* 获取文件树
|
|
*/
|
|
*/
|
|
@ApiOperation("文件树")
|
|
@ApiOperation("文件树")
|
|
@GetMapping(value = "/file-tree/{type}")
|
|
@GetMapping(value = "/file-tree/{type}")
|
|
public TreeVO fileTree(@ApiParam(value = "目录类型(1.公共 2.部门 3.个人)", required = true) @PathVariable("type") String type) {
|
|
public TreeVO fileTree(@ApiParam(value = "目录类型(1.公共 2.部门 3.个人)", required = true) @PathVariable("type") String type) {
|
|
- return tree(type, true);
|
|
|
|
|
|
+ return tree(type, fileTree);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取文件树
|
|
|
|
+ */
|
|
|
|
+ @ApiOperation("图片文件树")
|
|
|
|
+ @GetMapping(value = "/pic-tree")
|
|
|
|
+ public TreeVO picTree() {
|
|
|
|
+ String type = "3";
|
|
|
|
+ return tree(type, picTree);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取树
|
|
* 获取树
|
|
*
|
|
*
|
|
- * @param type 空间类型
|
|
|
|
- * @param fileTree 是否文件树 true 文件树,false 目录树
|
|
|
|
|
|
+ * @param type 空间类型
|
|
|
|
+ * @param st 1.文件树 2.目录树 3.图片树
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private TreeVO tree(String type, boolean fileTree) {
|
|
|
|
|
|
+ private TreeVO tree(String type, String st) {
|
|
DocSpace space = spaceService.selectDocSpaceListByType(type);
|
|
DocSpace space = spaceService.selectDocSpaceListByType(type);
|
|
DocDir docDir = new DocDir();
|
|
DocDir docDir = new DocDir();
|
|
docDir.setSpaceId(space.getSpaceId());
|
|
docDir.setSpaceId(space.getSpaceId());
|
|
docDir.setParentId(0L);
|
|
docDir.setParentId(0L);
|
|
List<DocDir> list = docDirService.selectDocDirList(docDir);
|
|
List<DocDir> list = docDirService.selectDocDirList(docDir);
|
|
|
|
|
|
- TreeVO vo = getChildren(list.get(0), fileTree);
|
|
|
|
|
|
+ TreeVO vo = getChildren(list.get(0), st);
|
|
return vo;
|
|
return vo;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -103,30 +127,32 @@ public class DocDirController extends BaseController {
|
|
* @param dir 目录信息
|
|
* @param dir 目录信息
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private TreeVO getChildren(DocDir dir, boolean fileTree) {
|
|
|
|
|
|
+ private TreeVO getChildren(DocDir dir, String st) {
|
|
TreeVO vo = new TreeVO();
|
|
TreeVO vo = new TreeVO();
|
|
vo.setId(dir.getDirId());
|
|
vo.setId(dir.getDirId());
|
|
vo.setLabel(dir.getDirName());
|
|
vo.setLabel(dir.getDirName());
|
|
-
|
|
|
|
List<TreeVO> children = new ArrayList<>();
|
|
List<TreeVO> children = new ArrayList<>();
|
|
-
|
|
|
|
- if (fileTree) {
|
|
|
|
|
|
+ if (!dirTree.equals(st)) {
|
|
|
|
+ //如果不是目录树
|
|
vo.setDisabled(true);
|
|
vo.setDisabled(true);
|
|
DocInfo info = new DocInfo();
|
|
DocInfo info = new DocInfo();
|
|
info.setDirId(dir.getDirId());
|
|
info.setDirId(dir.getDirId());
|
|
docInfoService.selectDocInfoList(info).forEach(d -> {
|
|
docInfoService.selectDocInfoList(info).forEach(d -> {
|
|
- TreeVO childVO = new TreeVO();
|
|
|
|
- childVO.setId(d.getDocId());
|
|
|
|
- childVO.setLabel(d.getFileName());
|
|
|
|
- childVO.setDisabled(false);
|
|
|
|
- children.add(childVO);
|
|
|
|
|
|
+ if (!picTree.equals(st) || Constants.IMAGE_EXTENSION.indexOf(d.getFileType()) != -1) {
|
|
|
|
+ TreeVO childVO = new TreeVO();
|
|
|
|
+ childVO.setId(d.getDocId());
|
|
|
|
+ childVO.setLabel(d.getFileName());
|
|
|
|
+ childVO.setRemark(d.getFileId());
|
|
|
|
+ childVO.setDisabled(false);
|
|
|
|
+ children.add(childVO);
|
|
|
|
+ }
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
DocDir dir1 = new DocDir();
|
|
DocDir dir1 = new DocDir();
|
|
dir1.setParentId(dir.getDirId());
|
|
dir1.setParentId(dir.getDirId());
|
|
docDirService.selectDocDirList(dir1).forEach(d -> {
|
|
docDirService.selectDocDirList(dir1).forEach(d -> {
|
|
- children.add(getChildren(d, fileTree));
|
|
|
|
|
|
+ children.add(getChildren(d, st));
|
|
});
|
|
});
|
|
|
|
|
|
vo.setChildren(children);
|
|
vo.setChildren(children);
|