feat: 优化代码

pull/133/head
kunfei 5 years ago
parent 4f200ec3bb
commit fe8420f4a2
  1. 7
      app/src/main/java/io/legado/app/data/dao/BookDao.kt
  2. 5
      app/src/main/java/io/legado/app/data/entities/BookProgress.kt

@ -69,12 +69,12 @@ interface BookDao {
@Query("update books set `group` = :newGroupId where `group` = :oldGroupId") @Query("update books set `group` = :newGroupId where `group` = :oldGroupId")
fun upGroup(oldGroupId: Int, newGroupId: Int) fun upGroup(oldGroupId: Int, newGroupId: Int)
@get:Query("select bookUrl, durChapterIndex, durChapterPos, durChapterTime from books") @get:Query("select bookUrl, durChapterIndex, durChapterPos, durChapterTime, durChapterTitle from books")
val allBookProgress: List<BookProgress> val allBookProgress: List<BookProgress>
@Query( @Query(
""" """
update books set durChapterIndex = :durChapterIndex, durChapterPos = :durChapterPos update books set durChapterIndex = :durChapterIndex, durChapterPos = :durChapterPos, durChapterTitle = :durChapterTitle
where bookUrl = :bookUrl and durChapterTime < :durChapterTime where bookUrl = :bookUrl and durChapterTime < :durChapterTime
""" """
) )
@ -82,6 +82,7 @@ interface BookDao {
bookUrl: String, bookUrl: String,
durChapterIndex: Int, durChapterIndex: Int,
durChapterPos: Int, durChapterPos: Int,
durChapterTime: Int durChapterTime: Int,
durChapterTitle: String?
) )
} }

@ -3,6 +3,7 @@ package io.legado.app.data.entities
data class BookProgress( data class BookProgress(
val bookUrl: String, val bookUrl: String,
val durChapterIndex: Int, val durChapterIndex: Int,
var durChapterPos: Int, val durChapterPos: Int,
var durChapterTime: Int val durChapterTime: Int,
val durChapterTitle: String?
) )
Loading…
Cancel
Save