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);
|
}
|