windows版本搜索功能优化

This commit is contained in:
DelLevin-Home
2026-07-13 20:28:12 +08:00
parent 6c30026e32
commit b4793a8d01
6 changed files with 224 additions and 63 deletions

View File

@@ -16,13 +16,13 @@ class BookDao {
}
// 获取所有未删除的书籍记录
Future<List<Book>> getAllBooks() => _wrap('getAllBooks', () async {
Future<List<Book>> getAllBooks({int sortMode = 0}) => _wrap('getAllBooks', () async {
final db = await _dbHelper.database;
final List<Map<String, dynamic>> maps = await db.query(
'books',
where: 'is_deleted = ?',
whereArgs: [0],
orderBy: 'created_at DESC',
orderBy: _buildBookOrderBy(sortMode),
);
return List.generate(maps.length, (i) => Book.fromJson(maps[i]));
});
@@ -45,7 +45,7 @@ class BookDao {
switch (sortMode) {
case 1: return 'created_at DESC';
case 2: return 'rating DESC NULLS LAST, updated_at DESC';
default: return 'created_at DESC';
default: return 'updated_at DESC';
}
}

View File

@@ -16,13 +16,13 @@ class GameDao {
}
// 获取所有游戏记录(未删除的)
Future<List<Game>> getAllGames() => _wrap('getAllGames', () async {
Future<List<Game>> getAllGames({int sortMode = 0}) => _wrap('getAllGames', () async {
final db = await _dbHelper.database;
final List<Map<String, dynamic>> maps = await db.query(
'games',
where: 'is_deleted = ?',
whereArgs: [0],
orderBy: 'created_at DESC',
orderBy: _buildGameOrderBy(sortMode),
);
return List.generate(maps.length, (i) => Game.fromJson(maps[i]));
});
@@ -45,7 +45,7 @@ class GameDao {
switch (sortMode) {
case 1: return 'created_at DESC';
case 2: return 'rating DESC NULLS LAST, updated_at DESC';
default: return 'created_at DESC';
default: return 'updated_at DESC';
}
}

View File

@@ -16,13 +16,13 @@ class MovieDao {
}
// 获取所有影视记录(未删除的)
Future<List<Movie>> getAllMovies() => _wrap('getAllMovies', () async {
Future<List<Movie>> getAllMovies({int sortMode = 0}) => _wrap('getAllMovies', () async {
final db = await _dbHelper.database;
final List<Map<String, dynamic>> maps = await db.query(
'movies',
where: 'is_deleted = ?',
whereArgs: [0],
orderBy: 'created_at DESC',
orderBy: _buildMovieOrderBy(sortMode),
);
return List.generate(maps.length, (i) => Movie.fromJson(maps[i]));
});
@@ -49,7 +49,7 @@ class MovieDao {
switch (sortMode) {
case 1: return 'created_at DESC';
case 2: return 'rating DESC NULLS LAST, updated_at DESC';
default: return 'created_at DESC';
default: return 'updated_at DESC';
}
}

View File

@@ -40,7 +40,7 @@ class NoteDao {
switch (sortMode) {
case 1: return 'is_pinned DESC, created_at DESC';
case 2: return 'is_pinned DESC, title COLLATE NOCASE ASC';
default: return 'is_pinned DESC, created_at DESC';
default: return 'is_pinned DESC, updated_at DESC';
}
}