服务端接口优化

todo:待添加影评海报,书评书摘的接口与标签接口
This commit is contained in:
DelLevin-Home
2026-05-28 02:31:51 +08:00
parent 5022a13b74
commit 21f9c55018
29 changed files with 898 additions and 973 deletions

View File

@@ -19,6 +19,20 @@ class BookDao {
return List.generate(maps.length, (i) => Book.fromJson(maps[i]));
}
// 分页查询书籍记录
Future<List<Book>> getBooksPaged({String? status, int limit = 20, int offset = 0}) async {
final db = await _dbHelper.database;
String where = 'is_deleted = 0';
List<dynamic> whereArgs = [];
if (status != null && status.isNotEmpty) {
where += ' AND status = ?';
whereArgs.add(status);
}
final maps = await db.query('books', where: where, whereArgs: whereArgs,
orderBy: 'created_at DESC', limit: limit, offset: offset);
return List.generate(maps.length, (i) => Book.fromJson(maps[i]));
}
// 根据状态筛选书籍记录
Future<List<Book>> getBooksByStatus(String status) async {
final db = await _dbHelper.database;