mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-24 11:49:51 +08:00
排序优化
This commit is contained in:
@@ -78,10 +78,18 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
wrapper.in("id", userIds);
|
||||
}
|
||||
|
||||
if (filter.getSortAlgo().equals("desc")) {
|
||||
wrapper.orderByDesc(filter.getSortField());
|
||||
String sortFiled = filter.getSortField();
|
||||
if (sortFiled == null || sortFiled.trim().length() == 0) {
|
||||
sortFiled = "id";
|
||||
}
|
||||
String sortAlgo = filter.getSortAlgo();
|
||||
if (sortAlgo == null || sortAlgo.trim().length() == 0) {
|
||||
sortAlgo = "desc";
|
||||
}
|
||||
if ("desc".equals(sortAlgo)) {
|
||||
wrapper.orderByDesc(sortFiled);
|
||||
} else {
|
||||
wrapper.orderByAsc(filter.getSortField());
|
||||
wrapper.orderByAsc(sortFiled);
|
||||
}
|
||||
|
||||
IPage<User> userPage = new Page<>(page, size);
|
||||
|
||||
Reference in New Issue
Block a user