PlayerAndroid/app/src/main/java/code/name/monkey/retromusic/db/PlayCountDao.kt

27 lines
825 B
Kotlin
Raw Normal View History

2020-08-31 12:30:07 +00:00
package code.name.monkey.retromusic.db
import androidx.room.*
@Dao
interface PlayCountDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertSongInPlayCount(playCountEntity: PlayCountEntity)
@Update
fun updateSongInPlayCount(playCountEntity: PlayCountEntity)
@Delete
fun deleteSongInPlayCount(playCountEntity: PlayCountEntity)
@Query("SELECT * FROM PlayCountEntity WHERE id =:songId")
fun checkSongExistInPlayCount(songId: Long): List<PlayCountEntity>
2020-08-31 12:30:07 +00:00
@Query("SELECT * FROM PlayCountEntity ORDER BY play_count DESC")
fun playCountSongs(): List<PlayCountEntity>
2020-09-09 12:37:25 +00:00
@Query("DELETE FROM SongEntity WHERE id =:songId")
fun deleteSong(songId: Long)
2020-09-12 06:53:23 +00:00
@Query("UPDATE PlayCountEntity SET play_count = play_count + 1 WHERE id = :id")
fun updateQuantity(id: Long)
2020-08-31 12:30:07 +00:00
}