From 4ffcd970b42876ecc5c048830b08bcd50971759b Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 17:09:52 +0900 Subject: [PATCH] =?UTF-8?q?Toxi=E3=83=86=E3=83=BC=E3=83=96=E3=83=ABDao?= =?UTF-8?q?=E5=AE=9F=E8=A3=85WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/database/dao/ToxiDocumentDao.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentDao.java b/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentDao.java index ace23c69..201a5d37 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentDao.java +++ b/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentDao.java @@ -1,7 +1,35 @@ package one.nem.lacerta.source.database.dao; import androidx.room.Dao; +import androidx.room.Insert; +import androidx.room.Query; +import androidx.room.Update; + +import java.util.List; + +import one.nem.lacerta.source.database.entity.ToxiDocumentEntity; @Dao public interface ToxiDocumentDao { + + @Query("SELECT * FROM toxi_document WHERE parent_document_id = :parentId AND is_active = 1 ORDER BY `order` ASC") + List findByParentId(String parentId); + + @Insert + void insert(ToxiDocumentEntity toxiDocument); + + @Insert + void insertAll(ToxiDocumentEntity... toxiDocuments); + + @Update + void update(ToxiDocumentEntity toxiDocument); + + @Update + void updateAll(ToxiDocumentEntity... toxiDocuments); + + @Query("DELETE FROM toxi_document WHERE parent_document_id = :parentId") + void deleteByParentId(String parentId); + + @Query("DELETE FROM toxi_document WHERE parent_document_id = :parentId AND child_document_id = :childId") + void deleteByParentIdAndChildId(String parentId, String childId); }