管灌系统巡查员智能手机App
zuoxiao
2025-01-08 94c235c116ebca594662417b5fb2c7378f326c6b
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
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.InspectionBean;
 
import io.reactivex.rxjava3.core.Completable;
import io.reactivex.rxjava3.core.Single;
 
 
@Dao
public interface InspectionDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Completable insert(InspectionBean inspectionBean);
 
    @Update
    Completable update(InspectionBean inspectionBean);
 
    @Delete
    void delete(InspectionBean inspectionBean);
 
    @Query("DELETE FROM InspectionBean")
    void deleteAll();
 
 
    //查询当前没有关闭巡检的巡检ID
    @Query("SELECT * FROM InspectionBean WHERE stopTime IS NULL OR stopTime = '' ORDER BY startTime DESC LIMIT 1")
    Single<InspectionBean> getMostRecentInspectionWithNoStopTime();
 
    /**
     * 根据本地巡检id查询巡检记录信息
     *
     * @param mInspectId
     * @return
     */
    @Query("SELECT * FROM InspectionBean WHERE mInspectId  =:mInspectId  ORDER BY startTime DESC LIMIT 1")
    Single<InspectionBean> findBymInspectId(String mInspectId);
 
}