mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-13 13:07:32 +00:00
(improvement)(headless)Support ordering in chat model and database tables.
This commit is contained in:
@@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -31,7 +32,7 @@ public class ChatModelServiceImpl extends ServiceImpl<ChatModelMapper, ChatModel
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}).collect(Collectors.toList());
|
}).sorted(Comparator.comparingLong(ChatModel::getId)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -34,10 +34,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -82,6 +79,7 @@ public class DatabaseServiceImpl extends ServiceImpl<DatabaseDOMapper, DatabaseD
|
|||||||
public List<DatabaseResp> getDatabaseList(User user) {
|
public List<DatabaseResp> getDatabaseList(User user) {
|
||||||
List<DatabaseResp> databaseResps = list().stream().map(DatabaseConverter::convert)
|
List<DatabaseResp> databaseResps = list().stream().map(DatabaseConverter::convert)
|
||||||
.filter(database -> filterByAuth(database, user, AuthType.VIEWER))
|
.filter(database -> filterByAuth(database, user, AuthType.VIEWER))
|
||||||
|
.sorted(Comparator.comparingLong(DatabaseResp::getId))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
fillPermission(databaseResps, user);
|
fillPermission(databaseResps, user);
|
||||||
return databaseResps;
|
return databaseResps;
|
||||||
|
|||||||
Reference in New Issue
Block a user