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

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

/**
 * 表 info_dict dao
 */
@Dao
interface InfoDictDao {
    @Query("select * from info_dict")
    suspend fun getInfos(): List<InfoDictEntity>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insInfo(vararg info: InfoDictEntity)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insInfos(infos: List<InfoDictEntity>)

    @Update
    suspend fun updateInfo(vararg info: InfoDictEntity)

    @Query("select * from info_dict where (class_code = :classCode or class_code= :parentClassCode) and code = :code")
    suspend fun getInfoByClassCodeAndCode(
        classCode: String,
        parentClassCode: String,
        code: String
    ): InfoDictEntity?

}