decksCursor.use { it -> if (it.moveToFirst()) { do { val deckId = it.getLong(it.getColumnIndex(FlashCardsContract.Deck.DECK_ID)) val deckName = it.getString(it.getColumnIndex(FlashCardsContract.Deck.DECK_NAME)) val deckCounts = it.getString(it.getColumnIndex(FlashCardsContract.Deck.DECK_COUNTS))
cursor.use { it -> if(it.moveToFirst()) { do { val noteId = it.getLong(it.getColumnIndex(FlashCardsContract.ReviewInfo.NOTE_ID)) val cardOrd = it.getInt(it.getColumnIndex(FlashCardsContract.ReviewInfo.CARD_ORD)) val buttonCount = it.getInt(it.getColumnIndex(FlashCardsContract.ReviewInfo.BUTTON_COUNT))
val nextReviewTimes = it.getString(it.getColumnIndex(FlashCardsContract.ReviewInfo.NEXT_REVIEW_TIMES))
// val mediaFiles = it.getString(it.getColumnIndex(FlashCardsContract.ReviewInfo.MEDIA_FILES))
val card = retrieveCard(noteId, cardOrd) card.setReviewData(buttonCount, nextReviewTimes) ankiCards.add(card) } while (it.moveToNext()) } } return ankiCards }
@Entity(tableName = "print_table") dataclassPrintEntity( @PrimaryKey(autoGenerate = true) val id: Int, val name: String, val time: Date?, val deckEntitys: List<DeckEntity>, var hasCheckAndSyncAnki: Boolean = false,
var strengthenMemoryCounts: Int = 0, var hasStrengthenMemory: Boolean = false )
dataclassDeckEntity( val deckId: Long, val name: String, val total: Int, var cards: List<CardEntity> )
dataclassCardEntity( val noteId: Long, val cardOrd: Int, val buttonCount: Int, val nextReviewTimes: List<String>,
var answerEasy: Int = -1, var hasStrengthenMemory: Boolean = false )
@Dao interfacePrintDao { @Query("SELECT * FROM print_table ORDER BY time DESC") fungetPrints(): List<PrintEntity>
@Query("SELECT * FROM print_table WHERE time BETWEEN :start AND :end ORDER BY time DESC") fungetPrintsByDate(start: Long, end: Long): List<PrintEntity>
@Query("SELECT * FROM print_table WHERE id=:printId") fungetPrintById(printId: Int): PrintEntity