增加质检结果展示页面

This commit is contained in:
squallzhjch
2023-04-12 15:07:46 +08:00
parent fa4ad254a5
commit 88326d3247
76 changed files with 1554 additions and 655 deletions

View File

@@ -0,0 +1,21 @@
package com.navinfo.omqs.db
import androidx.room.Database
import androidx.room.RoomDatabase
import com.navinfo.omqs.bean.OfflineMapCityBean
import com.navinfo.omqs.bean.ScProblemTypeBean
import com.navinfo.omqs.bean.ScRootCauseAnalysisBean
import com.navinfo.omqs.db.dao.OfflineMapDao
import com.navinfo.omqs.db.dao.ScProblemTypeDao
import com.navinfo.omqs.db.dao.ScRootCauseAnalysisDao
@Database(
entities = [OfflineMapCityBean::class, ScProblemTypeBean::class, ScRootCauseAnalysisBean::class],
version = 1,
exportSchema = false
)
abstract class RoomAppDatabase : RoomDatabase() {
abstract fun getOfflineMapDao(): OfflineMapDao
abstract fun getScProblemTypeDao(): ScProblemTypeDao
abstract fun getScRootCauseAnalysisDao(): ScRootCauseAnalysisDao
}

View File

@@ -0,0 +1,23 @@
package com.navinfo.omqs.db.dao
import androidx.room.*
import com.navinfo.omqs.bean.OfflineMapCityBean
@Dao
interface OfflineMapDao {
@Insert
suspend fun insert(message: OfflineMapCityBean): Long
@Update(onConflict = OnConflictStrategy.REPLACE)
suspend fun update(message: OfflineMapCityBean)
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertOrUpdate(list: List<OfflineMapCityBean>)
@Query("select * from OfflineMapCity order by id")
suspend fun getOfflineMapList(): List<OfflineMapCityBean>
@Query("select * from OfflineMapCity where status != 0 order by id")
suspend fun getOfflineMapListWithOutNone(): List<OfflineMapCityBean>
}

View File

@@ -0,0 +1,50 @@
package com.navinfo.omqs.db.dao
import androidx.room.*
import androidx.sqlite.db.SupportSQLiteDatabase
import com.navinfo.collect.library.data.dao.impl.MapLifeDataBase.getDatabase
import com.navinfo.omqs.bean.ScProblemTypeBean
@Dao
interface ScProblemTypeDao {
// @Insert(onConflict = OnConflictStrategy.REPLACE)
// suspend fun insert(bean: ScProblemTypeBean): Long
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertList(list: List<ScProblemTypeBean>)
@Query("delete from ScProblemType")
suspend fun deleteAll()
/**
* 更新整个数据库表,由于没有
*/
@Transaction
suspend fun insertOrUpdateList(list: List<ScProblemTypeBean>) {
//先删除
deleteAll()
//后插入
insertList(list)
}
/**
* 获取问题分类,并去重
*/
@Query("select DISTINCT CLASS_TYPE from ScProblemType order by CLASS_TYPE")
suspend fun findClassTypeList(): List<String>?
/**
* 获取问题类型,并去重
*/
@Query("select DISTINCT TYPE from ScProblemType where CLASS_TYPE=:type order by TYPE")
suspend fun findProblemTypeList(type: String): List<String>
/**
*
*/
@Query("select PHENOMENON from ScProblemType where CLASS_TYPE=:classType and TYPE=:type order by PHENOMENON")
suspend fun getPhenomenonList(classType: String, type: String): List<String>
}

View File

@@ -0,0 +1,25 @@
package com.navinfo.omqs.db.dao
import androidx.room.*
import com.navinfo.omqs.bean.ScRootCauseAnalysisBean
@Dao
interface ScRootCauseAnalysisDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertList(list: List<ScRootCauseAnalysisBean>)
@Query("delete from ScRootCauseAnalysis")
suspend fun deleteAll()
@Transaction
suspend fun insertOrUpdateList(list: List<ScRootCauseAnalysisBean>) {
//先删除
deleteAll()
//后插入
insertList(list)
}
}