package org.jeecg.modules.doc.vo;
|
|
import lombok.AllArgsConstructor;
|
import lombok.Data;
|
import lombok.NoArgsConstructor;
|
import org.jeecg.modules.doc.dto.DocTreeDTO;
|
import org.jeecg.modules.doc.entity.DocFilePath;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
@Data
|
@NoArgsConstructor
|
@AllArgsConstructor
|
public class DocTree {
|
private Long id;
|
private String title;
|
private String key;
|
private String path;
|
private String pathId;
|
private boolean isLeaf;
|
|
private boolean permission;
|
|
private List<DocTree> children = new ArrayList<>();
|
private Slots slots = new Slots();
|
private ScopedSlots scopedSlots = new ScopedSlots();
|
private String parentId;
|
public DocTree(DocFilePath p, String key) {
|
QiwenFile qiwenFile = new QiwenFile(p.getFilePath(), p.getFileName(), p.isDirectory());
|
this.path = qiwenFile.getPath();
|
this.title = qiwenFile.getName();
|
this.isLeaf = false;
|
this.setKey(key);
|
if(p.isDirectory()) {
|
this.slots.setIcon("folder");
|
} else {
|
if(p.getExtendName().equals("doc")) {
|
this.slots.setIcon("file-word");
|
} else if(p.getExtendName().equals("xlsx"))
|
this.slots.setIcon("file");
|
}
|
|
this.scopedSlots.setTitle("custom");
|
this.pathId = p.getPathId();
|
this.parentId = p.getParentId();
|
this.permission = p.isPermission();
|
}
|
|
public DocTree(DocTreeDTO dto) {
|
this.path = dto.getPath();
|
this.title = dto.getTitle();
|
this.isLeaf = dto.isLeaf();
|
this.key = dto.getKey();
|
this.pathId = dto.getPathId();
|
this.id = dto.getId();
|
this.parentId = dto.getParentId();
|
}
|
|
public boolean getIsLeaf() {
|
return isLeaf;
|
}
|
|
public void setLeaf(boolean leaf) {
|
isLeaf = leaf;
|
}
|
|
|
@Data
|
public class Slots {
|
private String icon;
|
}
|
|
@Data
|
public class ScopedSlots {
|
private String title;
|
}
|
}
|