Dao作成

This commit is contained in:
ろむねこ 2024-07-08 10:50:27 +09:00
parent 3288b27cf0
commit c5a39836cc
Signed by: Fujimatsu
GPG Key ID: FA1F39A1BA37D168

View File

@ -0,0 +1,38 @@
package one.nem.kidshift.data.room.dao;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import java.util.List;
import one.nem.kidshift.data.room.entity.HistoryCacheEntity;
@Dao
public interface HistoryCacheDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insertHistory(HistoryCacheEntity history);
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insertHistoryList(List<HistoryCacheEntity> historyList);
@Query("SELECT * FROM history_cache WHERE id = :historyId")
HistoryCacheEntity getHistory(String historyId);
@Query("SELECT * FROM history_cache")
List<HistoryCacheEntity> getHistoryList();
@Query("SELECT * FROM history_cache WHERE child_id = :childId")
List<HistoryCacheEntity> getHistoryListByChildId(String childId);
@Query("SELECT * FROM history_cache WHERE task_id = :taskId")
List<HistoryCacheEntity> getHistoryListByTaskId(String taskId);
@Query("DELETE FROM history_cache WHERE id = :historyId")
void deleteHistory(String historyId);
@Query("DELETE FROM history_cache WHERE child_id = :childId")
void deleteHistoryByChildId(String childId);
}