mirror of
https://github.com/CappielloAntonio/tempo.git
synced 2026-02-01 15:03:37 +00:00
Implemented playlist
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package com.cappielloantonio.play.database.dao;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Delete;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
import com.cappielloantonio.play.model.PlaylistSongCross;
|
||||
import com.cappielloantonio.play.model.SongArtistCross;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface PlaylistSongCrossDao {
|
||||
@Query("SELECT * FROM playlist_song_cross")
|
||||
LiveData<List<PlaylistSongCross>> getAll();
|
||||
|
||||
@Query("SELECT EXISTS(SELECT * FROM playlist_song_cross WHERE id = :id)")
|
||||
boolean exist(String id);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insert(PlaylistSongCross playlistSongCross);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insertAll(List<PlaylistSongCross> playlistSongCrosses);
|
||||
|
||||
@Delete
|
||||
void delete(PlaylistSongCross playlistSongCross);
|
||||
|
||||
@Update
|
||||
void update(PlaylistSongCross playlistSongCross);
|
||||
|
||||
@Query("DELETE FROM playlist_song_cross")
|
||||
void deleteAll();
|
||||
}
|
||||
@@ -51,6 +51,10 @@ public interface SongDao {
|
||||
@Query("SELECT * FROM song WHERE albumId = :albumID ORDER BY trackNumber ASC")
|
||||
LiveData<List<Song>> getLiveAlbumSong(String albumID);
|
||||
|
||||
// @Query("SELECT * FROM song WHERE albumId = :albumID ORDER BY trackNumber ASC")
|
||||
@Query("SELECT song.* FROM song INNER JOIN playlist_song_cross ON song.id = playlist_song_cross.song_id AND playlist_song_cross.playlist_id = :playlistID")
|
||||
LiveData<List<Song>> getLivePlaylistSong(String playlistID);
|
||||
|
||||
@Query("SELECT * FROM song WHERE albumId = :albumID ORDER BY trackNumber ASC")
|
||||
List<Song> getAlbumSong(String albumID);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user