'1111'
This commit is contained in:
parent
22fb459e53
commit
71910079e6
|
@ -138,7 +138,18 @@ public class SysNoticeController extends BaseController
|
|||
|
||||
Map<String, List<SysNoticeUser>> groupedByNoticeType = list.stream()
|
||||
.collect(Collectors.groupingBy(SysNoticeUser::getSendTimeFormat));
|
||||
for(String key:groupedByNoticeType.keySet()){
|
||||
|
||||
// 使用TreeMap并提供一个Comparator用于排序key
|
||||
Map<String, List<SysNoticeUser>> sortedMap = new TreeMap<>(new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String k1, String k2) {
|
||||
// 降序排序
|
||||
return k2.compareTo(k1);
|
||||
}
|
||||
});
|
||||
sortedMap.putAll(groupedByNoticeType);
|
||||
|
||||
for(String key:sortedMap.keySet()){
|
||||
List<SysNoticeUser> lt = groupedByNoticeType.get(key);
|
||||
lt.sort((t1, t2) -> t2.getSendTime().compareTo(t1.getSendTime()));
|
||||
map = new HashMap<>();
|
||||
|
|
Loading…
Reference in New Issue