Daoクエリ追加

This commit is contained in:
r-ca 2024-01-22 23:28:15 +09:00
parent 2a7e329ad7
commit c7f2a3eebe
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9
2 changed files with 6 additions and 0 deletions

View File

@ -32,6 +32,9 @@ public interface DocumentDao {
@Query("SELECT * FROM Document WHERE parent_id = :parentId") @Query("SELECT * FROM Document WHERE parent_id = :parentId")
List<DocumentEntity> findByParentId(String parentId); List<DocumentEntity> findByParentId(String parentId);
@Query("SELECT * FROM Document WHERE parent_id IS NULL")
List<DocumentEntity> findRootDocuments();
@Query("SELECT * FROM Document ORDER BY created_at DESC LIMIT :limit") @Query("SELECT * FROM Document ORDER BY created_at DESC LIMIT :limit")
List<DocumentEntity> getRecentDocument(int limit); List<DocumentEntity> getRecentDocument(int limit);

View File

@ -18,6 +18,9 @@ public interface FolderDao {
@Query("SELECT * FROM Folder WHERE parent_id = :parentId") @Query("SELECT * FROM Folder WHERE parent_id = :parentId")
List<FolderEntity> findByParentId(String parentId); List<FolderEntity> findByParentId(String parentId);
@Query("SELECT * FROM Folder WHERE parent_id IS NULL")
List<FolderEntity> findRootFolders();
@Insert @Insert
void insert(FolderEntity folderEntity); void insert(FolderEntity folderEntity);