Dao追加, モデル追加
This commit is contained in:
parent
f78b17dfb5
commit
477152e40e
|
@ -4,10 +4,12 @@ import androidx.room.Dao;
|
||||||
import androidx.room.Insert;
|
import androidx.room.Insert;
|
||||||
import androidx.room.OnConflictStrategy;
|
import androidx.room.OnConflictStrategy;
|
||||||
import androidx.room.Query;
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Transaction;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import one.nem.kidshift.data.room.entity.HistoryCacheEntity;
|
import one.nem.kidshift.data.room.entity.HistoryCacheEntity;
|
||||||
|
import one.nem.kidshift.data.room.model.HistoryWithTask;
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
public interface HistoryCacheDao {
|
public interface HistoryCacheDao {
|
||||||
|
@ -27,6 +29,14 @@ public interface HistoryCacheDao {
|
||||||
@Query("SELECT * FROM history_cache WHERE child_id = :childId")
|
@Query("SELECT * FROM history_cache WHERE child_id = :childId")
|
||||||
List<HistoryCacheEntity> getHistoryListByChildId(String childId);
|
List<HistoryCacheEntity> getHistoryListByChildId(String childId);
|
||||||
|
|
||||||
|
@Transaction
|
||||||
|
@Query("SELECT * FROM history_cache")
|
||||||
|
List<HistoryWithTask> getHistoryWithTasks();
|
||||||
|
|
||||||
|
@Transaction
|
||||||
|
@Query("SELECT * FROM history_cache WHERE child_id = :childId")
|
||||||
|
List<HistoryWithTask> getHistoryWithTasksByChildId(String childId);
|
||||||
|
|
||||||
@Query("SELECT * FROM history_cache WHERE task_id = :taskId")
|
@Query("SELECT * FROM history_cache WHERE task_id = :taskId")
|
||||||
List<HistoryCacheEntity> getHistoryListByTaskId(String taskId);
|
List<HistoryCacheEntity> getHistoryListByTaskId(String taskId);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package one.nem.kidshift.data.room.model;
|
||||||
|
|
||||||
|
import androidx.room.Embedded;
|
||||||
|
import androidx.room.Relation;
|
||||||
|
|
||||||
|
import one.nem.kidshift.data.room.entity.HistoryCacheEntity;
|
||||||
|
import one.nem.kidshift.data.room.entity.TaskCacheEntity;
|
||||||
|
|
||||||
|
public class HistoryWithTask {
|
||||||
|
@Embedded
|
||||||
|
public HistoryCacheEntity history;
|
||||||
|
|
||||||
|
@Relation(
|
||||||
|
parentColumn = "task_id",
|
||||||
|
entityColumn = "id"
|
||||||
|
)
|
||||||
|
public TaskCacheEntity task;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user