Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

Rev 23 | 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.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")
23 gabriel 18
    List<Capsule> selectAll();
1 gabriel 19
 
20
    @Query("SELECT * FROM tb_capsules WHERE topic_uuid = :topicUuid ORDER BY position, name")
23 gabriel 21
    List<Capsule> selectAllByTopicUuid(String topicUuid);
1 gabriel 22
 
23 gabriel 23
    @Query("SELECT * FROM tb_capsules WHERE topic_uuid = :topicUuid ORDER BY added_on DESC")
24
    List<Capsule> selectAllByTopicUuidandOrder(String topicUuid);
1 gabriel 25
 
23 gabriel 26
 
1 gabriel 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
 
58 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
}