比对模式的检测报告生成和下载
This commit is contained in:
@@ -62,4 +62,25 @@ public interface IDictTreeService extends IService<DictTree> {
|
||||
DictTree getDictTreeByCode(String code);
|
||||
|
||||
List<DictTree> listByFatherIds(List<String> fatherIdList);
|
||||
|
||||
/**
|
||||
* 获取父级字典树
|
||||
* @param id 字典树ID
|
||||
* @return 父级字典树
|
||||
*/
|
||||
DictTree queryParentById(String id);
|
||||
|
||||
/**
|
||||
* 根据id获取所有子节点的ID
|
||||
* @param scriptId 字典树ID
|
||||
* @return 所有子节点ID
|
||||
*/
|
||||
List<String> getChildIds(String scriptId);
|
||||
|
||||
/**
|
||||
* 测试项排个序
|
||||
* @param scriptList 测试项
|
||||
* @return 有序的测试项
|
||||
*/
|
||||
List<String> sort(List<String> scriptList);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.gather.system.dictionary.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -146,6 +148,38 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictTree queryParentById(String id) {
|
||||
DictTree temp = this.lambdaQuery().eq(DictTree::getId, id).eq(DictTree::getState, DictConst.ENABLE).one();
|
||||
return this.lambdaQuery().eq(DictTree::getId, temp.getPid()).one();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getChildIds(String scriptId) {
|
||||
List<DictTree> subTree = this.lambdaQuery().eq(DictTree::getPid, scriptId)
|
||||
.eq(DictTree::getState, DictConst.ENABLE)
|
||||
.list();
|
||||
if(CollectionUtil.isNotEmpty(subTree)){
|
||||
return subTree.stream().map(DictTree::getId).collect(Collectors.toList());
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> sort(List<String> scriptList) {
|
||||
if (CollectionUtil.isEmpty(scriptList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return this.lambdaQuery()
|
||||
.in(DictTree::getId, scriptList)
|
||||
.orderByAsc(DictTree::getSort)
|
||||
.list()
|
||||
.stream()
|
||||
.map(DictTree::getId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void checkRepeat(DictTreeParam dictTreeParam, boolean isExcludeSelf) {
|
||||
LambdaQueryWrapper<DictTree> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(DictTree::getPid, dictTreeParam.getPid()) // 同一父节点下不能有相同的code
|
||||
|
||||
Reference in New Issue
Block a user