删除排序
This commit is contained in:
+1
-3
@@ -300,9 +300,7 @@ public class SchClassImportService {
|
||||
Integer stuParentId = stuGroup.getId();
|
||||
|
||||
Map<Integer, List<SelectIntVO>> schGradeGroupMap = comSchTreeService.getSchGroupTypeList(schId, NodeType.GRADE.getId());
|
||||
if (schGradeGroupMap.isEmpty()) {
|
||||
throw new DException("该学制下没有学级,请先同步年级组数据!");
|
||||
}
|
||||
|
||||
// 构建「年级组ID -> (班级组名 -> 班级组ID)」映射,使同名班级按年级区分,避免跨年级误复用平台组
|
||||
Map<Integer, Map<String, Integer>> gradeClassGroupMap = buildGradeClassGroupMap(schId);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -236,7 +237,11 @@ public class SendUserBaseService implements ISendUserBaseService {
|
||||
if (groupIds == null) {
|
||||
return;
|
||||
}
|
||||
for (Integer groupId : groupIds) {
|
||||
// 从大到小排序后删除:子节点(班级组)的 groupId 通常大于父节点(年级组/学段组),
|
||||
// 先删子节点再删父节点,避免平台树因父节点先删而报"存在子节点"等约束异常
|
||||
List<Integer> sortedIds = new ArrayList<>(groupIds);
|
||||
sortedIds.sort(Comparator.reverseOrder());
|
||||
for (Integer groupId : sortedIds) {
|
||||
try {
|
||||
deleteGroup(groupId, schId);
|
||||
} catch (Exception ignore) {
|
||||
|
||||
Reference in New Issue
Block a user