知识库
This commit is contained in:
parent
901776ce41
commit
29b2b5d996
@ -8,7 +8,7 @@ import com.xinelu.common.enums.BusinessType;
|
||||
import com.xinelu.common.utils.poi.ExcelUtil;
|
||||
import com.xinelu.manage.domain.termbank.TermBank;
|
||||
import com.xinelu.manage.service.termbank.ITermBankService;
|
||||
import com.xinelu.manage.vo.termbank.TermBankVO;
|
||||
import com.xinelu.manage.vo.termbank.TermBankTreeVO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -103,7 +103,7 @@ public class TermBankController extends BaseController {
|
||||
* 常用术语层级树图
|
||||
*/
|
||||
@GetMapping("/bankLevel")
|
||||
public List<TermBankVO> bankLevel(Long level) {
|
||||
public List<TermBankTreeVO> bankLevel(Long level) {
|
||||
return termBankService.bankLevel(level);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ package com.xinelu.manage.service.termbank;
|
||||
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.manage.domain.termbank.TermBank;
|
||||
import com.xinelu.manage.vo.termbank.TermBankVO;
|
||||
import com.xinelu.manage.vo.termbank.TermBankTreeVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -66,5 +66,5 @@ public interface ITermBankService {
|
||||
/**
|
||||
* 常用术语层级树图
|
||||
*/
|
||||
List<TermBankVO> bankLevel(Long level);
|
||||
List<TermBankTreeVO> bankLevel(Long level);
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
|
||||
import com.xinelu.manage.domain.termbank.TermBank;
|
||||
import com.xinelu.manage.mapper.termbank.TermBankMapper;
|
||||
import com.xinelu.manage.service.termbank.ITermBankService;
|
||||
import com.xinelu.manage.vo.termbank.TermBankTreeVO;
|
||||
import com.xinelu.manage.vo.termbank.TermBankVO;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -130,12 +131,13 @@ public class TermBankServiceImpl implements ITermBankService {
|
||||
* 常用术语层级树图
|
||||
*/
|
||||
@Override
|
||||
public List<TermBankVO> bankLevel(Long level) {
|
||||
public List<TermBankTreeVO> bankLevel(Long level) {
|
||||
List<TermBankVO> termBanks = termBankMapper.selectTermBankTree(level);
|
||||
if (CollectionUtils.isEmpty(termBanks)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return buildDeptTree(termBanks);
|
||||
List<TermBankVO> termBankVOS = buildDeptTree(termBanks);
|
||||
return termBankVOS.stream().map(TermBankTreeVO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<TermBankVO> buildDeptTree(List<TermBankVO> termBanks) {
|
||||
|
||||
@ -0,0 +1,129 @@
|
||||
package com.xinelu.manage.vo.termbank;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 知识库树图信息对象vo
|
||||
*
|
||||
* @author xinelu
|
||||
* @date 2024-02-26
|
||||
*/
|
||||
@Data
|
||||
public class TermBankTreeVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 节点层级
|
||||
*/
|
||||
private String value;
|
||||
|
||||
|
||||
private String termCode;
|
||||
|
||||
private String termContent;
|
||||
|
||||
private String parentTermCode;
|
||||
|
||||
private Long termLevel;
|
||||
|
||||
private Long termSort;
|
||||
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<TermBankTreeVO> children;
|
||||
|
||||
public TermBankTreeVO() {
|
||||
|
||||
}
|
||||
|
||||
public TermBankTreeVO(TermBankVO termBank) {
|
||||
this.id = termBank.getId();
|
||||
this.termCode = termBank.getTermCode();
|
||||
this.termContent = termBank.getTermContent();
|
||||
this.parentTermCode = termBank.getParentTermCode();
|
||||
this.termLevel = termBank.getTermLevel();
|
||||
this.termSort = termBank.getTermSort();
|
||||
this.children = termBank.getChildren().stream().map(TermBankTreeVO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTermCode() {
|
||||
return termCode;
|
||||
}
|
||||
|
||||
public void setTermCode(String termCode) {
|
||||
this.termCode = termCode;
|
||||
}
|
||||
|
||||
public String getTermContent() {
|
||||
return termContent;
|
||||
}
|
||||
|
||||
public void setTermContent(String termContent) {
|
||||
this.termContent = termContent;
|
||||
}
|
||||
|
||||
public String getParentTermCode() {
|
||||
return parentTermCode;
|
||||
}
|
||||
|
||||
public void setParentTermCode(String parentTermCode) {
|
||||
this.label = parentTermCode;
|
||||
}
|
||||
|
||||
public Long getTermLevel() {
|
||||
return termLevel;
|
||||
}
|
||||
|
||||
public void setTermLevel(String termLevel) {
|
||||
this.label = termLevel;
|
||||
}
|
||||
|
||||
public Long getTermSort() {
|
||||
return termSort;
|
||||
}
|
||||
|
||||
public void setTermSort(String termSort) {
|
||||
this.label = termSort;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public List<TermBankTreeVO> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<TermBankTreeVO> children) {
|
||||
this.children = children;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user