fix 修复 流程类别回显问题
This commit is contained in:
parent
001297ca7a
commit
27b4992f6e
@ -125,7 +125,7 @@ public class FlwCategoryController extends BaseController {
|
|||||||
* @param categoryBo 流程分类
|
* @param categoryBo 流程分类
|
||||||
*/
|
*/
|
||||||
@GetMapping("/categoryTree")
|
@GetMapping("/categoryTree")
|
||||||
public R<List<Tree<Long>>> categoryTree(FlowCategoryBo categoryBo) {
|
public R<List<Tree<String>>> categoryTree(FlowCategoryBo categoryBo) {
|
||||||
return R.ok(flwCategoryService.selectCategoryTreeList(categoryBo));
|
return R.ok(flwCategoryService.selectCategoryTreeList(categoryBo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,6 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
|||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
|
||||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
|
||||||
import org.dromara.workflow.domain.FlowCategory;
|
import org.dromara.workflow.domain.FlowCategory;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
@ -43,7 +43,7 @@ public interface IFlwCategoryService {
|
|||||||
* @param category 流程分类信息
|
* @param category 流程分类信息
|
||||||
* @return 流程分类树信息集合
|
* @return 流程分类树信息集合
|
||||||
*/
|
*/
|
||||||
List<Tree<Long>> selectCategoryTreeList(FlowCategoryBo category);
|
List<Tree<String>> selectCategoryTreeList(FlowCategoryBo category);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验流程分类是否有数据权限
|
* 校验流程分类是否有数据权限
|
||||||
|
@ -94,24 +94,24 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService {
|
|||||||
* @return 流程分类树信息集合
|
* @return 流程分类树信息集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Tree<Long>> selectCategoryTreeList(FlowCategoryBo category) {
|
public List<Tree<String>> selectCategoryTreeList(FlowCategoryBo category) {
|
||||||
LambdaQueryWrapper<FlowCategory> lqw = buildQueryWrapper(category);
|
LambdaQueryWrapper<FlowCategory> lqw = buildQueryWrapper(category);
|
||||||
List<FlowCategoryVo> categorys = baseMapper.selectVoList(lqw);
|
List<FlowCategoryVo> categorys = baseMapper.selectVoList(lqw);
|
||||||
if (CollUtil.isEmpty(categorys)) {
|
if (CollUtil.isEmpty(categorys)) {
|
||||||
return CollUtil.newArrayList();
|
return CollUtil.newArrayList();
|
||||||
}
|
}
|
||||||
// 获取当前列表中每一个节点的parentId,然后在列表中查找是否有id与其parentId对应,若无对应,则表明此时节点列表中,该节点在当前列表中属于顶级节点
|
// 获取当前列表中每一个节点的parentId,然后在列表中查找是否有id与其parentId对应,若无对应,则表明此时节点列表中,该节点在当前列表中属于顶级节点
|
||||||
List<Tree<Long>> treeList = CollUtil.newArrayList();
|
List<Tree<String>> treeList = CollUtil.newArrayList();
|
||||||
for (FlowCategoryVo d : categorys) {
|
for (FlowCategoryVo d : categorys) {
|
||||||
Long parentId = d.getParentId();
|
String parentId = d.getParentId().toString();
|
||||||
FlowCategoryVo categoryVo = StreamUtils.findFirst(categorys, it -> it.getCategoryId().longValue() == parentId);
|
FlowCategoryVo categoryVo = StreamUtils.findFirst(categorys, it -> it.getCategoryId().toString().equals(parentId));
|
||||||
if (ObjectUtil.isNull(categoryVo)) {
|
if (ObjectUtil.isNull(categoryVo)) {
|
||||||
List<Tree<Long>> trees = TreeBuildUtils.build(categorys, parentId, (dept, tree) ->
|
List<Tree<String>> trees = TreeBuildUtils.build(categorys, parentId, (dept, tree) ->
|
||||||
tree.setId(dept.getCategoryId())
|
tree.setId(dept.getCategoryId().toString())
|
||||||
.setParentId(dept.getParentId())
|
.setParentId(dept.getParentId().toString())
|
||||||
.setName(dept.getCategoryName())
|
.setName(dept.getCategoryName())
|
||||||
.setWeight(dept.getOrderNum()));
|
.setWeight(dept.getOrderNum()));
|
||||||
Tree<Long> tree = StreamUtils.findFirst(trees, it -> it.getId().longValue() == d.getCategoryId());
|
Tree<String> tree = StreamUtils.findFirst(trees, it -> it.getId().equals(d.getCategoryId().toString()));
|
||||||
treeList.add(tree);
|
treeList.add(tree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user