package com.ys.bdtp.adm.mvvm.model.db.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.ys.bdtp.adm.mvvm.model.db.entity.dict.InfosConfigEntity

/**
 * 表 infos_config Dao
 */
@Dao
interface InfosConfigDao {
    @Query("select * from infos_config")
    suspend fun getConfigs(): List<InfosConfigEntity>

    @Query("select * from infos_config where id = :id")
    suspend fun getConfigById(id: String): InfosConfigEntity

    @Query("select * from infos_config where obj_type = :type and class_code ='GeneralZone'")
    suspend fun getConfigByObjType(type: String): List<InfosConfigEntity>

    @Query("select * from infos_config where obj_type = :type and class_code =:code")
    suspend fun getConfigByEquipCode(type: String, code: String): List<InfosConfigEntity>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insConfig(vararg config: InfosConfigEntity)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insConfigs(configs: List<InfosConfigEntity>)

    @Delete
    suspend fun delConfig(config: InfosConfigEntity)
}