优化根据专业查询接口

This commit is contained in:
xbx 2024-04-23 08:42:31 +08:00
parent 8483abbd0b
commit 7b45bb819a
1 changed files with 16 additions and 0 deletions

View File

@ -394,6 +394,14 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
json.put("passRate", df.format(passRate)); json.put("passRate", df.format(passRate));
ansArray.add(json); ansArray.add(json);
} }
//将ans按照entrydate从小到大排序
ansArray.sort((o1, o2) -> {
JSONObject json1 = (JSONObject) o1;
JSONObject json2 = (JSONObject) o2;
String entryDate1 = json1.getString("entryDate");
String entryDate2 = json2.getString("entryDate");
return entryDate1.compareTo(entryDate2);
});
ans.put((String) major, ansArray); ans.put((String) major, ansArray);
} }
} else { } else {
@ -451,6 +459,14 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
json.put("passRate", df.format(passRate)); json.put("passRate", df.format(passRate));
ansArray.add(json); ansArray.add(json);
} }
//将ans按照entrydate从小到大排序
ansArray.sort((o1, o2) -> {
JSONObject json1 = (JSONObject) o1;
JSONObject json2 = (JSONObject) o2;
String entryDate1 = json1.getString("entryDate");
String entryDate2 = json2.getString("entryDate");
return entryDate1.compareTo(entryDate2);
});
ans.put((String) major, ansArray); ans.put((String) major, ansArray);
} }
} }