1 |
efrain |
1 |
package com.cesams.twogetskills.dao;
|
|
|
2 |
|
|
|
3 |
import androidx.room.Dao;
|
|
|
4 |
import androidx.room.Delete;
|
|
|
5 |
import androidx.room.Query;
|
|
|
6 |
import androidx.room.Insert;
|
|
|
7 |
import androidx.room.Update;
|
|
|
8 |
|
|
|
9 |
import com.cesams.twogetskills.entity.Progress;
|
|
|
10 |
import com.cesams.twogetskills.room.ResultCount;
|
|
|
11 |
import com.cesams.twogetskills.room.ResultTotalInt;
|
|
|
12 |
|
|
|
13 |
@Dao
|
|
|
14 |
public interface ProgressDao {
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
@Query("SELECT COUNT(*) AS count FROM tb_progress where topic_uuid = :topicUuid AND type = 's' AND completed = 1")
|
|
|
19 |
ResultCount getCountSlidesCompletedByTopicUuid(String topicUuid);
|
|
|
20 |
|
|
|
21 |
@Query("SELECT COUNT(*) AS count FROM tb_progress where topic_uuid = :topicUuid AND type = 'c' AND completed = 1")
|
|
|
22 |
ResultCount getCountCapsulesCompletedByTopicUuid(String topicUuid);
|
|
|
23 |
|
|
|
24 |
@Query("SELECT COUNT(*) AS count FROM tb_progress where topic_uuid = :topicUuid AND type = 'c' AND completed = 1 AND returning_after_completed = 0")
|
|
|
25 |
ResultCount getCountCapsulesCompletedWithoutReturningByTopicUuid(String topicUuid);
|
|
|
26 |
|
|
|
27 |
@Query("SELECT SUM(returning_after_completed) AS total FROM tb_progress where topic_uuid = :topicUuid AND type = 'c' AND completed = 1 AND returning_after_completed > 0")
|
|
|
28 |
ResultTotalInt getCountCapsulesCompletedWithReturningByTopicUuid(String topicUuid);
|
|
|
29 |
|
|
|
30 |
@Query("SELECT COUNT(*) AS count FROM tb_progress where capsule_uuid = :capsuleUuid AND type = 's' AND completed = 1")
|
|
|
31 |
ResultCount getCountSlidesCompletedByCapsuleUuid(String capsuleUuid);
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
@Query("SELECT * FROM tb_progress WHERE topic_uuid = :topicUuid AND type = 't' LIMIT 1")
|
|
|
35 |
Progress selectByTopicUuid(String topicUuid);
|
|
|
36 |
|
|
|
37 |
@Query("SELECT * FROM tb_progress WHERE topic_uuid = :topicUuid AND user_uuid = :userUuid AND type = 't' LIMIT 1")
|
|
|
38 |
Progress selectByTopicUuidAndUserUuid(String topicUuid, String userUuid);
|
|
|
39 |
|
|
|
40 |
@Query("SELECT * FROM tb_progress WHERE capsule_uuid = :capsuleUuid AND type = 'c' LIMIT 1")
|
|
|
41 |
Progress selectByCapsuleUuid(String capsuleUuid);
|
|
|
42 |
|
|
|
43 |
@Query("SELECT * FROM tb_progress WHERE capsule_uuid = :capsuleUuid AND user_uuid = :userUuid AND type = 'c' LIMIT 1")
|
|
|
44 |
Progress selectByCapsuleUuidAndUserUuid(String capsuleUuid, String userUuid);
|
|
|
45 |
|
|
|
46 |
@Query("SELECT * FROM tb_progress WHERE slide_uuid = :slideUuid AND type = 's' LIMIT 1")
|
|
|
47 |
Progress selectBySlideUuid(String slideUuid);
|
|
|
48 |
|
|
|
49 |
@Query("SELECT * FROM tb_progress WHERE slide_uuid = :slideUuid AND user_uuid = :userUuid AND type = 's' LIMIT 1")
|
|
|
50 |
Progress selectBySlideUuidAndUserUuid(String slideUuid, String userUuid);
|
|
|
51 |
@Insert
|
|
|
52 |
void insert(Progress progress);
|
|
|
53 |
|
|
|
54 |
@Update
|
|
|
55 |
void update(Progress progress);
|
|
|
56 |
|
|
|
57 |
@Query("DELETE FROM tb_progress WHERE id = :id")
|
|
|
58 |
void remove(int id);
|
|
|
59 |
|
|
|
60 |
@Query("DELETE FROM tb_progress WHERE user_uuid = :userUuid")
|
|
|
61 |
void removeAllUserUuidNotEqual(String userUuid);
|
|
|
62 |
|
|
|
63 |
@Query("DELETE FROM tb_progress")
|
|
|
64 |
void removeAll();
|
|
|
65 |
|
|
|
66 |
}
|