管灌系统巡查员智能手机App
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.dayu.pipirrapp.dao;
 
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;
 
import com.dayu.pipirrapp.bean.db.InspectionLocationBean;
 
import java.util.List;
 
import io.reactivex.rxjava3.core.Completable;
import io.reactivex.rxjava3.core.Single;
 
@Dao
public interface InspectionLocationDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Completable insert(InspectionLocationBean inspectionLocationBean);
 
    @Update
    Completable update(InspectionLocationBean inspectionLocationBean);
 
    @Delete
    void delete(InspectionLocationBean inspectionLocationBean);
 
    @Query("DELETE FROM InspectionLocationBean")
    void deleteAll();
 
    @Query("select  * from InspectionLocationBean limit 1")
    InspectionLocationBean findFirst();
 
    //查询所有没有上传的坐标
    @Query("select  * from InspectionLocationBean where isPost=false AND mInspectId=:mInspectId ORDER BY locateTime ASC")
    Single<List<InspectionLocationBean>> findByNoPostAndInspectId(String mInspectId);
 
 
    //查询所有该巡检id的坐标
    @Query("select  * from InspectionLocationBean where mInspectId=:mInspectId ORDER BY locateTime ASC")
    Single<List<InspectionLocationBean>> findByInspectId(String mInspectId);
 
    //查询所有未上传的mInspectId
    @Query("SELECT DISTINCT mInspectId FROM InspectionLocationBean WHERE isPost = false")
    Single<List<String>> getUnpostedMInspectIds();
 
    //更新所有mInspectId下的已上传状态
    @Query("UPDATE InspectionLocationBean SET isPost = true WHERE mInspectId = :mInspectId")
    Completable updataByInspectIdSetIsPost(String mInspectId);
}