修正排序

This commit is contained in:
hh 2024-03-27 17:50:50 +08:00
parent 886e7634d3
commit 583bf67785
1 changed files with 6 additions and 28 deletions

View File

@ -47,20 +47,15 @@ public class CenterServiceImpl implements CenterService {
LambdaQueryWrapper<Cet_4> Cet_4CollegeQW = new LambdaQueryWrapper<>();
Cet_4CollegeQW.select(Cet_4::getCollege)
.groupBy(Cet_4::getCollege);
LambdaQueryWrapper<Cet_6> Cet_6CollegeQW = new LambdaQueryWrapper<>();
Cet_6CollegeQW.select(Cet_6::getCollege)
.groupBy(Cet_6::getCollege);
List<Map<String, Object>> Cet_4College = cet4Mapper.selectMaps(Cet_4CollegeQW);
List<Map<String, Object>> Cet_6College = cet6Mapper.selectMaps(Cet_6CollegeQW);
// 收集不重复的学院名称
Set<String> collegeSet = new HashSet<>();
for (Map<String, Object> map : Cet_4College) {
collegeSet.add(String.valueOf(map.get("college")));
}
for (Map<String, Object> map : Cet_6College) {
collegeSet.add(String.valueOf(map.get("college")));
}
JSONArray colleges = new JSONArray();
for (String college : collegeSet) {
JSONObject collegeObj = new JSONObject();
@ -88,20 +83,15 @@ public class CenterServiceImpl implements CenterService {
LambdaQueryWrapper<Cet_4> Cet_4BatchQW = new LambdaQueryWrapper<>();
Cet_4BatchQW.select(Cet_4::getBatch)
.groupBy(Cet_4::getBatch);
LambdaQueryWrapper<Cet_6> Cet_6BatchQW = new LambdaQueryWrapper<>();
Cet_6BatchQW.select(Cet_6::getBatch)
.groupBy(Cet_6::getBatch);
List<Map<String, Object>> Cet_4Batch = cet4Mapper.selectMaps(Cet_4BatchQW);
List<Map<String, Object>> Cet_6Batch = cet6Mapper.selectMaps(Cet_6BatchQW);
// 收集不重复的批次
Set<String> batchSet = new HashSet<>();
Set<String> batchSet = new TreeSet<>(Comparator.naturalOrder());
for (Map<String, Object> map : Cet_4Batch) {
batchSet.add(String.valueOf(map.get("batch")));
}
for (Map<String, Object> map : Cet_6Batch) {
batchSet.add(String.valueOf(map.get("batch")));
}
JSONArray batches = new JSONArray();
for (String batch : batchSet) {
JSONObject batchObj = new JSONObject();
@ -120,10 +110,6 @@ public class CenterServiceImpl implements CenterService {
*/
@Override
public JSONObject getEntrydate() {
// 判断是否存在缓存 getEntrydate
if (Boolean.TRUE.equals(redisTemplate.hasKey("getEntrydate"))) {
return (JSONObject) redisTemplate.opsForValue().get("getEntrydate");
}
// 判断是否存在缓存 getEntrydate
if (Boolean.TRUE.equals(redisTemplate.hasKey("getEntrydate"))) {
return (JSONObject) redisTemplate.opsForValue().get("getEntrydate");
@ -133,20 +119,12 @@ public class CenterServiceImpl implements CenterService {
LambdaQueryWrapper<Cet_4> Cet_4EntrydateQW = new LambdaQueryWrapper<>();
Cet_4EntrydateQW.select(Cet_4::getEntrydate)
.groupBy(Cet_4::getEntrydate);
LambdaQueryWrapper<Cet_6> Cet_6EntrydateQW = new LambdaQueryWrapper<>();
Cet_6EntrydateQW.select(Cet_6::getEntrydate)
.groupBy(Cet_6::getEntrydate);
List<Map<String, Object>> Cet_4Entrydate = cet4Mapper.selectMaps(Cet_4EntrydateQW);
List<Map<String, Object>> Cet_6Entrydate = cet6Mapper.selectMaps(Cet_6EntrydateQW);
// 收集不重复的年级
Set<String> entrydateSet = new HashSet<>();
Set<String> entrydateSet = new TreeSet<>(Comparator.naturalOrder());
for (Map<String, Object> map : Cet_4Entrydate) {
entrydateSet.add(String.valueOf(map.get("entrydate")));
}
for (Map<String, Object> map : Cet_6Entrydate) {
entrydateSet.add(String.valueOf(map.get("entrydate")));
}
JSONArray entrydates = new JSONArray();
for (String entrydate : entrydateSet) {
JSONObject entrydateObj = new JSONObject();