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

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.RelationDictEntity

/**
 * relation_dict 表访问接口
 */
@Dao
interface RelationDictDao {
    @Query("select * from relation_dict")
    suspend fun getRelations(): List<RelationDictEntity>

    @Query("select * from relation_dict where id = :id")
    suspend fun getRelationById(id: String): RelationDictEntity

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insRelation(vararg relation: RelationDictEntity)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insRelations(relations: List<RelationDictEntity>)

    @Delete
    suspend fun delRelation(relation: RelationDictEntity)
}