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

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

/**
 * 表 info dao
 */
@Dao
interface InfoDao {
    @Query("select * from info")
    suspend fun getInfos(): List<InfoEntity>

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

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

    @Update
    suspend fun updateInfo(vararg info: InfoEntity)

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

}