学科排序
build / build-push (push) Successful in 1m3s

This commit is contained in:
wanghu
2026-09-20 19:28:23 +08:00
parent 43484a8936
commit 3e18856c0c
@@ -348,6 +348,16 @@ public class SchDicSubjectService implements ISchDicSubjectService {
List<SchDicSubject> list = getSchDicSubjectCacheList(schId, schsystemId).stream()
.filter(s -> Boolean.TRUE.equals(s.getEnable()))
.collect(Collectors.toList());
return ModelMapperUtil.toMap(list, SchDicSubject::getCode, SchDicSubject::getName);
// 按序号升序排序(null 排最后),与学科管理列表口径一致
list.sort(Comparator.comparing(SchDicSubject::getSort,
Comparator.nullsLast(Comparator.naturalOrder())));
// LinkedHashMap 保持排序后的遍历顺序;重复 code 保留第一个
Map<String, String> map = new LinkedHashMap<>();
for (SchDicSubject subject : list) {
if (subject.getCode() != null) {
map.putIfAbsent(subject.getCode(), subject.getName());
}
}
return map;
}
}