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 |
|
44 |
efrain |
16 |
@Query("SELECT COUNT(*) AS count FROM tb_progress where topic_uuid = :topicUuid AND type = 's' AND completed = 1 AND user_uuid = :userUuid")
|
|
|
17 |
ResultCount getCountSlidesCompletedByTopicUuidAndUserUuid(String topicUuid, String userUuid);
|
1 |
efrain |
18 |
|
44 |
efrain |
19 |
@Query("SELECT COUNT(*) AS count FROM tb_progress where topic_uuid = :topicUuid AND type = 'c' AND completed = 1 AND user_uuid = :userUuid")
|
|
|
20 |
ResultCount getCountCapsulesCompletedByTopicUuidAndUserUuid(String topicUuid, String userUuid);
|
1 |
efrain |
21 |
|
44 |
efrain |
22 |
@Query("SELECT COUNT(*) AS count FROM tb_progress where topic_uuid = :topicUuid AND type = 'c' AND completed = 1 AND user_uuid = :userUuid AND returning_after_completed = 0")
|
|
|
23 |
ResultCount getCountCapsulesCompletedWithoutReturningByTopicUuidAndUserUuid(String topicUuid, String userUuid);
|
1 |
efrain |
24 |
|
44 |
efrain |
25 |
@Query("SELECT SUM(returning_after_completed) AS total FROM tb_progress where topic_uuid = :topicUuid AND user_uuid = :userUuid AND type = 'c' AND completed = 1 AND returning_after_completed > 0")
|
|
|
26 |
ResultTotalInt getCountCapsulesCompletedWithReturningByTopicUuidAndUserUuid(String topicUuid, String userUuid);
|
1 |
efrain |
27 |
|
44 |
efrain |
28 |
@Query("SELECT COUNT(*) AS count FROM tb_progress where capsule_uuid = :capsuleUuid AND user_uuid = :userUuid AND type = 's' AND completed = 1")
|
|
|
29 |
ResultCount getCountSlidesCompletedByCapsuleUuidAndUserUuid(String capsuleUuid, String userUuid);
|
1 |
efrain |
30 |
|
|
|
31 |
|
|
|
32 |
@Query("SELECT * FROM tb_progress WHERE topic_uuid = :topicUuid AND user_uuid = :userUuid AND type = 't' LIMIT 1")
|
|
|
33 |
Progress selectByTopicUuidAndUserUuid(String topicUuid, String userUuid);
|
|
|
34 |
|
|
|
35 |
@Query("SELECT * FROM tb_progress WHERE capsule_uuid = :capsuleUuid AND user_uuid = :userUuid AND type = 'c' LIMIT 1")
|
|
|
36 |
Progress selectByCapsuleUuidAndUserUuid(String capsuleUuid, String userUuid);
|
|
|
37 |
|
|
|
38 |
@Query("SELECT * FROM tb_progress WHERE slide_uuid = :slideUuid AND user_uuid = :userUuid AND type = 's' LIMIT 1")
|
|
|
39 |
Progress selectBySlideUuidAndUserUuid(String slideUuid, String userUuid);
|
|
|
40 |
@Insert
|
|
|
41 |
void insert(Progress progress);
|
|
|
42 |
|
|
|
43 |
@Update
|
|
|
44 |
void update(Progress progress);
|
|
|
45 |
|
|
|
46 |
@Query("DELETE FROM tb_progress WHERE id = :id")
|
|
|
47 |
void remove(int id);
|
|
|
48 |
|
43 |
efrain |
49 |
@Query("DELETE FROM tb_progress WHERE user_uuid != :userUuid")
|
1 |
efrain |
50 |
void removeAllUserUuidNotEqual(String userUuid);
|
|
|
51 |
|
|
|
52 |
@Query("DELETE FROM tb_progress")
|
|
|
53 |
void removeAll();
|
|
|
54 |
|
|
|
55 |
}
|