管灌系统巡查员智能手机App
app/src/main/java/com/dayu/pipirrapp/dao/InspectionDao.java
@@ -9,7 +9,10 @@
import com.dayu.pipirrapp.bean.db.InspectionBean;
import java.util.List;
import io.reactivex.rxjava3.core.Completable;
import io.reactivex.rxjava3.core.Maybe;
import io.reactivex.rxjava3.core.Single;
@@ -19,7 +22,7 @@
    Completable insert(InspectionBean inspectionBean);
    @Update
    void update(InspectionBean inspectionBean);
    Completable update(InspectionBean inspectionBean);
    @Delete
    void delete(InspectionBean inspectionBean);
@@ -27,8 +30,25 @@
    @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);
    /**
     * 获取所有巡检记录
     * @return
     */
    @Query("SELECT * FROM InspectionBean  ORDER BY startTime DESC LIMIT 1")
    Maybe<List<InspectionBean>>  findAll();
}