package com.framework.mvvm.model.db.dao

import androidx.room.*
import com.framework.mvvm.model.db.entity.ProblemEquipEntity

/**
 * 表 problem_equip Dao
 */
@Dao
interface ProblemEquipDao {
    @Query("select * from problem_equip")
    suspend fun getProblems(): List<ProblemEquipEntity>

    @Query("select * from problem_equip where id = :id")
    suspend fun getProblemById(id: String): ProblemEquipEntity

    @Query("select * from problem_equip where building_id = :id")
    suspend fun getProblemByBuildingId(id: String): List<ProblemEquipEntity>

    @Query("select * from problem_equip where equip_id = :id")
    suspend fun getProblemByEquipId(id: String): ProblemEquipEntity?

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insProblem(vararg problem: ProblemEquipEntity)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insProblems(problems: List<ProblemEquipEntity>)

    @Update
    suspend fun updateProblems(problems: List<ProblemEquipEntity>)

    @Delete
    suspend fun delProblem(config: ProblemEquipEntity)
}