Proyectos de Subversion Android Microlearning - Inconcert

Rev

Rev 1 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 gabriel 1
package com.cesams.twogetskills.inconcert.dao;
2
 
3
import androidx.room.Dao;
14 gabriel 4
import androidx.room.Delete;
1 gabriel 5
import androidx.room.Insert;
6
import androidx.room.Query;
7
import androidx.room.Update;
8
 
9
import com.cesams.twogetskills.inconcert.entity.Capsule;
10
import com.cesams.twogetskills.inconcert.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
    List<Capsule> selectAll();
19
 
20
    @Query("SELECT * FROM tb_capsules WHERE topic_uuid = :topicUuid ORDER BY position, name")
21
    List<Capsule> selectAllByTopicUuid(String topicUuid);
22
 
23
    @Query("SELECT * FROM tb_capsules WHERE topic_uuid = :topicUuid ORDER BY added_on DESC")
24
    List<Capsule> selectAllByTopicUuidandOrder(String topicUuid);
25
 
26
 
27
    @Query("SELECT * FROM tb_capsules WHERE uuid = :uuid LIMIT 1")
28
    Capsule selectByUuid(String uuid);
29
 
30
    @Query("SELECT COUNT(*) AS count FROM tb_capsules WHERE topic_uuid = :topicUuid LIMIT 1")
31
    ResultCount getCountByTopicUuid(String topicUuid);
32
 
33
    @Query("SELECT COUNT(*) AS count FROM tb_capsules LIMIT 1")
34
    ResultCount getCount();
35
 
36
    @Insert
37
    void insert(Capsule capsule);
38
 
39
 
40
    @Update
41
    void update(Capsule capsule);
42
 
14 gabriel 43
    @Query("UPDATE tb_capsules set total_comments= :total_comments, total_rating= :total_rating where uuid=:uuid")
44
    void updateByUuid(String uuid, String total_comments, String total_rating);
45
 
1 gabriel 46
    @Query("DELETE FROM tb_capsules WHERE uuid = :uuid")
47
    void removeByUuid(String uuid);
48
 
49
    @Query("DELETE FROM tb_capsules")
50
    void removeAll();
51
 
52
}