From 05915a2f4edef0e4f0cf3e6f147a5de45d0f1724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Thu, 25 Jan 2024 15:49:53 +0900 Subject: [PATCH] =?UTF-8?q?Dao=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../database/dao/ToxiDocumentTagDao.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentTagDao.java b/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentTagDao.java index 334bd092..ae1c44b3 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentTagDao.java +++ b/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentTagDao.java @@ -10,4 +10,28 @@ import one.nem.lacerta.source.database.entity.ToxiDocumentTagEntity; @Dao public interface ToxiDocumentTagDao { + + @Query("SELECT * FROM toxi_document_tag WHERE document_id = :documentId") + List findByDocumentId(String documentId); + + @Query("SELECT * FROM toxi_document_tag WHERE tag_id = :tagId") + List findByTagId(String tagId); + + @Insert + void insert(ToxiDocumentTagEntity toxiDocumentTag); + + @Insert + void insertAll(ToxiDocumentTagEntity... toxiDocumentTags); + + @Insert + void insertAll(List toxiDocumentTags); + + @Query("DELETE FROM toxi_document_tag WHERE document_id = :documentId") + void deleteByDocumentId(String documentId); + + @Query("DELETE FROM toxi_document_tag WHERE tag_id = :tagId") + void deleteByTagId(String tagId); + + @Query("DELETE FROM toxi_document_tag WHERE document_id = :documentId AND tag_id = :tagId") + void deleteByDocumentIdAndTagId(String documentId, String tagId); }