Proyectos de Subversion Android Microlearning

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
package com.cesams.twogetskills.dao;
2
 
3
import androidx.room.Dao;
4
import androidx.room.Delete;
5
import androidx.room.Insert;
6
import androidx.room.Query;
7
import androidx.room.Update;
8
 
9
import com.cesams.twogetskills.entity.Capsule;
10
import com.cesams.twogetskills.room.ResultCount;
11
 
12
import java.util.List;
13
 
14
@Dao
15
public interface CapsuleDao {
16
 
17
    @Query("SELECT * FROM tb_capsules ORDER BY position, name")
18
    public List<Capsule> selectAll();
19
 
20
    @Query("SELECT * FROM tb_capsules WHERE topic_uuid = :topicUuid ORDER BY position, name")
21
    public List<Capsule> selectAllByTopicUuid(String topicUuid);
22
 
23
 
24
    @Query("SELECT * FROM tb_capsules WHERE uuid = :uuid LIMIT 1")
25
    Capsule selectByUuid(String uuid);
26
 
27
    @Query("SELECT COUNT(*) AS count FROM tb_capsules WHERE topic_uuid = :topicUuid LIMIT 1")
28
    ResultCount getCountByTopicUuid(String topicUuid);
29
 
30
    @Query("SELECT COUNT(*) AS count FROM tb_capsules LIMIT 1")
31
    ResultCount getCount();
32
 
33
    @Insert
34
    void insert(Capsule capsule);
35
 
36
 
37
    @Update
38
    void update(Capsule capsule);
39
 
40
    @Query("DELETE FROM tb_capsules WHERE uuid = :uuid")
41
    void removeByUuid(String uuid);
42
 
43
    @Query("DELETE FROM tb_capsules")
44
    void removeAll();
45
 
46
}