getGroupTree 修改

This commit is contained in:
2026-08-14 16:17:51 +08:00
parent 2c058cfa35
commit 9ae303a29d
10 changed files with 127 additions and 187 deletions
@@ -10,9 +10,9 @@ import com.yunhai.bschclassmanage.model.constant.LogModule;
import com.yunhai.bschclassmanage.model.dto.SchTeacherDTO;
import com.yunhai.bschclassmanage.model.dto.TeaTransferGroupDTO;
import com.yunhai.bschclassmanage.model.dto.TeaTransferInGroupDTO;
import com.yunhai.bschclassmanage.model.tool.BaseTree;
import com.yunhai.bschclassmanage.model.vo.*;
import com.yunhai.bschclassmanage.service.IComSchTreeService;
import com.yunhai.platform.utils.model.BoaGroup;
import com.yunhai.bschclassmanage.service.ISchTeacherService;
import com.yunhai.bschclassmanage.service.impl.teacher.*;
import com.yunhai.bschclassmanage.utils.ModelMapperUtil;
@@ -244,12 +244,12 @@ public class SchTeacherService implements ISchTeacherService {
return Collections.emptyList();
}
BaseTree teacherGroupTree = comSchTreeService.getTeaTree(schId);
BoaGroup teacherGroupTree = comSchTreeService.getTeaTree(schId);
if (teacherGroupTree == null) {
return Collections.emptyList();
}
List<BaseTree> allNodes = flattenTree(teacherGroupTree);
List<BoaGroup> allNodes = flattenTree(teacherGroupTree);
return allNodes.stream()
.filter(node -> groupIds.contains(node.getId()))
@@ -311,14 +311,14 @@ public class SchTeacherService implements ISchTeacherService {
/**
* 递归扁平化树,返回所有节点列表(包括根节点)
*/
private List<BaseTree> flattenTree(BaseTree root) {
List<BaseTree> result = new ArrayList<>();
private List<BoaGroup> flattenTree(BoaGroup root) {
List<BoaGroup> result = new ArrayList<>();
if (root == null) {
return result;
}
result.add(root);
if (root.getChildren() != null) {
for (BaseTree child : root.getChildren()) {
for (BoaGroup child : root.getChildren()) {
result.addAll(flattenTree(child));
}
}