-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bdc4ab3
commit 7668960
Showing
20 changed files
with
479 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
package com.example.myfirstapp | ||
|
||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
|
||
@Entity(tableName = "AlbumTable") | ||
data class Album( | ||
var title : String? = "", | ||
var singer : String? = "", | ||
var coverImage : Int? = null, | ||
var songs: ArrayList<Song>? = null // 앨범 수록곡 | ||
) | ||
@PrimaryKey(autoGenerate = false) var id: Int = 0, | ||
var title: String? = "", | ||
var singer: String? = "", | ||
var coverImg: Int? = null | ||
) |
21 changes: 21 additions & 0 deletions
21
UMC_6th/app/src/main/java/com/example/myfirstapp/AlbumDao.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.example.myfirstapp | ||
|
||
import androidx.room.* | ||
|
||
@Dao | ||
interface AlbumDao { | ||
@Insert | ||
fun insert(album: Album) | ||
|
||
@Update | ||
fun update(album: Album) | ||
|
||
@Delete | ||
fun delete(album: Album) | ||
|
||
@Query("SELECT * FROM AlbumTable") // 테이블의 모든 값을 가져와라 | ||
fun getAlbums(): List<Album> | ||
|
||
@Query("SELECT * FROM AlbumTable WHERE id = :id") | ||
fun getAlbum(id: Int): Album | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.