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

import androidx.room.*
import com.ys.bdtp.adm.mvvm.model.db.entity.dict.PipeConfigEntity

/**
 * 表 pipe_config Dao
 */
@Dao
interface PipeConfigDao {
    @Query("select * from pipe_config")
    suspend fun getConfigs(): List<PipeConfigEntity>

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

    @Query("select * from pipe_config where class_code_from = :code")
    suspend fun getConfigByCodeFrom(code: String): List<PipeConfigEntity>

    @Query("select * from pipe_config where class_code_to = :code")
    suspend fun getConfigByCodeTo(code: String): List<PipeConfigEntity>

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

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

    @Delete
    suspend fun delConfig(config: PipeConfigEntity)
}